Example usage for java.awt Color WHITE

List of usage examples for java.awt Color WHITE

Introduction

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

Prototype

Color WHITE

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

Click Source Link

Document

The color white.

Usage

From source file:Main.java

public static Element toXML(Color c, Document document) {
    Element result = document.createElement("color");

    String name;//from  w ww .j  a  v  a 2 s  .  c o  m
    if (c.equals(Color.WHITE)) {
        name = "white";
    } else if (c.equals(Color.CYAN)) {
        name = "cyan";
    } else if (c.equals(Color.YELLOW)) {
        name = "yellow";
    } else if (c.equals(Color.PINK)) {
        name = "pink";
    } else if (c.equals(Color.GREEN)) {
        name = "green";
    } else {
        name = "white";
    }

    result.setAttribute("name", name);

    return result;
}

From source file:Main.java

private static Component blackJTextPane() {
    JTextPane pane = new JTextPane();
    pane.setBackground(Color.BLACK);
    pane.setForeground(Color.WHITE);
    pane.setText("Here is example text");
    return pane;//w w w.j  av a2  s . c  o  m
}

From source file:Main.java

public static Color getBackgroundColor() {
    return Color.white;
}

From source file:net.sf.maltcms.chromaui.charts.GradientPaintScale.java

/**
 *
 * @param args//w  ww .ja  va 2s .  c o  m
 */
public static void main(String[] args) {
    double[] st = ImageTools.createSampleTable(256);
    Logger.getLogger(GradientPaintScale.class.getName()).info(Arrays.toString(st));
    double min = 564.648;
    double max = 24334.234;
    GradientPaintScale gps = new GradientPaintScale(st, min, max,
            new Color[] { Color.BLACK, Color.RED, Color.orange, Color.yellow, Color.white });
    double val = min;
    double incr = (max - min) / (st.length - 1);
    Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Increment: {0}", incr);
    for (int i = 0; i < st.length; i++) {
        Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Value: {0}", val);
        gps.getPaint(val);
        val += incr;
    }
    Logger.getLogger(GradientPaintScale.class.getName()).info("Printing min and max values");
    Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Min: {0} gps min: {1}",
            new Object[] { min, gps.getPaint(min) });
    Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Max: {0} gps max: {1}",
            new Object[] { max, gps.getPaint(max) });
    JList jl = new JList();
    DefaultListModel dlm = new DefaultListModel();
    jl.setModel(dlm);
    jl.setCellRenderer(new ListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            if (value instanceof JLabel) {
                // Border b =
                // BorderFactory.createCompoundBorder(BorderFactory
                // .createEmptyBorder(0, 0, 5, 0), BorderFactory
                // .createLineBorder(Color.BLACK, 1));
                // ((JLabel) value).setBorder(b);
                return (Component) value;
            }
            return new JLabel(value.toString());
        }
    });
    JFrame jf = new JFrame();
    jf.add(new JScrollPane(jl));
    jf.setVisible(true);
    jf.setSize(200, 400);
    for (int alpha = -10; alpha <= 10; alpha++) {
        for (int beta = 1; beta <= 20; beta++) {
            gps.setAlphaBeta(alpha, beta);
            // System.out.println(Arrays.toString(gps.st));
            // System.out.println(Arrays.toString(gps.sampleTable));
            BufferedImage bi = gps.getLookupImage();
            ImageIcon ii = new ImageIcon(bi);
            dlm.addElement(new JLabel(ii));
        }
    }

}

From source file:Main.java

/**
 * Gets a "spacer" pixel for use./*  w ww.  j a va 2  s  .c om*/
 * @return
 */
public static BufferedImage create1x1Pixel() {
    BufferedImage b = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
    Graphics g = b.getGraphics();
    g.setColor(Color.white);
    g.fillRect(0, 0, 2, 2);
    g.dispose();
    return b;
}

From source file:org.jfree.chart.demo.XYBarChartDemo6.java

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createXYBarChart("XYBarChartDemo6", "X", false, "Y", intervalxydataset,
            PlotOrientation.HORIZONTAL, false, false, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setUseYInterval(true);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    return jfreechart;
}

From source file:Main.java

public void init() {
    setBackground(Color.WHITE);
}

From source file:ColorUtil.java

public static Color getOpposite(Color c) {
    return isDark(c) ? Color.WHITE : Color.BLACK;
}

From source file:org.jfree.chart.demo.YIntervalChartDemo1.java

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createScatterPlot("Y Interval Chart Demo", "X", "Y", intervalxydataset,
            PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));
    xyplot.setRenderer(new YIntervalRenderer());
    return jfreechart;
}

From source file:edu.uara.wrappers.customcharts.CustomLineChart.java

public static void main(String[] args) {
    // create a dataset...
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(1.0, "Row 1", "Column 1");
    dataset.addValue(5.0, "Row 1", "Column 2");
    dataset.addValue(3.0, "Row 1", "Column 3");
    dataset.addValue(2.0, "Row 2", "Column 1");
    dataset.addValue(3.0, "Row 2", "Column 2");
    dataset.addValue(2.0, "Row 2", "Column 3");
    // create a chart...
    ILineChart c = new CustomLineChart("Test Line chart", "Domain", "Range", PlotOrientation.VERTICAL, true);
    c.generateLineChart(dataset);//from ww  w  .j a va  2  s  . c  om
    c.setBackGroundColor(Color.white);
    c.setPlotBackGroundColor(Color.white);
    c.drawChart("Chart Editor");
}