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:EvenOddRenderer.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);//from www.ja v a2 s . c o m Color foreground, background; if (isSelected) { foreground = Color.YELLOW; background = Color.GREEN; } else { if (row % 2 == 0) { foreground = Color.BLUE; background = Color.WHITE; } else { foreground = Color.WHITE; background = Color.BLUE; } } renderer.setForeground(foreground); renderer.setBackground(background); return renderer; }
From source file:org.jfree.chart.demo.JDBCPieChartDemo.java
public JDBCPieChartDemo(String s) { super(s);//from w w w. j a va 2s. c o m PieDataset piedataset = readData(); JFreeChart jfreechart = ChartFactory.createPieChart("JDBC Pie Chart Demo", piedataset, true, true, false); jfreechart.setBackgroundPaint(Color.yellow); PiePlot pieplot = (PiePlot) jfreechart.getPlot(); pieplot.setNoDataMessage("No data available"); ChartPanel chartpanel = new ChartPanel(jfreechart); setContentPane(chartpanel); }
From source file:TimerChangeButtonBackground.java
public TimerChangeButtonBackground() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().add(button, "Center"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { timer.stop();//from ww w.j a v a 2 s .c om button.setBackground(Color.red); } }); timer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { button.setBackground(flag ? Color.green : Color.yellow); flag = !flag; repaint(); } }); timer.start(); pack(); setVisible(true); }
From source file:MainClass.java
public void init() { i = getImage(getDocumentBase(), "rosey.jpg"); j = createImage(new FilteredImageSource(i.getSource(), new DynamicFilter(250, 5, Color.yellow))); }
From source file:MainClass.java
public void paint(Graphics g) { BufferedImage bim;// w w w.j a va2 s .c om TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }
From source file:Main.java
public void paint(Graphics g) { BufferedImage bim;// w w w . java2 s. c o m TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); System.out.println(tp.getAnchorRect()); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }
From source file:Main.java
public void paint(Graphics g) { BufferedImage bim;/*from w ww . java 2s . c om*/ TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); System.out.println(tp.getImage()); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }
From source file:Main.java
public void paint(Graphics g) { BufferedImage bim;// www .j a va2s . c om TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); System.out.println(tp.getTransparency()); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }
From source file:Main.java
public void paint(Graphics g) { BufferedImage bim;//ww w .j ava 2 s . com TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); tp.createContext(ColorModel.getRGBdefault(), new Rectangle(10, 10, 20, 20), null, null, null); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }
From source file:Main.java
public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); Color color = getBackground(); if (source == yellowButton) color = Color.yellow; else if (source == blueButton) color = Color.blue;/*from w w w .j ava2 s . co m*/ else if (source == redButton) color = Color.red; setBackground(color); repaint(); }