Java Code Examples for java.awt.Color#GRAY

The following examples show how to use java.awt.Color#GRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PdfClassListTableBuilder.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected PdfPCell pdfBuildPrefGroupLabel(CourseOffering co, PreferenceGroup prefGroup, String indentSpaces, boolean isEditable, String prevLabel) {
	if (prefGroup instanceof Class_) {
		Color color = (isEditable?Color.BLACK:Color.GRAY);
		String label = prefGroup.toString();
    	Class_ aClass = (Class_) prefGroup;
    	label = aClass.getClassLabel(co);
    	if (prevLabel != null && label.equals(prevLabel)){
    		label = "";
    	}
    	PdfPCell cell = createCell();
    	addText(cell, indentSpaces+label, co.isIsControl(), false, Element.ALIGN_LEFT, color, true);
     InstructionalMethod im = aClass.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod();
    	if (im != null)
     	addText(cell, " (" + im.getReference() + ")", false, false, Element.ALIGN_LEFT, color, false);
    	return cell;
	} else return super.pdfBuildPrefGroupLabel(co, prefGroup, indentSpaces, isEditable, null);
}
 
Example 2
Source File: AqlViewer.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
public Paint color() {
	if (en1 != null) {
		return Color.BLACK;
	} else if (en2 != null) {
		return Color.GRAY;
	}
	if (att1 != null) {
		return Color.BLUE;
	} else if (att2 != null) {
		return Color.CYAN;
	}
	if (fk1 != null) {
		return Color.red;
	} else if (fk2 != null) {
		return Color.magenta;
	} else if (ty != null) {
		return Color.white;
	}
	return Util.anomaly();
}
 
Example 3
Source File: FilterPanel.java    From jeveassets with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
	if (!gui.fade(FilterPanel.this)) {
		return;
	}
	moving = true;
	Fade fadeIn = new Fade(components, 100, Color.GRAY);
	fadeIn.start(true);

	from = gui.getFromIndex(FilterPanel.this);
	to = gui.getToIndex(FilterPanel.this);
	index = from;
	moveTimer.start();
	synchronized (this) {
		try {
			wait();
		} catch (InterruptedException ex) {
			//No problem
		}
	}
	Fade fadeOut = new Fade(components, 750);
	fadeOut.start(true);
}
 
Example 4
Source File: GroundItemsConfig.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@ConfigItem(
	keyName = "hiddenColor",
	name = "Hidden items",
	description = "Configures the color for hidden items in right-click menu and when holding ALT",
	position = 4,
	titleSection = "colorsTitle"
)
@Alpha
default Color hiddenColor()
{
	return Color.GRAY;
}
 
Example 5
Source File: SimpleInternalFrame.java    From chipster with MIT License 5 votes vote down vote up
public void paintBorder(Component c, Graphics g,
    int x, int y, int w, int h) {
        
    Color shadow        = UIManager.getColor("controlShadow");
    if (shadow == null) {
        shadow = Color.GRAY;
    }
    Color lightShadow   = new Color(shadow.getRed(), 
                                    shadow.getGreen(), 
                                    shadow.getBlue(), 
                                    170);
    Color lighterShadow = new Color(shadow.getRed(),
                                    shadow.getGreen(),
                                    shadow.getBlue(),
                                    70);
    g.translate(x, y);
    
    g.setColor(shadow);
    g.fillRect(0, 0, w - 3, 1);
    g.fillRect(0, 0, 1, h - 3);
    g.fillRect(w - 3, 1, 1, h - 3);
    g.fillRect(1, h - 3, w - 3, 1);
    // Shadow line 1
    g.setColor(lightShadow);
    g.fillRect(w - 3, 0, 1, 1);
    g.fillRect(0, h - 3, 1, 1);
    g.fillRect(w - 2, 1, 1, h - 3);
    g.fillRect(1, h - 2, w - 3, 1);
    // Shadow line2
    g.setColor(lighterShadow);
    g.fillRect(w - 2, 0, 1, 1);
    g.fillRect(0, h - 2, 1, 1);
    g.fillRect(w-2, h-2, 1, 1);
    g.fillRect(w - 1, 1, 1, h - 2);
    g.fillRect(1, h - 1, w - 2, 1);
    g.translate(-x, -y);
}
 
