List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:Main.java
public static Color toColor(Node n) { if (!n.getNodeName().equals("color")) { throw new IllegalArgumentException(n.getNodeName()); }/* w ww . ja v a2 s. c o m*/ NamedNodeMap map = n.getAttributes(); String s = map.getNamedItem("name").getNodeValue(); if (s.equals("white")) { return Color.WHITE; } else if (s.equals("green")) { return Color.GREEN; } else if (s.equals("pink")) { return Color.PINK; } else if (s.equals("cyan")) { return Color.CYAN; } else if (s.equals("yellow")) { return Color.YELLOW; } else { return Color.WHITE; } }
From source file:net.sf.maltcms.chromaui.charts.GradientPaintScale.java
/** * * @param args/*from ww w. ja va 2 s .com*/ */ public static void main(String[] args) { double[] st = ImageTools.createSampleTable(256); Logger.getLogger(GradientPaintScale.class.getName()).info(Arrays.toString(st)); double min = 564.648; double max = 24334.234; GradientPaintScale gps = new GradientPaintScale(st, min, max, new Color[] { Color.BLACK, Color.RED, Color.orange, Color.yellow, Color.white }); double val = min; double incr = (max - min) / (st.length - 1); Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Increment: {0}", incr); for (int i = 0; i < st.length; i++) { Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Value: {0}", val); gps.getPaint(val); val += incr; } Logger.getLogger(GradientPaintScale.class.getName()).info("Printing min and max values"); Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Min: {0} gps min: {1}", new Object[] { min, gps.getPaint(min) }); Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Max: {0} gps max: {1}", new Object[] { max, gps.getPaint(max) }); JList jl = new JList(); DefaultListModel dlm = new DefaultListModel(); jl.setModel(dlm); jl.setCellRenderer(new ListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof JLabel) { // Border b = // BorderFactory.createCompoundBorder(BorderFactory // .createEmptyBorder(0, 0, 5, 0), BorderFactory // .createLineBorder(Color.BLACK, 1)); // ((JLabel) value).setBorder(b); return (Component) value; } return new JLabel(value.toString()); } }); JFrame jf = new JFrame(); jf.add(new JScrollPane(jl)); jf.setVisible(true); jf.setSize(200, 400); for (int alpha = -10; alpha <= 10; alpha++) { for (int beta = 1; beta <= 20; beta++) { gps.setAlphaBeta(alpha, beta); // System.out.println(Arrays.toString(gps.st)); // System.out.println(Arrays.toString(gps.sampleTable)); BufferedImage bi = gps.getLookupImage(); ImageIcon ii = new ImageIcon(bi); dlm.addElement(new JLabel(ii)); } } }
From source file:org.jfree.graphics2d.demo.ImageTest.java
private static void drawGradientPaintTest(Graphics2D g2) { g2.setPaint(new GradientPaint(10f, 10f, Color.RED, 10f, 60f, Color.YELLOW)); g2.fillRect(10, 10, 50, 50);//from w ww. j a va 2s . co m g2.setPaint(Color.BLUE); g2.fillRect(60, 10, 50, 50); }
From source file:GradientsDirection.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 25, Color.yellow, 20, 2, Color.black, true); g2d.setPaint(gp1);// w ww.j a v a 2 s. com g2d.fillRect(20, 80, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); g2d.setPaint(gp1);/* w w w. ja v a 2 s . c o m*/ g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow); g2d.setPaint(gp1);// w w w . java 2s.c o m g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getColor2()); g2d.setPaint(gp1);/*from w w w . ja v a 2 s . co m*/ g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getTransparency()); g2d.setPaint(gp1);//from w w w .j a v a 2 s .c om g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getColor1()); g2d.setPaint(gp1);// w w w .j av a 2s . c om g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getPoint2()); g2d.setPaint(gp1);//from w w w . j a v a 2 s . c o m g2d.fillRect(20, 20, 300, 40); }