List of usage examples for java.awt Color green
Color green
To view the source code for java.awt Color green.
Click Source Link
From source file:com.github.errantlinguist.latticevisualiser.StatePaintTransformer.java
/** * /*from w w w.j a v a 2 s .c om*/ * @return A map of {@link StateType StateTypes} to {@link Color Colors} for * deriving the colour used to draw the vertex representing a state. */ static final ImmutableMap<StateType, Color> makeColorMap() { final ImmutableMap.Builder<StateType, Color> builder = ImmutableMap.builder(); builder.put(StateType.INITIAL, Color.CYAN); builder.put(StateType.FINAL, Color.MAGENTA); builder.put(StateType.GOAL, Color.RED); builder.put(StateType.INTERMEDIATE, Color.GREEN); return builder.build(); }
From source file:org.jfree.chart.demo.XYBlockChartDemo2.java
private static JFreeChart createChart(XYZDataset xyzdataset) { DateAxis dateaxis = new DateAxis("Date"); dateaxis.setLowerMargin(0.0D);//from ww w .jav a2 s . c om dateaxis.setUpperMargin(0.0D); dateaxis.setInverted(true); NumberAxis numberaxis = new NumberAxis("Hour"); numberaxis.setUpperMargin(0.0D); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYBlockRenderer xyblockrenderer = new XYBlockRenderer(); xyblockrenderer.setBlockWidth(86400000D); xyblockrenderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT); LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 4.5D, Color.white); lookuppaintscale.add(0.5D, Color.red); lookuppaintscale.add(1.5D, Color.green); lookuppaintscale.add(2.5D, Color.blue); lookuppaintscale.add(3.5D, Color.yellow); xyblockrenderer.setPaintScale(lookuppaintscale); XYPlot xyplot = new XYPlot(xyzdataset, dateaxis, numberaxis, xyblockrenderer); xyplot.setOrientation(PlotOrientation.HORIZONTAL); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo2", xyplot); jfreechart.removeLegend(); jfreechart.setBackgroundPaint(Color.white); SymbolAxis symbolaxis = new SymbolAxis(null, new String[] { "", "Unavailable", "Free", "Group 1", "Group 2" }); symbolaxis.setRange(0.5D, 4.5D); symbolaxis.setPlot(new PiePlot()); symbolaxis.setGridBandsVisible(false); PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis); paintscalelegend.setMargin(new RectangleInsets(3D, 10D, 3D, 10D)); paintscalelegend.setPosition(RectangleEdge.BOTTOM); paintscalelegend.setAxisOffset(5D); jfreechart.addSubtitle(paintscalelegend); return jfreechart; }
From source file:UserInterface.FarmerRole.ThermometerDemo.java
public ThermometerDemo(double value, String type) { this.setLayout(new GridLayout()); DefaultValueDataset dataset = new DefaultValueDataset(value); if (type.equals("high")) { ThermometerPlot plot = new ThermometerPlot(dataset); plot.setSubrangePaint(0, Color.green.darker()); plot.setSubrangePaint(1, Color.ORANGE); plot.setSubrangePaint(2, Color.RED.darker()); plot.setSubrangeInfo(0, 10, 28, 30, 60); JFreeChart chart = new JFreeChart("Cold Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true); this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true)); } else if (type.equals("medium")) { ThermometerPlot plot = new ThermometerPlot(dataset); plot.setSubrangePaint(0, Color.green.darker()); plot.setSubrangePaint(1, Color.ORANGE); plot.setSubrangePaint(2, Color.RED.darker()); plot.setSubrangeInfo(0, 12, 14, 30, 60); JFreeChart chart = new JFreeChart("Medium Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true); this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true)); } else {/* ww w. ja v a 2 s .c om*/ ThermometerPlot plot = new ThermometerPlot(dataset); plot.setSubrangePaint(0, Color.green.darker()); plot.setSubrangePaint(1, Color.YELLOW); plot.setSubrangePaint(2, Color.RED.darker()); plot.setSubrangeInfo(0, 20, 35, 46, 60); JFreeChart chart = new JFreeChart("Warm Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true); this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true)); } }
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);/*from ww w. j a v a 2 s. com*/ dateaxis.setUpperMargin(0.0D); xyplot.setDomainAxis(dateaxis); xyplot.setForegroundAlpha(0.5F); return jfreechart; }
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;//from ww w . j av a 2s.co m if (c.isEnabled()) { boolean pressed = false; if (c instanceof AbstractButton) { ButtonModel model = ((AbstractButton) c).getModel(); pressed = model.isPressed(); } if (pressed) { horizontalColor = Color.RED; } else { horizontalColor = Color.GREEN; } } else { horizontalColor = Color.LIGHT_GRAY; } g.setColor(horizontalColor); g.fillRect(0, 0, width, insets.top); }
From source file:ClipBetweenRectangleEllipse2D.java
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Ellipse2D e = new Ellipse2D.Float(w / 4.0f, h / 4.0f, w / 2.0f, h / 2.0f); g2.setClip(e);//from ww w .j a v a2 s .c o m g2.setColor(Color.red); g2.fillRect(0, 0, w, h); Rectangle r = new Rectangle(w / 2, h / 2, w / 2, h / 2); g2.clip(r); g2.setColor(Color.green); g2.fillRect(0, 0, w, h); }
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;/*from w w w .j av a 2 s. c o m*/ 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:Main.java
public Main() { for (int i = 0; i < panels.length; i++) { final String[] labels = new String[] { "0", "1" }; final Random rand = new Random(); int index = rand.nextInt(labels.length); String randomTitle = labels[index]; final JLabel label = new JLabel(randomTitle, JLabel.CENTER); Timer lblt = new Timer(00, new ActionListener() { @Override// w w w.j a va2 s.com public void actionPerformed(ActionEvent ae) { label.setText(labels[rand.nextInt(labels.length)]); } }); lblt.setRepeats(true); lblt.start(); label.setForeground(Color.green); label.setVerticalAlignment(JLabel.CENTER); panels[i] = new JPanel(); panels[i].setBackground(Color.BLACK); panels[i].add(label); frame.getContentPane().add(panels[i]); } frame.setLayout(new GridLayout(grid, grid)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); frame.setVisible(true); ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < panels.length; i++) { Color mix = new Color(255, 255, 255); Random random = new Random(); int r = random.nextInt(255); int g = random.nextInt(255); int b = random.nextInt(255); if (mix != null) { r = (r + mix.getRed()) / 2; g = (g + mix.getGreen()) / 2; b = (b + mix.getBlue()) / 2; } Color color = new Color(r, g, b); panels[i].setBackground(color); } } }; t = new Timer(00, action); t.setRepeats(true); t.start(); }
From source file:Main.java
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(Color.RED);/*ww w . j av a 2 s . c o m*/ g2d.fill(poly); g2d.setColor(Color.GREEN); g2d.translate(50, 100); g2d.fill(triangleShape); g2d.dispose(); }
From source file:AppPackage.humidity.java
public humidity() { try {/*from www. j ava 2 s . com*/ JFrame window = new JFrame(); window.setSize(1000, 615); window.setBackground(Color.blue.darker()); double value = 45; Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) ((dimension.getWidth() - window.getWidth()) / 2); int y = (int) ((dimension.getHeight() - window.getHeight()) / 2); window.setLocation(x, y); DefaultValueDataset dataset = new DefaultValueDataset(value); ThermometerPlot thermometerplot = new ThermometerPlot(dataset); thermometerplot.setSubrangePaint(0, Color.green.darker()); thermometerplot.setSubrangePaint(1, Color.orange); thermometerplot.setSubrangePaint(2, Color.red); JFreeChart jfreechart = new JFreeChart("Humidity readings", JFreeChart.DEFAULT_TITLE_FONT, thermometerplot, true); thermometerplot.setInsets(new RectangleInsets(5D, 5D, 5D, 5D)); thermometerplot.setPadding(new RectangleInsets(10D, 10D, 10D, 10D)); thermometerplot.setThermometerStroke(new BasicStroke(2.0F)); thermometerplot.setThermometerPaint(Color.BLUE); thermometerplot.setUnits(0); thermometerplot.setGap(3); window.add(new ChartPanel(jfreechart), BorderLayout.CENTER); window.setVisible(true); } catch (Exception e) { System.out.print("Chart exception:" + e); } initComponents(); }