Example 6
Source File: GtkEditorTabDisplayerUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void paintAfterTabs(Graphics g) {
    Rectangle bounds = displayer.getBounds();

    int lineY = bounds.y + bounds.height - 1;
    int sel = displayer.getSelectionModel().getSelectedIndex();

    Color shadowC = UIManager.getColor("controlShadow");
    shadowC = shadowC != null ? shadowC : Color.DARK_GRAY;

    if (sel != -1) {
        Color controlC = UIManager.getColor("control");
        controlC = controlC != null ? controlC : Color.GRAY;

        Rectangle tabRect = new Rectangle();
        displayer.getTabRect(sel, tabRect);
        g.setColor(shadowC);
        g.drawLine(bounds.x, lineY, bounds.x + tabRect.x - 1, lineY);
        g.drawLine(bounds.x + tabRect.x + tabRect.width, lineY,
                bounds.x + bounds.width - 1, lineY);
        g.setColor(controlC);
        g.drawLine(bounds.x + tabRect.x, lineY,
                bounds.x + tabRect.x + tabRect.width - 1, lineY);
    } else {
        g.setColor(shadowC);
        g.drawLine(bounds.x, lineY, bounds.x + bounds.width - 1, lineY);
    }
}
 
Example 7
Source File: PrefManagerTest.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/** Test method for {@link com.sldeditor.common.preferences.PrefManager#finish()}. */
@Test
public void testFinish() {
    PrefManager.initialise(null);
    PrefManager.getInstance().finish();

    DummyPropertyManager propertyManager = new DummyPropertyManager();
    PrefManager.initialise(propertyManager);

    // Set up data as if it had been read in
    PrefData prefData = new PrefData();
    prefData.setUseAntiAlias(true);
    Color backgroundColour = Color.GRAY;
    prefData.setBackgroundColour(backgroundColour);
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
    vendorOptionList.add(VersionData.getEarliestVersion(GeoServerVendorOption.class));

    prefData.setVendorOptionVersionList(vendorOptionList);
    String uiLayoutClass = "perfect curve";
    prefData.setUiLayoutClass(uiLayoutClass);
    String lastFolderViewed = "secret";
    prefData.setLastFolderViewed(lastFolderViewed);
    prefData.setLastViewedKey(PrefDataLastViewedEnum.FOLDER);
    prefData.setSaveLastFolderView(true);
    String charsetName = "UTF-8";
    prefData.setFileEncoding(Charset.forName(charsetName));

    PrefManager.getInstance().setPrefData(prefData);
    PrefManager.getInstance().finish();

    // Try GeoServer as last item viewed
    prefData.setLastViewedKey(PrefDataLastViewedEnum.GEOSERVER);
    PrefManager.getInstance().setPrefData(prefData);
    PrefManager.getInstance().finish();
}
 
Example 8
Source File: ColorChooserPanel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
protected JComponent createColorPicker() {

        Color[] colors = {Color.BLACK,
                Color.DARK_GRAY,
                Color.GRAY,
                Color.LIGHT_GRAY,
                Color.WHITE,
                Color.CYAN,
                Color.BLUE,
                Color.MAGENTA,
                Color.YELLOW,
                Color.ORANGE,
                Color.RED,
                Color.PINK,
                Color.GREEN};


        JPanel colorsPanel = new JPanel(new GridLayout(-1, 6, 4, 4));
        colorsPanel.setOpaque(false);
        for (Color color : colors) {
            ColorLabel colorLabel = new ColorLabel(color);
            colorLabel.setDisplayName(ColorCodes.getName(color));
            colorLabel.setHoverEnabled(true);
            colorLabel.setMaximumSize(colorLabel.getPreferredSize());
            colorLabel.setMinimumSize(colorLabel.getPreferredSize());
            colorLabel.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    setSelectedColor(colorLabel.getColor());
                }
            });
            colorsPanel.add(colorLabel);
        }
        return colorsPanel;
    }
 
Example 9
Source File: NewPluginPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static Border getNbScrollPaneBorder () {
    Border b = UIManager.getBorder("Nb.ScrollPane.border");
    if (b == null) {
        Color c = UIManager.getColor("controlShadow");
        b = new LineBorder(c != null ? c : Color.GRAY);
    }
    return b;
}
 
Example 10
Source File: LogViewMgr.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void processColors() {
    try {
        Matcher matcher = colorPattern.matcher(message);
        boolean result = matcher.find();
        if(result) {
            StringBuffer sb = new StringBuffer(message.length());
            do {
                int count = matcher.groupCount();
                for(int i = 1; i < count && matcher.group(i) != null; i++) {
                    int code = Integer.parseInt(matcher.group(i));
                    if(code >= 30 && code <= 36 && color == null) {
                        color = colorTable[code - 30];
                    }
                }
                matcher.appendReplacement(sb, "");
                result = matcher.find();
            } while(result);
            matcher.appendTail(sb);
            message = sb.toString();
        }
    } catch(Exception ex) {
        Logger.getLogger("glassfish").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
    }
    if(color == null && level > 0) {
        if(level <= Level.FINE.intValue()) {
            color = LOG_GREEN;
        } else if(level <= Level.INFO.intValue()) {
            color = Color.GRAY;
        }
    }
}
 
