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:SimpleLayers.java

public SimpleLayers() {
    super("LayeredPane Demonstration");
    setSize(200, 150);//from  www . j av a2s .com
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JLayeredPane lp = getLayeredPane();

    // Create 3 buttons
    JButton top = new JButton();
    top.setBackground(Color.white);
    top.setBounds(20, 20, 50, 50);
    JButton middle = new JButton();
    middle.setBackground(Color.gray);
    middle.setBounds(40, 40, 50, 50);
    JButton bottom = new JButton();
    bottom.setBackground(Color.black);
    bottom.setBounds(60, 60, 50, 50);

    // Place the buttons in different layers
    lp.add(middle, new Integer(2));
    lp.add(top, new Integer(3));
    lp.add(bottom, new Integer(1));
}

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

private static JFreeChart createChart(ValueDataset valuedataset) {
    MeterPlot meterplot = new MeterPlot(valuedataset);
    meterplot.setRange(new Range(0.0D, 60D));
    meterplot.addInterval(new MeterInterval("Normal", new Range(0.0D, 35D), Color.lightGray,
            new BasicStroke(2.0F), new Color(0, 255, 0, 64)));
    meterplot.addInterval(new MeterInterval("Warning", new Range(35D, 50D), Color.lightGray,
            new BasicStroke(2.0F), new Color(255, 255, 0, 64)));
    meterplot.addInterval(new MeterInterval("Critical", new Range(50D, 60D), Color.lightGray,
            new BasicStroke(2.0F), new Color(255, 0, 0, 128)));
    meterplot.setNeedlePaint(Color.darkGray);
    meterplot.setDialBackgroundPaint(Color.white);
    meterplot.setDialOutlinePaint(Color.gray);
    meterplot.setDialShape(DialShape.CHORD);
    meterplot.setMeterAngle(260);//  ww  w  .j av  a  2  s  .co  m
    meterplot.setTickLabelsVisible(true);
    meterplot.setTickLabelFont(new Font("Dialog", 1, 10));
    meterplot.setTickLabelPaint(Color.darkGray);
    meterplot.setTickSize(5D);
    meterplot.setTickPaint(Color.lightGray);
    meterplot.setValuePaint(Color.black);
    meterplot.setValueFont(new Font("Dialog", 1, 14));
    JFreeChart jfreechart = new JFreeChart("Meter Chart 1", JFreeChart.DEFAULT_TITLE_FONT, meterplot, true);
    return jfreechart;
}

From source file:Main.java

public Main() {
    super("JScrollPane Demo");
    JScrollPane scrollPane = new JScrollPane(label);

    JLabel[] corners = new JLabel[4];
    for (int i = 0; i < 4; i++) {
        corners[i] = new JLabel();
        corners[i].setBackground(Color.white);
        corners[i].setOpaque(true);/*from  w w w . j  av  a 2  s. co  m*/
    }

    JLabel rowheader = new JLabel() {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Rectangle rect = g.getClipBounds();
            for (int i = 50 - (rect.y % 50); i < rect.height; i += 50) {
                g.drawLine(0, rect.y + i, 3, rect.y + i);
                g.drawString("" + (rect.y + i), 6, rect.y + i + 3);
            }
        }

        public Dimension getPreferredSize() {
            return new Dimension(25, (int) label.getPreferredSize().getHeight());
        }
    };
    rowheader.setBackground(Color.white);
    rowheader.setOpaque(true);

    JLabel columnheader = new JLabel() {

        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Rectangle r = g.getClipBounds();
            for (int i = 50 - (r.x % 50); i < r.width; i += 50) {
                g.drawLine(r.x + i, 0, r.x + i, 3);
                g.drawString("" + (r.x + i), r.x + i - 10, 16);
            }
        }

        public Dimension getPreferredSize() {
            return new Dimension((int) label.getPreferredSize().getWidth(), 25);
        }
    };
    columnheader.setBackground(Color.white);
    columnheader.setOpaque(true);

    scrollPane.setRowHeaderView(rowheader);
    scrollPane.setColumnHeaderView(columnheader);
    scrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, corners[0]);
    scrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corners[1]);
    scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, corners[2]);
    scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, corners[3]);

    getContentPane().add(scrollPane);
    setSize(400, 300);
    setVisible(true);
}

