Java Code Examples for java.awt.Color#yellow()
The following examples show how to use
java.awt.Color#yellow() .
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: BrowserDisplayer.java From netbeans with Apache License 2.0 | 6 votes |
/** * Sets the text Color for the activator text. * The following is a list of supported Color names * <ul> * <li>black * <li>blue * <li>cyan * <li>darkGray * <li>gray * <li>green * <li>lightGray * <li>magenta * <li>orange * <li>pink * <li>red * <li>white * <li>yellow * </ul> */ public void setTextColor(String name) { Color color=null; if ("black".equals(name)) { color = Color.black; } else if ("blue".equals(name)) { color = Color.blue; } else if ("cyan".equals(name)) { color = Color.cyan; } else if ("darkGray".equals(name)) { color = Color.darkGray; } else if ("gray".equals(name)) { color = Color.gray; } else if ("green".equals(name)) { color = Color.green; } else if ("lightGray".equals(name)) { color = Color.lightGray; } else if ("magenta".equals(name)) { color = Color.magenta; } else if ("orange".equals(name)) { color = Color.orange; } else if ("pink".equals(name)) { color = Color.pink; } else if ("red".equals(name)) { color = Color.red; } else if ("white".equals(name)) { color = Color.white; } else if ("yellow".equals(name)) { color = Color.yellow; } if (color == null) { return; } textAttribs.removeAttribute(StyleConstants.Foreground); textAttribs.addAttribute(StyleConstants.Foreground, color); setForeground(color); }
Example 2
Source File: EncryptionTool.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Saves the current xml control to the specified file. * * @param fileName the file name * @return the name of the saved file, or null if not saved */ private String save(String fileName) { if((fileName==null)||fileName.equals("")) { //$NON-NLS-1$ return null; } if(passwordField.getBackground()==Color.yellow) { passwordField.setBackground(Color.white); setPassword(passwordField.getText()); } XMLControlElement control = getCurrentControl(); if(control==null) { return null; } if(control.getObjectClass()==Cryptic.class) { control = decrypt(control); } if(control.write(fileName)==null) { return null; } this.fileName = fileName; refreshGUI(); return fileName; }
Example 3
Source File: CalendarPanelAssortmentTest.java From LGoodDatePicker with MIT License | 6 votes |
/** * getHighlightInformationOrNull, Implement this function to indicate if a date should be * highlighted, and what highlighting details should be used for the highlighted date. * * If a date should be highlighted, then return an instance of HighlightInformation. If the * date should not be highlighted, then return null. * * You may (optionally) fill out the fields in the HighlightInformation class to give any * particular highlighted day a unique foreground color, background color, or tooltip text. * If the color fields are null, then the default highlighting colors will be used. If the * tooltip field is null (or empty), then no tooltip will be displayed. * * Dates that are passed to this function will never be null. */ @Override public HighlightInformation getHighlightInformationOrNull(LocalDate date) { // Highlight a chosen date, with a tooltip and a red background color. if (date.getDayOfMonth() == 25) { return new HighlightInformation(Color.red, null, "It's the 25th!"); } // Highlight all Saturdays with a unique background and foreground color. if (date.getDayOfWeek() == DayOfWeek.SATURDAY) { return new HighlightInformation(Color.orange, Color.yellow, "It's Saturday!"); } // Highlight all Sundays with default colors and a tooltip. if (date.getDayOfWeek() == DayOfWeek.SUNDAY) { return new HighlightInformation(null, null, "It's Sunday!"); } // All other days should not be highlighted. return null; }
Example 4
Source File: RenderTests.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private Color[] makeGradientColors(int numColors, boolean alpha) { Color[] colors = new Color[] {Color.red, Color.blue, Color.green, Color.yellow}; Color[] ret = new Color[numColors]; for (int i = 0; i < numColors; i++) { ret[i] = alpha ? makeAlphaColor(colors[i], 32) : colors[i]; } return ret; }
Example 5
Source File: BlockBorderTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); BlockBorder b2 = (BlockBorder) TestUtilities.serialised(b1); assertEquals(b1, b2); }
Example 6
Source File: ControlTextField.java From osp with GNU General Public License v3.0 | 5 votes |
private void decideColors(Color aColor) { if(aColor==null) { return; } defaultColor = aColor; if(defaultColor.equals(Color.yellow)) { editingColor = Color.orange; } else { editingColor = Color.yellow; } }
Example 7
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns a theme called "Darkness". In this theme, the * charts have a black background. * * @return The "Darkness" theme. */ public static ChartTheme createDarknessTheme() { StandardChartTheme theme = new StandardChartTheme("Darkness"); theme.titlePaint = Color.white; theme.subtitlePaint = Color.white; theme.legendBackgroundPaint = Color.black; theme.legendItemPaint = Color.white; theme.chartBackgroundPaint = Color.black; theme.plotBackgroundPaint = Color.black; theme.plotOutlinePaint = Color.yellow; theme.baselinePaint = Color.white; theme.crosshairPaint = Color.red; theme.labelLinkPaint = Color.lightGray; theme.tickLabelPaint = Color.white; theme.axisLabelPaint = Color.white; theme.shadowPaint = Color.darkGray; theme.itemLabelPaint = Color.white; theme.drawingSupplier = new DefaultDrawingSupplier( new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587")}, new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC")}, new Stroke[] {new BasicStroke(2.0f)}, new Stroke[] {new BasicStroke(0.5f)}, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); theme.wallPaint = Color.darkGray; theme.errorIndicatorPaint = Color.lightGray; theme.gridBandPaint = new Color(255, 255, 255, 20); theme.gridBandAlternatePaint = new Color(255, 255, 255, 40); theme.shadowGenerator = null; return theme; }
Example 8
Source File: RenderTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private Color[] makeGradientColors(int numColors, boolean alpha) { Color[] colors = new Color[] {Color.red, Color.blue, Color.green, Color.yellow}; Color[] ret = new Color[numColors]; for (int i = 0; i < numColors; i++) { ret[i] = alpha ? makeAlphaColor(colors[i], 32) : colors[i]; } return ret; }
Example 9
Source File: StandardChartTheme.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns a theme called "Darkness". In this theme, the * charts have a black background. * * @return The "Darkness" theme. */ public static ChartTheme createDarknessTheme() { StandardChartTheme theme = new StandardChartTheme("Darkness"); theme.titlePaint = Color.white; theme.subtitlePaint = Color.white; theme.legendBackgroundPaint = Color.black; theme.legendItemPaint = Color.white; theme.chartBackgroundPaint = Color.black; theme.plotBackgroundPaint = Color.black; theme.plotOutlinePaint = Color.yellow; theme.baselinePaint = Color.white; theme.crosshairPaint = Color.red; theme.labelLinkPaint = Color.lightGray; theme.tickLabelPaint = Color.white; theme.axisLabelPaint = Color.white; theme.shadowPaint = Color.darkGray; theme.itemLabelPaint = Color.white; theme.drawingSupplier = new DefaultDrawingSupplier( new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587")}, new Paint[] {Color.decode("0xFFFF00"), Color.decode("0x0036CC")}, new Stroke[] {new BasicStroke(2.0f)}, new Stroke[] {new BasicStroke(0.5f)}, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); theme.wallPaint = Color.darkGray; theme.errorIndicatorPaint = Color.lightGray; theme.gridBandPaint = new Color(255, 255, 255, 20); theme.gridBandAlternatePaint = new Color(255, 255, 255, 40); theme.shadowGenerator = null; return theme; }
Example 10
Source File: LineBorderTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { LineBorder b1 = new LineBorder(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow), new BasicStroke(1.0f), new RectangleInsets(1.0, 1.0, 1.0, 1.0)); LineBorder b2 = (LineBorder) TestUtilities.serialised(b1); assertEquals(b1, b2); }
Example 11
Source File: RingPlotTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { RingPlot p1 = new RingPlot(null); GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.red); p1.setSeparatorPaint(gp); RingPlot p2 = (RingPlot) TestUtilities.serialised(p1); assertEquals(p1, p2); }
Example 12
Source File: RGBAnimationTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** Creates a new instance of RGBAnimationTest */ public RGBAnimationTest() { frames = new Frame[4]; frames[0] = new Frame(new Color[] {Color.red, Color.green}); frames[1] = new Frame(new Color[] {Color.green, Color.cyan}); frames[2] = new Frame(new Color[] {Color.cyan, Color.yellow}); frames[3] = new Frame(new Color[] {Color.yellow, Color.red}); writer = ImageIO.getImageWritersByFormatName(format).next(); reader = ImageIO.getImageReadersByFormatName(format).next(); }
Example 13
Source File: BlockBorderTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); BlockBorder b2 = (BlockBorder) TestUtilities.serialised(b1); assertEquals(b1, b2); }
Example 14
Source File: UnitOverview.java From megamek with GNU General Public License v2.0 | 5 votes |
private Color getStatusBarColor(double percentRemaining) { if (percentRemaining <= .25) { return Color.red; } else if (percentRemaining <= .75) { return Color.yellow; } else { return new Color(16, 196, 16); } }
Example 15
Source File: LookupPaintScaleTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization() { LookupPaintScale g1 = new LookupPaintScale(); LookupPaintScale g2 = (LookupPaintScale) TestUtilities.serialised(g1); assertEquals(g1, g2); g1 = new LookupPaintScale(1.0, 2.0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); g1.add(1.5, new GradientPaint(1.1f, 2.2f, Color.red, 3.3f, 4.4f, Color.blue)); g2 = (LookupPaintScale) TestUtilities.serialised(g1); assertEquals(g1, g2); }
Example 16
Source File: XYDifferenceRendererTest.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { XYDifferenceRenderer r1 = new XYDifferenceRenderer( Color.red, Color.blue, false); XYDifferenceRenderer r2 = new XYDifferenceRenderer( Color.red, Color.blue, false); assertEquals(r1, r2); // positive paint r1.setPositivePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); assertFalse(r1.equals(r2)); r2.setPositivePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); assertTrue(r1.equals(r2)); // negative paint r1.setNegativePaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.blue)); assertFalse(r1.equals(r2)); r2.setNegativePaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.blue)); assertTrue(r1.equals(r2)); // shapesVisible r1 = new XYDifferenceRenderer(Color.green, Color.yellow, true); assertFalse(r1.equals(r2)); r2 = new XYDifferenceRenderer(Color.green, Color.yellow, true); assertTrue(r1.equals(r2)); // legendLine r1.setLegendLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); assertFalse(r1.equals(r2)); r2.setLegendLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); assertTrue(r1.equals(r2)); // roundXCoordinates r1.setRoundXCoordinates(true); assertFalse(r1.equals(r2)); r2.setRoundXCoordinates(true); assertTrue(r1.equals(r2)); assertFalse(r1.equals(null)); }
Example 17
Source File: ConstantParser.java From osp with GNU General Public License v3.0 | 4 votes |
static public Value colorConstant(String _value) { if(_value.indexOf(',')>=0) { // format is red,green,blue try { StringTokenizer t = new StringTokenizer(_value, ":,"); //$NON-NLS-1$ int r = Integer.parseInt(t.nextToken()); int g = Integer.parseInt(t.nextToken()); int b = Integer.parseInt(t.nextToken()); int alpha; if(t.hasMoreTokens()) { alpha = Integer.parseInt(t.nextToken()); } else { alpha = 255; } if(r<0) { r = 0; } else if(r>255) { r = 255; } if(g<0) { g = 0; } else if(g>255) { g = 255; } if(b<0) { b = 0; } else if(b>255) { b = 255; } if(alpha<0) { alpha = 0; } else if(alpha>255) { alpha = 255; } return new ObjectValue(new Color(r, g, b, alpha)); } catch(Exception exc) { exc.printStackTrace(); return null; } } if(_value.equals("null")||_value.equals("none")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(NULL_COLOR); } if(_value.equals("black")||_value.equals("Color.black")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.black); } if(_value.equals("blue")||_value.equals("Color.blue")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.blue); } if(_value.equals("cyan")||_value.equals("Color.cyan")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.cyan); } if(_value.equals("darkGray")||_value.equals("Color.darkGray")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.darkGray); } if(_value.equals("gray")||_value.equals("Color.gray")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.gray); } if(_value.equals("green")||_value.equals("Color.green")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.green); } if(_value.equals("lightGray")||_value.equals("Color.lightGray")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.lightGray); } if(_value.equals("magenta")||_value.equals("Color.magenta")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.magenta); } if(_value.equals("orange")||_value.equals("Color.orange")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.orange); } if(_value.equals("pink")||_value.equals("Color.pink")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.pink); } if(_value.equals("red")||_value.equals("Color.red")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.red); } if(_value.equals("white")||_value.equals("Color.white")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.white); } if(_value.equals("yellow")||_value.equals("Color.yellow")) { //$NON-NLS-1$ //$NON-NLS-2$ return new ObjectValue(Color.yellow); } return null; // Not a valid constant }
Example 18
Source File: XYPolygonAnnotationTest.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ @Test public void testEquals() { Stroke stroke1 = new BasicStroke(2.0f); Stroke stroke2 = new BasicStroke(2.5f); XYPolygonAnnotation a1 = new XYPolygonAnnotation(new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue); XYPolygonAnnotation a2 = new XYPolygonAnnotation(new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue); assertTrue(a1.equals(a2)); assertTrue(a2.equals(a1)); a1 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue); assertFalse(a1.equals(a2)); a2 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue); assertTrue(a1.equals(a2)); a1 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke2, Color.red, Color.blue); assertFalse(a1.equals(a2)); a2 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke2, Color.red, Color.blue); assertTrue(a1.equals(a2)); GradientPaint gp1 = new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.white); GradientPaint gp2 = new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.white); a1 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke2, gp1, Color.blue); assertFalse(a1.equals(a2)); a2 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke2, gp2, Color.blue); assertTrue(a1.equals(a2)); GradientPaint gp3 = new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.white); GradientPaint gp4 = new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.white); a1 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke2, gp1, gp3); assertFalse(a1.equals(a2)); a2 = new XYPolygonAnnotation(new double[] {99.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke2, gp2, gp4); assertTrue(a1.equals(a2)); }
Example 19
Source File: XYDifferenceRendererTest.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { XYDifferenceRenderer r1 = new XYDifferenceRenderer( Color.red, Color.blue, false); XYDifferenceRenderer r2 = new XYDifferenceRenderer( Color.red, Color.blue, false); assertEquals(r1, r2); // positive paint r1.setPositivePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); assertFalse(r1.equals(r2)); r2.setPositivePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); assertTrue(r1.equals(r2)); // negative paint r1.setNegativePaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.blue)); assertFalse(r1.equals(r2)); r2.setNegativePaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.blue)); assertTrue(r1.equals(r2)); // shapesVisible r1 = new XYDifferenceRenderer(Color.green, Color.yellow, true); assertFalse(r1.equals(r2)); r2 = new XYDifferenceRenderer(Color.green, Color.yellow, true); assertTrue(r1.equals(r2)); // legendLine r1.setLegendLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); assertFalse(r1.equals(r2)); r2.setLegendLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); assertTrue(r1.equals(r2)); // roundXCoordinates r1.setRoundXCoordinates(true); assertFalse(r1.equals(r2)); r2.setRoundXCoordinates(true); assertTrue(r1.equals(r2)); assertFalse(r1.equals(null)); }
Example 20
Source File: MeterInterval.java From ccu-historian with GNU General Public License v3.0 | 2 votes |
/** * Creates a new interval. * * @param label the label (<code>null</code> not permitted). * @param range the range (<code>null</code> not permitted). */ public MeterInterval(String label, Range range) { this(label, range, Color.yellow, new BasicStroke(2.0f), null); }