Example usage for java.awt Color green

List of usage examples for java.awt Color green

Introduction

In this page you can find the example usage for java.awt Color green.

Prototype

Color green

To view the source code for java.awt Color green.

Click Source Link

Document

The color green.

Usage

From source file:de.codesourcery.jasm16.ide.ui.views.WorkspaceExplorer.java

private JPanel createPanel() {
    treeModel = createTreeModel();//w  ww  . java  2s  .  c  o m
    tree.setModel(treeModel);
    setColors(tree);
    tree.setRootVisible(false);

    //      for (int i = 0; i < tree.getRowCount(); i++) {
    //         tree.expandRow(i);
    //      }

    tree.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE) {
                final WorkspaceTreeNode selection = getSelectedNode();
                if (selection != null) {
                    deleteResource(selection);
                }
            } else if (e.getKeyCode() == KeyEvent.VK_F5) {
                refreshWorkspace(null);
            }
        }
    });

    tree.addMouseListener(new MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
                final TreePath path = tree.getPathForLocation(e.getX(), e.getY());
                if (path != null) {
                    final WorkspaceTreeNode selected = (WorkspaceTreeNode) path.getLastPathComponent();
                    final IAssemblyProject project = getProject(selected);
                    try {
                        if (project != null) {
                            onTreeNodeLeftClick(project, selected);
                        } else {
                            System.err.println("Unable to locate project for " + selected);
                        }
                    } catch (IOException e1) {
                        LOG.error("mouseClicked(): Internal error", e1);
                    }
                }
            }
        }
    });

    final TreeSelectionListener selectionListener = new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {

        }
    };

    tree.getSelectionModel().addTreeSelectionListener(selectionListener);

    tree.setCellRenderer(new DefaultTreeCellRenderer() {

        public Color getTextSelectionColor() {
            return Color.GREEN;
        };

        public java.awt.Color getTextNonSelectionColor() {
            return Color.GREEN;
        };

        public Color getBackgroundSelectionColor() {
            return Color.BLACK;
        };

        public Color getBackgroundNonSelectionColor() {
            return Color.BLACK;
        };

        public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel,
                boolean expanded, boolean leaf, int row, boolean hasFocus) {

            java.awt.Component result = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
                    row, hasFocus);

            String label = value.toString();
            Color color = getTextColor();
            if (value instanceof WorkspaceTreeNode) {
                if (value instanceof ProjectNode) {
                    final ProjectNode projectNode = (ProjectNode) value;
                    final IAssemblyProject project = projectNode.getValue();
                    label = project.getName();

                    if (project.isClosed()) {
                        color = Color.LIGHT_GRAY;
                    } else {
                        if (projectNode.hasCompilationErrors()) {
                            color = Color.RED;
                        }
                    }
                } else if (value instanceof FileNode) {
                    FileNode fn = (FileNode) value;
                    label = fn.getValue().getName();
                    switch (fn.type) {
                    case DIRECTORY:
                        if (fn.hasCompilationErrors()) {
                            color = Color.RED;
                        }
                        break;
                    case OBJECT_FILE:
                        label = "[O] " + label;
                        break;
                    case EXECUTABLE:
                        label = "[E] " + label;
                        break;
                    case SOURCE_CODE:
                        label = "[S] " + label;
                        if (fn.hasCompilationErrors()) {
                            color = Color.RED;
                        }
                        break;
                    default:
                        // ok
                    }
                }
            }
            setForeground(color);
            setText(label);
            return result;
        };

    });

    setupPopupMenu();

    final JScrollPane pane = new JScrollPane(tree);
    setColors(pane);

    final JPanel result = new JPanel();
    result.setLayout(new GridBagLayout());
    GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH);
    setColors(result);
    result.add(pane, cnstrs);
    return result;
}

From source file:visualizer.datamining.dataanalysis.NeighborhoodPreservation.java