From source file:GeneralPathDemo2D.java

public void init() {
    setBackground(Color.white);
    setForeground(Color.white);
}

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

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createXYBarChart("XYTaskDatasetDemo1", "Resource", false, "Timing",
            intervalxydataset, PlotOrientation.HORIZONTAL, true, false, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setRangePannable(true);// w  w w.j  a  v a 2  s.  c  o  m
    SymbolAxis symbolaxis = new SymbolAxis("Series", new String[] { "Team A", "Team B", "Team C", "Team D" });
    symbolaxis.setGridBandsVisible(false);
    xyplot.setDomainAxis(symbolaxis);
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setUseYInterval(true);
    xyplot.setRangeAxis(new DateAxis("Timing"));
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date",
            "Price Per Unit", xydataset, 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(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(true);
        xylineandshaperenderer.setBaseShapesFilled(true);
        xylineandshaperenderer.setBaseItemLabelsVisible(true);
    }//from w w  w  . ja va  2 s  .c  o m
    PeriodAxis periodaxis = new PeriodAxis("Date");
    periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
    periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class);
    PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3];
    aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d"));
    aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class,
            new SimpleDateFormat("MMM"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10),
            Color.blue, false, new BasicStroke(0.0F), Color.lightGray);
    aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class,
            new SimpleDateFormat("yyyy"));
    periodaxis.setLabelInfo(aperiodaxislabelinfo);
    xyplot.setDomainAxis(periodaxis);
    return jfreechart;
}

From source file:MainClass.java

public MouseMotionAnonymous() {
    setBackground(Color.white);
    addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent me) {
            setBackground(Color.white);
            repaint();//from  w  w  w. j  a v a  2  s .c  om
        }
    });
    addMouseMotionListener(new MouseMotionAdapter() {
        public void mouseDragged(MouseEvent me) {
            setBackground(Color.cyan);
            repaint();
        }
    });
}

From source file:HeaderDemo.java

public HeaderDemo() {
    super("JScrollPane Demo");
    JScrollPane scrollPane = new JScrollPane(label);

    JLabel[] corners = new JLabel[4];
    for (int i = 0; i < 4; i++) {
        corners[i] = new JLabel();
        corners[i].setBackground(Color.white);
        corners[i].setOpaque(true);/*from   w  w  w  .j  a v  a  2  s  . c  o m*/
    }

    JLabel rowheader = new JLabel() {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Rectangle rect = g.getClipBounds();
            for (int i = 50 - (rect.y % 50); i < rect.height; i += 50) {
                g.drawLine(0, rect.y + i, 3, rect.y + i);
                g.drawString("" + (rect.y + i), 6, rect.y + i + 3);
            }
        }

        public Dimension getPreferredSize() {
            return new Dimension(25, (int) label.getPreferredSize().getHeight());
        }
    };
    rowheader.setBackground(Color.white);
    rowheader.setOpaque(true);

    JLabel columnheader = new JLabel() {

        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Rectangle r = g.getClipBounds();
            for (int i = 50 - (r.x % 50); i < r.width; i += 50) {
                g.drawLine(r.x + i, 0, r.x + i, 3);
                g.drawString("" + (r.x + i), r.x + i - 10, 16);
            }
        }

        public Dimension getPreferredSize() {
            return new Dimension((int) label.getPreferredSize().getWidth(), 25);
        }
    };
    columnheader.setBackground(Color.white);
    columnheader.setOpaque(true);

    scrollPane.setRowHeaderView(rowheader);
    scrollPane.setColumnHeaderView(columnheader);
    scrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, corners[0]);
    scrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corners[1]);
    scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, corners[2]);
    scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, corners[3]);

    getContentPane().add(scrollPane);
    setSize(400, 300);
    setVisible(true);
}

From source file:Main.java

public MouseMotionAdapterDemo() {
    setBackground(Color.white);
    addMouseListener(new Adapter1(this));
    addMouseMotionListener(new Adapter2(this));
}

From source file:Main.java

Panel() {
    setBackground(Color.BLACK);
    setForeground(Color.WHITE);
    refreshScreen();
}