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:org.esa.beam.smos.visat.GridPointBtDataFlagmatrixToolView.java
@Override protected JComponent createGridPointComponent() { dataset = new DefaultXYZDataset(); final NumberAxis xAxis = new NumberAxis("Record #"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setAutoRangeIncludesZero(false); xAxis.setLowerMargin(0.0);/* w w w. j a va 2s. c om*/ xAxis.setUpperMargin(0.0); flagNames = createFlagNames(Dddb.getInstance().getFlagDescriptors(DEFAULT_FLAG_DESCRIPTOR_IDENTIFIER)); final NumberAxis yAxis = createRangeAxis(flagNames); final LookupPaintScale paintScale = new LookupPaintScale(0.0, 4.0, Color.WHITE); paintScale.add(0.0, Color.BLACK); paintScale.add(1.0, Color.RED); paintScale.add(2.0, Color.GREEN); paintScale.add(3.0, Color.BLUE); paintScale.add(4.0, Color.YELLOW); final XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setPaintScale(paintScale); renderer.setBaseToolTipGenerator(new FlagToolTipGenerator(flagNames)); plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.WHITE); plot.setForegroundAlpha(0.5f); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); plot.setNoDataMessage("No data"); chart = new JFreeChart(null, plot); chart.removeLegend(); chartPanel = new ChartPanel(chart); return chartPanel; }
From source file:net.sf.jsfcomp.chartcreator.utils.ChartUtils.java
public static Color getColor(String color) { // HTML colors (#FFFFFF format) if (color.startsWith("#")) { return new Color(Integer.parseInt(color.substring(1), 16)); } else {/*from w w w . j a va2 s.c om*/ // Colors by name if (color.equalsIgnoreCase("black")) return Color.black; if (color.equalsIgnoreCase("gray")) return Color.gray; if (color.equalsIgnoreCase("yellow")) return Color.yellow; if (color.equalsIgnoreCase("green")) return Color.green; if (color.equalsIgnoreCase("blue")) return Color.blue; if (color.equalsIgnoreCase("red")) return Color.red; if (color.equalsIgnoreCase("orange")) return Color.orange; if (color.equalsIgnoreCase("cyan")) return Color.cyan; if (color.equalsIgnoreCase("magenta")) return Color.magenta; if (color.equalsIgnoreCase("darkgray")) return Color.darkGray; if (color.equalsIgnoreCase("lightgray")) return Color.lightGray; if (color.equalsIgnoreCase("pink")) return Color.pink; if (color.equalsIgnoreCase("white")) return Color.white; throw new RuntimeException("Unsupported chart color:" + color); } }
From source file:es.uvigo.ei.sing.adops.views.TextFileViewer.java
public TextFileViewer(final File file) { super(new BorderLayout()); this.file = file; // TEXT AREA/*from w ww . j a v a 2 s . com*/ this.textArea = new JTextArea(TextFileViewer.loadFile(file)); this.textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, this.textArea.getFont().getSize())); this.textArea.setLineWrap(true); this.textArea.setWrapStyleWord(true); this.textArea.setEditable(false); this.highlightPatiner = new DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW); // OPTIONS PANEL final JPanel panelOptions = new JPanel(new BorderLayout()); final JPanel panelOptionsEast = new JPanel(new FlowLayout()); final JPanel panelOptionsWest = new JPanel(new FlowLayout()); final JCheckBox chkLineWrap = new JCheckBox("Line wrap", true); final JButton btnChangeFont = new JButton("Change Font"); final JLabel lblSearch = new JLabel("Search"); this.txtSearch = new JTextField(); this.chkRegularExpression = new JCheckBox("Reg. exp.", true); final JButton btnSearch = new JButton("Search"); final JButton btnClear = new JButton("Clear"); this.txtSearch.setColumns(12); // this.txtSearch.setOpaque(true); panelOptionsEast.add(btnChangeFont); panelOptionsEast.add(chkLineWrap); panelOptionsWest.add(lblSearch); panelOptionsWest.add(this.txtSearch); panelOptionsWest.add(this.chkRegularExpression); panelOptionsWest.add(btnSearch); panelOptionsWest.add(btnClear); if (FastaUtils.isFasta(file)) { panelOptionsWest.add(new JSeparator()); final JButton btnExport = new JButton("Export..."); panelOptionsWest.add(btnExport); btnExport.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { new ExportDialog(file).setVisible(true); } catch (Exception e1) { JOptionPane.showMessageDialog(Workbench.getInstance().getMainFrame(), "Error reading fasta file: " + e1.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } } }); } panelOptions.add(panelOptionsWest, BorderLayout.WEST); panelOptions.add(panelOptionsEast, BorderLayout.EAST); this.fontChooser = new JFontChooser(); this.add(new JScrollPane(this.textArea), BorderLayout.CENTER); this.add(panelOptions, BorderLayout.NORTH); chkLineWrap.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textArea.setLineWrap(chkLineWrap.isSelected()); } }); btnChangeFont.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changeFont(); } }); this.textArea.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { TextFileViewer.this.wasModified = true; } @Override public void insertUpdate(DocumentEvent e) { TextFileViewer.this.wasModified = true; } @Override public void changedUpdate(DocumentEvent e) { TextFileViewer.this.wasModified = true; } }); this.textArea.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (TextFileViewer.this.wasModified) { try { FileUtils.write(TextFileViewer.this.file, TextFileViewer.this.textArea.getText()); TextFileViewer.this.wasModified = false; } catch (IOException e1) { e1.printStackTrace(); } } } }); final ActionListener alSearch = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateSearch(); } }; txtSearch.addActionListener(alSearch); btnSearch.addActionListener(alSearch); btnClear.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clearSearch(); } }); }
From source file:org.osjava.reportrunner_plugins.renderers.jfreechart.creators.TexturedBarRenderer.java
public java.awt.Paint getSeriesPaint(int row) { BufferedImage bufferedImage = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB); Graphics2D big = bufferedImage.createGraphics(); TexturePaint texture = null;//from w w w. j a v a 2s. co m int rowNum = row + 1; int patNum = 13; int formula = rowNum - ((rowNum / patNum) * patNum); if (formula == 0) { big.setColor(Color.orange); big.fillRect(0, 0, 5, 5); big.fillRect(1, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 1) { big.setColor(Color.red); big.fillRect(0, 0, 5, 5); big.fillRect(1, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 2) { Color color = Color.blue; big.setColor(Color.white); big.fillRect(0, 0, 5, 5); big.setColor(color); big.fillRect(0, 1, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 3) { Color color = Color.yellow; big.setColor(Color.orange); big.fillRect(0, 0, 5, 5); big.setColor(color); big.fillRect(1, 1, 4, 4); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 4) { big.setColor(Color.green); big.fillRect(0, 0, 5, 5); big.fillRect(1, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 5) { big.setColor(Color.magenta); big.fillRect(0, 0, 5, 5); big.setColor(Color.pink); big.fillRect(0, 0, 4, 4); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 6) { float[] x = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f }; float[] y = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f }; GeneralPath path = new GeneralPath(); path.moveTo(x[0], y[0]); for (int j = 1; j < x.length; j++) { path.lineTo(x[j], y[j]); } big.setColor(new Color(226, 199, 252)); big.fillRect(0, 0, 5, 5); big.setColor(Color.blue); big.setStroke(new BasicStroke(1.0f)); big.draw(path); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 7) { big.setColor(Color.lightGray); big.fillRect(0, 0, 5, 5); big.setColor(Color.red); big.fillRect(1, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 8) { float[] x = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f }; float[] y = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f }; GeneralPath path = new GeneralPath(); path.moveTo(x[0], y[0]); for (int j = 1; j < x.length; j++) { path.lineTo(x[j], y[j]); } big.setColor(Color.blue); big.fillRect(0, 0, 5, 5); big.setColor(Color.cyan); big.setStroke(new BasicStroke(2.0f)); big.draw(path); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 9) { Color color = new Color(0xBBBBDD); big.setColor(color); big.fillRect(0, 0, 5, 5); big.setColor(new Color(199, 201, 230)); big.fillRect(1, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 10) { float[] x = { 1, 2, 3, 4, 5 }; float[] y = { 1, 2, 3, 4, 5 }; GeneralPath path = new GeneralPath(); path.moveTo(x[0], y[1]); path.lineTo(x[1], y[0]); path.moveTo(x[0], y[2]); path.lineTo(x[2], y[0]); path.moveTo(x[0], y[3]); path.lineTo(x[3], y[0]); path.moveTo(x[0], y[4]); path.lineTo(x[4], y[0]); big.setColor(Color.red); big.fillRect(0, 0, 5, 5); big.setColor(new Color(242, 242, 193)); big.setStroke(new BasicStroke(3.0f)); big.draw(path); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 11) { big.setColor(new Color(252, 169, 171)); big.fillOval(0, 0, 5, 6); big.setColor(new Color(252, 230, 230)); big.fillOval(0, 0, 3, 3); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } else if (formula == 12) { big.setColor(Color.green); big.fillRect(0, 0, 5, 5); big.setColor(new Color(20, 178, 38)); big.fillRect(2, 2, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); texture = new TexturePaint(bufferedImage, r); } return texture; }
From source file:com.orsonpdf.demo.PDFBarChartDemo1.java
/** * Creates a sample chart.//from ww w . ja va 2 s. com * * @param dataset a dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", dataset, PlotOrientation.VERTICAL, true, false, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(false); // customise the renderer... StatisticalBarRenderer renderer = new StatisticalBarRenderer(); renderer.setDrawBarOutline(false); renderer.setErrorIndicatorPaint(Color.black); renderer.setIncludeBaseInRange(false); plot.setRenderer(renderer); // ensure the current theme is applied to the renderer just added ChartUtilities.applyCurrentTheme(chart); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelPaint(Color.yellow); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); // set up gradient paints for series... GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); return chart; }
From source file:userInterface.MonitoringTeamRole.EnvironmentJPanel.java
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked // TODO add your handling code here: JFreeChart chart = createChart(createDataset()); chart.setBackgroundPaint(Color.YELLOW); chart.getTitle().setPaint(Color.red); ChartFrame frame = new ChartFrame("XYChart", chart); frame.setVisible(true);//from ww w . ja v a2 s . co m frame.setSize(450, 500); }
From source file:org.jfree.chart.demo.BubblyBubblesDemo2.java
/** * A demonstration application showing a bubble chart using matrix series. * * @param title the frame title.// www . j a va 2 s . co m */ public BubblyBubblesDemo2(final String title) { super(title); this.series = createInitialSeries(); final MatrixSeriesCollection dataset = new MatrixSeriesCollection(this.series); final JFreeChart chart = ChartFactory.createBubbleChart(TITLE, "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.yellow)); final XYPlot plot = chart.getXYPlot(); plot.setForegroundAlpha(0.5f); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setLowerBound(-0.5); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLowerBound(-0.5); final ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setVerticalZoom(true); // chartPanel.setHorizontalZoom(true); setContentPane(chartPanel); }
From source file:ancat.visualizers.UndirectedModelVisualizer.java
private void produce(String fileName) { _currentLayout.setSize(new Dimension(600, 600)); VisualizationImageServer<V, E> vv = new VisualizationImageServer<V, E>(_currentLayout, new Dimension(600, 600)); vv.setPreferredSize(new Dimension(600, 600)); // Setup up a new vertex to paint transformer... Transformer<V, Paint> vertexPaint = new Transformer<V, Paint>() { public Paint transform(V v) { //return Color.GREEN; ancat.common.Vertex vertex = (Vertex) v; if (vertex instanceof ancat.common.ExecutableFile) return Color.BLUE; if (vertex instanceof ancat.common.DynamicLibrary) return Color.YELLOW; if (vertex instanceof ancat.common.ConfigurationFile) return Color.ORANGE; if (vertex instanceof ancat.common.Unspecified) return Color.RED; return Color.darkGray; }//w ww . j ava 2 s . c o m }; // Set up a new stroke Transformer for the edges float dash[] = { 10.0f }; final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); Transformer<E, Stroke> edgeStrokeTransformer = new Transformer<E, Stroke>() { public Stroke transform(E s) { return edgeStroke; } }; Transformer<E, Font> edgeFontTransformer = new Transformer<E, Font>() { public Font transform(E e) { return new Font("Dialog", Font.PLAIN, 10); } }; Transformer<E, String> lblTransformer = new Transformer<E, String>() { public String transform(E e) { Edge edge = (Edge) e; //return edge.getXMLId(); return edge.getXMLId() != null ? edge.getXMLId() : ""; } }; Transformer<V, Font> vertexFontTransformer = new Transformer<V, Font>() { public Font transform(V v) { return new Font("Dialog", Font.PLAIN, 10); } }; Transformer<V, String> vLblTransformer = new Transformer<V, String>() { public String transform(V v) { Vertex vertex = (Vertex) v; return vertex.getElementID(); } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<E>()); // ----> vv.getRenderContext().setEdgeFontTransformer(edgeFontTransformer); vv.getRenderContext().setLabelOffset(20); vv.getRenderContext().setEdgeLabelTransformer(lblTransformer); vv.getRenderContext().setVertexFontTransformer(vertexFontTransformer); vv.getRenderContext().setVertexLabelTransformer(vLblTransformer); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N); BufferedImage img = new BufferedImage((int) _currentLayout.getSize().getWidth(), (int) _currentLayout.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB); vv.getImage(new Point(0, 0), new Dimension(700, 700)); Graphics2D g2d = (Graphics2D) img.getGraphics(); vv.paint(g2d); setDisclaimer(g2d); g2d.dispose(); try { File file = new File(fileName); ImageIO.write(img, "png", file); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.jfree.chart.demo.selection.SelectionDemo3.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension<XYCursor> ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo3", "X", "Y", dataset); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);// w w w .ja v a2 s.c o m plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); //XYItemRenderer r = plot.getRenderer(); XYDotRenderer r = new XYDotRenderer(); r.setDotHeight(2); r.setDotWidth(2); r.setSeriesPaint(0, Color.blue); r.setSeriesPaint(1, Color.green); r.setSeriesPaint(2, Color.yellow); r.setSeriesPaint(3, Color.orange); plot.setRenderer(r); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemPaint(r, ext, Color.red); //register plot as selection change listener ext.addChangeListener(plot); return chart; }
From source file:Wallpaper.java
@Override public void paint(Graphics g, JComponent c) { super.paint(g, c); Graphics2D g2 = (Graphics2D) g.create(); int w = c.getWidth(); int h = c.getHeight(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .5f)); g2.setPaint(new GradientPaint(0, 0, Color.yellow, 0, h, Color.red)); g2.fillRect(0, 0, w, h);// ww w. jav a 2s. c om g2.dispose(); }