private JFreeChart createChart(XYDataset xydataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("Neighborhood Preservation", "Number Neighbors",
            "Precision", xydataset, PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    xyplot.setOutlinePaint(Color.BLACK);
    xyplot.setOutlineStroke(new BasicStroke(1.0f));
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:net.sf.mzmine.chartbasics.chartthemes.ChartThemeFactory.java

/**
 * Creates the theme called "Karst". In this theme, the charts have a blue background and yellow
 * lines and labels.//ww  w . jav  a  2 s .  c om
 *
 * @return The "Karst" theme.
 */
public static EStandardChartTheme createKarstTheme() {
    EStandardChartTheme theme = new EStandardChartTheme(THEME.KARST, "Karst");
    // Fonts
    theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 20));
    theme.setLargeFont(new Font("Arial", Font.BOLD, 11));
    theme.setRegularFont(new Font("Arial", Font.PLAIN, 11));
    theme.setSmallFont(new Font("Arial", Font.PLAIN, 11));
    //
    Paint bg = new Color(50, 50, 202);
    //
    theme.setTitlePaint(Color.green);
    theme.setSubtitlePaint(Color.yellow);
    theme.setLegendBackgroundPaint(bg);
    theme.setLegendItemPaint(Color.yellow);
    theme.setChartBackgroundPaint(bg);
    theme.setPlotBackgroundPaint(bg);
    theme.setPlotOutlinePaint(Color.yellow);
    theme.setBaselinePaint(Color.white);
    theme.setCrosshairPaint(Color.red);
    theme.setLabelLinkPaint(Color.lightGray);
    theme.setTickLabelPaint(Color.yellow);
    theme.setAxisLabelPaint(Color.yellow);
    theme.setShadowPaint(Color.darkGray);
    theme.setItemLabelPaint(Color.yellow);
    theme.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"),
                    Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"),
                    Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"),
                    Color.decode("0xA9A938"), Color.decode("0x2D4587") },
            new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC") },
            new Stroke[] { new BasicStroke(2.0f) }, new Stroke[] { new BasicStroke(0.5f) },
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    theme.setErrorIndicatorPaint(Color.lightGray);
    theme.setGridBandPaint(new Color(255, 255, 255, 20));
    theme.setGridBandAlternatePaint(new Color(255, 255, 255, 40));

    // axis
    Color transp = new Color(255, 255, 255, 200);
    theme.setRangeGridlinePaint(transp);
    theme.setDomainGridlinePaint(transp);

    theme.setAxisLinePaint(Color.yellow);
    theme.setMasterFontColor(Color.yellow);

    // axis offset
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    return theme;
}

From source file:jmemorize.gui.swing.panels.CardCounterPanel.java

private ExtentProgressBar buildExtentProgressBar() {
    ExtentProgressBar bar = new ExtentProgressBar();

    bar.setForeground(Color.BLUE);
    Color grn = Color.GREEN.darker();
    Color transparentGreen = new Color(grn.getRed(), grn.getGreen(), grn.getBlue(), 128);
    bar.setExtentForeground(transparentGreen);
    bar.setExtent(0);/*from  w  w  w .j  a v  a  2 s .com*/

    return bar;
}

From source file:i2p.bote.web.PeerInfoTag.java

private String createRelayChart(RelayPeer[] relayPeers) throws IOException {
    RingPlot plot;/*from   w  ww  .j a v a 2s  .  co  m*/
    if (relayPeers.length == 0) {
        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("", 100);

        plot = new RingPlot(dataset);
        plot.setSectionPaint("", Color.gray);
    } else {
        int good = 0;
        int untested = 0;
        for (RelayPeer relayPeer : relayPeers) {
            int reachability = relayPeer.getReachability();
            if (reachability == 0)
                untested += 1;
            else if (reachability > 80)
                good += 1;
        }
        int bad = relayPeers.length - good - untested;

        DefaultPieDataset dataset = new DefaultPieDataset();
        if (good > 0)
            dataset.setValue(_t("Good"), good);
        if (bad > 0)
            dataset.setValue(_t("Unreliable"), bad);
        if (untested > 0)
            dataset.setValue(_t("Untested"), untested);

        plot = new RingPlot(dataset);
        plot.setSectionPaint(_t("Good"), Color.green);
        plot.setSectionPaint(_t("Unreliable"), Color.red);
        plot.setSectionPaint(_t("Untested"), Color.orange);
    }
    plot.setLabelGenerator(null);
    plot.setShadowGenerator(null);

    JFreeChart chart = new JFreeChart(_t("Relay Peers:"), JFreeChart.DEFAULT_TITLE_FONT, plot,
            relayPeers.length == 0 ? false : true);
    return ServletUtilities.saveChartAsPNG(chart, 400, 300, null);
}

From source file:DesktopManagerDemo.java

public void paintEventSquare(Graphics g, int value, int currwidth, int currheight, int cellwidth,
        int cellheight, Color color) {
    if (value != 0) {
        g.setColor(color);/*from w  ww.  ja  va 2s . c  o  m*/
        g.fillRect(currwidth, currheight, cellwidth, cellheight);
        g.setColor(Color.green);
        g.drawString("" + value, currwidth + 5, currheight + 14);
    }
    g.setColor(Color.black);
    g.drawRect(currwidth, currheight, cellwidth, cellheight);
}

From source file:co.com.soinsoftware.hotelero.view.JFRoom.java

private boolean selectRoom(final JButton button) {
    boolean canSelect = false;
    if (button.getBackground().equals(Color.WHITE)) {
        this.setBackgroundColor(button, Color.GREEN);
        canSelect = true;/*from www .  j a v a  2  s  .  c  o  m*/
    }
    return canSelect;
}

From source file:org.patientview.radar.service.impl.UtilityManagerImpl.java

