List of usage examples for java.awt Color RED
Color RED
To view the source code for java.awt Color RED.
Click Source Link
From source file:com.aw.swing.mvp.grid.RowColorBkgChanger.java
private Color getColor(Object row) { if (row == lastRow) { return lastColor; }/* www . j a v a 2 s . com*/ Color color = Color.WHITE; if (condition.test(row)) { color = Color.RED; } lastColor = color; lastRow = row; return color; }
From source file:common.utility.ChartHelper.java
public static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBarChart3D("Quantity Of Citizens Of Each Area", // chart title "(Include unactived people)", // domain axis label "Quantity", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );/*from w w w. j a va 2 s . com*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.yellow); // Set the background colour of the chart chart.getTitle().setPaint(Color.blue); // Adjust the colour of the title CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); // Modify the plot background p.setRangeGridlinePaint(Color.red); return chart; }
From source file:MyCheckBoxUI.java
public void installUI(JComponent c) { super.installUI(c); c.setBackground(Color.red); c.addMouseListener(this); }
From source file:DoubleBufferWithBufferedImage.java
public void paint(Graphics g) { Graphics screengc = null;/* w w w . ja v a 2 s .c o m*/ screengc = g; g = buffer.getGraphics(); g.setColor(Color.blue); g.fillRect(0, 0, w, h); g.setColor(Color.red); for (int i = 0; i < w; i += gap) g.drawLine(i, 0, w - i, h); for (int i = 0; i < h; i += gap) g.drawLine(0, i, w, h - i); screengc.drawImage(buffer, 0, 0, null); }
From source file:RedGreenBorder.java
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Insets insets = getBorderInsets(c); Color horizontalColor;/* ww w .ja va 2 s . c om*/ Color verticalColor; if (c.isEnabled()) { boolean pressed = false; if (c instanceof AbstractButton) { ButtonModel model = ((AbstractButton) c).getModel(); pressed = model.isPressed(); } if (pressed) { horizontalColor = Color.red; verticalColor = Color.green; } else { horizontalColor = Color.green; verticalColor = Color.red; } } else { horizontalColor = Color.lightGray; verticalColor = Color.lightGray; } g.setColor(horizontalColor); g.translate(x, y); // top g.fillRect(0, 0, width, insets.top); // bottom g.fillRect(0, height - insets.bottom, width, insets.bottom); g.setColor(verticalColor); // left g.fillRect(0, insets.top, insets.left, height - insets.top - insets.bottom); g.fillRect(width - insets.right, insets.top, insets.right, height - insets.top - insets.bottom); g.translate(-x, -y); }
From source file:StringGraidentPaint.java
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; int w = getSize().width; int h = getSize().height; g2D.setFont(font);//from ww w. jav a2 s . c o m GradientPaint gp = new GradientPaint(30.0f, 50.0f, Color.blue, fontMetrics.stringWidth("Hello!"), fontMetrics.getHeight(), Color.red); g2D.setPaint(gp); g2D.drawString("Hello!", 20, 200); }
From source file:org.jfree.chart.demo.DifferenceChartDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Difference Chart Demo 1", "Time", "Value", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYDifferenceRenderer xydifferencerenderer = new XYDifferenceRenderer(Color.green, Color.red, false); xydifferencerenderer.setRoundXCoordinates(true); xyplot.setDomainCrosshairLockedOnData(true); xyplot.setRangeCrosshairLockedOnData(true); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); xyplot.setRenderer(xydifferencerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); DateAxis dateaxis = new DateAxis("Time"); dateaxis.setLowerMargin(0.0D);/* w w w . j av a 2s . c om*/ dateaxis.setUpperMargin(0.0D); xyplot.setDomainAxis(dateaxis); xyplot.setForegroundAlpha(0.5F); return jfreechart; }
From source file:Main.java
private FocusListener getFocusListener() { return new FocusAdapter() { @Override//from w ww.java2s . c om public void focusGained(FocusEvent arg0) { super.focusGained(arg0); box.setBackground(Color.BLUE); validate(); } @Override public void focusLost(FocusEvent arg0) { super.focusLost(arg0); box.setBackground(Color.red); validate(); } }; }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape ball = new Ellipse2D.Float(i++, i++, 5, 5); g2.setColor(Color.RED); g2.fill(ball);/*w w w . j a v a 2s .c om*/ }
From source file:Main.java
public TestPane(int width, int height) { pWidth = width; pHeight = height; setBorder(new LineBorder(Color.RED)); }