Example 11
Source File: ColorUtils.java    From frog with Apache License 2.0 5 votes vote down vote up
public static Color rainbowColor(float i) { // 根据数值大小范围,在8种彩虹色中取值
	if (i <= 20)
		return Color.GRAY;
	if (i <= 30)
		return Color.BLACK;
	if (i <= 50)
		return Color.RED;
	return Color.MAGENTA;
}
 
Example 12
Source File: LSPDiagnosticsToMarkers.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
private Color getColor(DiagnosticSeverity severity) {
    switch (severity) {
        case Hint:
            return Color.GRAY;
        case Error:
            return Color.RED;
        case Information:
            return Color.GRAY;
        case Warning:
            return Color.YELLOW;
    }
    return Color.GRAY;
}
 
Example 13
Source File: MessagePanel.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Color getLevelColor (Level level)
{
    if (level.isGreaterOrEqual(Level.ERROR)) {
        return Color.RED;
    } else if (level.isGreaterOrEqual(Level.WARN)) {
        return Color.BLUE;
    } else if (level.isGreaterOrEqual(Level.INFO)) {
        return Color.BLACK;
    } else {
        return Color.GRAY;
    }
}
 
Example 14
Source File: TileIndicatorsConfig.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Alpha
@ConfigItem(
	keyName = "highlightDestinationColor",
	name = "Color of current destination highlighting",
	description = "Configures the highlight color of current destination",
	position = 0
)
default Color highlightDestinationColor()
{
	return Color.GRAY;
}
 
Example 15
Source File: PrefManagerTest.java    From sldeditor with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.common.preferences.PrefManager#initialise(com.sldeditor.common.property.PropertyManagerInterface)}.
 */
@Test
public void testInitialise() {
    PrefManager.initialise(null);

    DummyPropertyManager propertyManager = new DummyPropertyManager();
    PrefManager.initialise(propertyManager);

    PrefData prefData = new PrefData();
    prefData.setUseAntiAlias(true);
    Color backgroundColour = Color.GRAY;
    prefData.setBackgroundColour(backgroundColour);
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());

    String charsetName = "UTF-16";
    prefData.setFileEncoding(Charset.forName(charsetName));
    assertEquals(
            charsetName, propertyManager.getStringValue("SldEditor.fileencoding", charsetName));

    prefData.setVendorOptionVersionList(vendorOptionList);
    String uiLayoutClass = "perfect curve";

    prefData.setUiLayoutClass(uiLayoutClass);

    PrefManager.getInstance().setPrefData(prefData);

    Color newBackgroundColour = Color.RED;
    prefData.setBackgroundColour(newBackgroundColour);
    PrefManager.getInstance().setPrefData(prefData);
    assertEquals(
            newBackgroundColour,
            propertyManager.getColourValue("SldEditor.backgroundColour", null));

    boolean newAntiAlias = false;
    prefData.setUseAntiAlias(newAntiAlias);
    PrefManager.getInstance().setPrefData(prefData);
    assertEquals(newAntiAlias, propertyManager.getBooleanValue("SldEditor.useAntiAlias", true));

    String newLayoutClass = "bendy line";
    prefData.setUiLayoutClass(newLayoutClass);
    PrefManager.getInstance().setPrefData(prefData);
    assertEquals(newLayoutClass, propertyManager.getStringValue("SldEditor.uilayout", null));

    List<VersionData> newVendorOptionList = new ArrayList<VersionData>();
    newVendorOptionList.add(
            VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());

    prefData.setVendorOptionVersionList(newVendorOptionList);
    PrefManager.getInstance().setPrefData(prefData);
    newVendorOptionList.add(VersionData.getLatestVersion(GeoServerVendorOption.class));
    prefData.setVendorOptionVersionList(newVendorOptionList);
    PrefManager.getInstance().setPrefData(prefData);

    List<String> encodelist = new ArrayList<String>();
    for (VersionData versionData : newVendorOptionList) {
        encodelist.add(versionData.getEncodedString());
    }
    assertTrue(
            PrefManager.cmpList(
                    encodelist, propertyManager.getStringListValue("SldEditor.vendorOptions")));

    PrefManager.initialise(null);
}
 
Example 16
Source File: TableSorter.java    From evosql with Apache License 2.0 4 votes vote down vote up
public void paintIcon(Component c, Graphics g, int x, int y) {

            Color color = c == null ? Color.GRAY
                                    : c.getBackground();

            // In a compound sort, make each succesive triangle 20%
            // smaller than the previous one.
            int dx = (int) (size / 2 * Math.pow(0.8, priority));
            int dy = descending ? dx
                                : -dx;

            // Align icon (roughly) with font baseline.
            y = y + 5 * size / 6 + (descending ? -dy
                                               : 0);

            int shift = descending ? 1
                                   : -1;

            g.translate(x, y);

            // Right diagonal.
            g.setColor(color.darker());
            g.drawLine(dx / 2, dy, 0, 0);
            g.drawLine(dx / 2, dy + shift, 0, shift);

            // Left diagonal.
            g.setColor(color.brighter());
            g.drawLine(dx / 2, dy, dx, 0);
            g.drawLine(dx / 2, dy + shift, dx, shift);

            // Horizontal line.
            if (descending) {
                g.setColor(color.darker().darker());
            } else {
                g.setColor(color.brighter().brighter());
            }

            g.drawLine(dx, 0, 0, 0);
            g.setColor(color);
            g.translate(-x, -y);
        }
 