public JFreeChart getPatientCountPerUnitChart() {
    // create dataset
    String srnsSeries = "SRNS";
    String mpgnSeries = "MPGN";

    DiagnosisCode srnsCode = new DiagnosisCode();
    srnsCode.setId(DiagnosisCode.SRNS_ID);

    DiagnosisCode mpgnCode = new DiagnosisCode();
    mpgnCode.setId(DiagnosisCode.MPGN_ID);

    Map<Long, Integer> srnsPatientCountMap = getPatientCountPerUnitByDiagnosisCode(srnsCode);
    Map<Long, Integer> mpgnPatientCountMap = getPatientCountPerUnitByDiagnosisCode(mpgnCode);

    java.util.List<Centre> centreList = getCentres();

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    for (Centre centre : centreList) {

        String centreCategory = centre.getAbbreviation() != null ? centre.getAbbreviation() : centre.getName();

        Integer srnsCount = srnsPatientCountMap.containsKey(centre.getId())
                ? srnsPatientCountMap.get(centre.getId())
                : null;//from  w  w  w  .  j  a v  a  2 s.c o m
        if (srnsCount != null && srnsCount > 0) {
            dataset.addValue(srnsCount, srnsSeries, centreCategory);
        }

        Integer mpgnCount = mpgnPatientCountMap.containsKey(centre.getId())
                ? mpgnPatientCountMap.get(centre.getId())
                : null;

        if (mpgnCount != null && mpgnCount > 0) {
            dataset.addValue(mpgnCount, mpgnSeries, centreCategory);
        }
    }

    // create chart
    JFreeChart chart = ChartFactory.createBarChart("Total number of registered patients by unit", // chart title
            "", // domain axis label
            "", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    DecimalFormat decimalformat1 = new DecimalFormat("##,###");
    renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1));
    renderer.setItemLabelsVisible(true);
    renderer.setBaseItemLabelsVisible(true);

    // 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));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLabelFont(new Font("Times New Roman", Font.PLAIN, 12));
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;
}

From source file:visualizer.datamining.dataanalysis.CreateLineGraph.java

private JFreeChart createChart(XYDataset xydataset, String title, String xtitle, String ytitle) {
    JFreeChart chart = ChartFactory.createXYLineChart(title, xtitle, ytitle, xydataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    xyplot.setOutlinePaint(Color.BLACK);
    xyplot.setOutlineStroke(new BasicStroke(1.0f));
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:sanger.team16.gui.genevar.eqtl.snp.CisEQTLSNPPane.java

public void setParameterPanel(SelectedIndex selectedIndex, String distanceTo) {
    BaseJPane panel = new BaseJPane("Analysis Parameters");

    // ------------------ Panel p0 (start) ------------------ //
    BaseJPane p0 = new BaseJPane();
    algorithms = this.getQTLAlgorithms(study.getId(), "E");

    p0.add(new JLabel("1. Correlation and regression: "));
    cbStatistic = new JComboBox(Message.getStatistics(this.ui.getAddress()));
    if (isDefault)
        if (algorithms.size() != 0 && selectedIndex.studyIndex != 0) {
            this.setAlgorithms(algorithms);
            isDefault = false;//from w w  w  . j av  a  2 s .  com
        } else {
            this.setNullAlgorithms(selectedIndex.statisticIndex);
            cbStatistic.removeItemAt(cbStatistic.getComponentCount()); //ADD 02/12/10
        }
    else if (selectedIndex.statisticIndex == cbStatistic.getComponentCount())
        this.setAlgorithms(algorithms);
    else
        this.setNullAlgorithms(selectedIndex.statisticIndex);
    cbStatistic.addActionListener(this);
    p0.add(cbStatistic);
    p0.add(cbAlgorithm);

    p0.add(new JLabel(""));

    p0.setBaseSpringBoxTrailing();
    panel.add(p0);
    // ------------------ Panel p0 (end) ------------------ //

    panel.add(new JLabel(""));

    // ------------------ Panel p1 (start) ------------------ //
    BaseJPane p1 = new BaseJPane();

    p1.add(new JLabel(distanceTo));
    cbDistance = new JComboBox(distances);
    cbDistance.setEditable(true);
    cbDistance.addActionListener(this);
    p1.add(cbDistance);
    p1.add(new BaseJLabel("(Editable, no greater than 1 Mb)", Color.GREEN.darker()));

    p1.setBaseSpringBoxTrailing();
    panel.add(p1);
    // ------------------ Panel p1 (end) ------------------ //

    panel.add(new JLabel(""));

    // ------------------ Panel p2 (start) ------------------ //
    BaseJPane p2 = new BaseJPane();

    p2.add(new JLabel("3. P-value threshold: "));
    cbPValue = new JComboBox(pValues);
    cbPValue.setSelectedIndex(2);
    cbPValue.setEditable(true);
    cbPValue.addActionListener(this);
    p2.add(cbPValue);
    p2.add(new BaseJLabel("(Editable)", Color.GREEN.darker()));

    p2.setBaseSpringBoxTrailing();
    panel.add(p2);
    // ------------------ Panel p2 (end) ------------------ //

    panel.setBaseSpringGrid(1);
    this.add(panel);
}