Example 17
Source File: View2D.java    From energy2d with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void drawHeliostats(Graphics2D g) {
	List<Heliostat> heliostats = model.getHeliostats();
	if (heliostats.isEmpty())
		return;
	Stroke oldStroke = g.getStroke();
	Color oldColor = g.getColor();
	Symbol.HeliostatIcon heliostatIcon = new Symbol.HeliostatIcon(Color.GRAY, Color.BLACK, false);
	synchronized (heliostats) {
		for (Heliostat hs : heliostats) {
			if (hs.isVisible()) {
				Rectangle2D r = hs.getShape().getBounds2D();
				float x = convertPointToPixelXf((float) r.getX());
				float y = convertPointToPixelYf((float) r.getY());
				float w = convertLengthToPixelXf((float) r.getWidth());
				float h = convertLengthToPixelYf((float) r.getHeight());
				heliostatIcon.setIconWidth(Math.round(w));
				heliostatIcon.setIconHeight(Math.round(h));
				heliostatIcon.setAngle(hs.getAngle());
				heliostatIcon.setStroke(moderateStroke);
				heliostatIcon.setBorderColor(hs == selectedManipulable ? Color.YELLOW : Color.BLACK);
				heliostatIcon.paintIcon(this, g, Math.round(x), Math.round(y));
				Shape s = hs.getShape();
				if (s instanceof Rectangle2D.Float) {
					Rectangle2D.Float r2 = (Rectangle2D.Float) s;
					x = convertPointToPixelXf(r2.x);
					y = convertPointToPixelYf(r2.y);
					w = convertLengthToPixelXf(r2.width);
					h = convertLengthToPixelYf(r2.height);
					String label = hs.getLabel();
					if (label != null)
						drawLabelWithLineBreaks(g, label, x + 0.5f * w, y + 0.5f * h, w < h * 0.25f);
					if (selectedManipulable == hs) {
						g.setStroke(longDashed);
						g.draw(new Rectangle2D.Float(x, y, w, h));
					}
				}
			}
		}
	}
	g.setStroke(oldStroke);
	g.setColor(oldColor);
}
 
Example 18
Source File: FarmingContractInfoBox.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getTooltip()
{
	SummaryState summary = manager.getSummary();

	Color contractColor;
	String contractDescription;
	switch (summary)
	{
		case COMPLETED:
			contractDescription = "Ready";
			contractColor = ColorScheme.PROGRESS_COMPLETE_COLOR;
			break;
		case OCCUPIED:
			contractDescription = "Occupied";
			contractColor = ColorScheme.PROGRESS_ERROR_COLOR;
			break;
		case IN_PROGRESS:
			contractDescription = "Ready " + TabContentPanel.getFormattedEstimate(manager.getCompletionTime() - Instant.now().getEpochSecond(),
				config.estimateRelative());
			contractColor = Color.GRAY;
			break;
		case EMPTY:
		case UNKNOWN:
		default:
			contractDescription = null;
			contractColor = Color.GRAY;
			break;
	}

	StringBuilder sb = new StringBuilder();
	sb.append(ColorUtil.wrapWithColorTag("Farming Contract", Color.WHITE));
	sb.append("</br>");
	sb.append(ColorUtil.wrapWithColorTag(contract.getName(), contractColor));

	if (contractDescription != null)
	{
		sb.append("</br>");
		sb.append(ColorUtil.wrapWithColorTag(contractDescription, contractColor));
	}

	return sb.toString();
}
 
Example 19
Source File: RegularPolygon.java    From ThinkJavaCode2 with MIT License 2 votes vote down vote up
/**
 * Constructs a regular polygon, given the number of sides and the radius.
 * 
 * @param nsides the number of sides
 * @param radius from center to vertex
 */
public RegularPolygon(int nsides, int radius) {
    this(nsides, radius, Color.GRAY);
}
 
Example 20
Source File: PropertySheet.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**Deprecated.  Does not return a meaningful value.
 * @deprecated Relic of the original property sheet implementation.  Display of properties
 * is handled by the look and feel.
 * @return the color */
public @Deprecated Color getDisabledPropertyColor() {
    return Color.GRAY;
}