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

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    Font font = new Font("Dialog", Font.PLAIN, 96);
    g2.setFont(font);/*from  w  ww . j ava 2  s. co m*/
    int width = getSize().width;
    int height = getSize().height;

    String message = "Java2s";

    FontRenderContext frc = g2.getFontRenderContext();
    LineMetrics metrics = font.getLineMetrics(message, frc);
    float messageWidth = (float) font.getStringBounds(message, frc).getWidth();

    // center text
    float ascent = metrics.getAscent();
    float descent = metrics.getDescent();
    float x = (width - messageWidth) / 2;
    float y = (height + metrics.getHeight()) / 2 - descent;

    int PAD = 25;
    g2.setPaint(getBackground());
    g2.fillRect(0, 0, width, height);

    g2.setPaint(getForeground());
    g2.drawString(message, x, y);

    g2.setPaint(Color.white); // Base lines
    drawLine(g2, x - PAD, y, x + messageWidth + PAD, y);
    drawLine(g2, x, y + PAD, x, y - ascent - PAD);
    g2.setPaint(Color.green); // Ascent line
    drawLine(g2, x - PAD, y - ascent, x + messageWidth + PAD, y - ascent);
    g2.setPaint(Color.red); // Descent line
    drawLine(g2, x - PAD, y + descent, x + messageWidth + PAD, y + descent);
}

From source file:lu.lippmann.cdb.datasetview.tabs.PieChartTabView.java

/**
 * Constructor./*from www.j a  v  a  2s  .c o  m*/
 */
public PieChartTabView() {
    super();

    this.pieDataset = new DefaultPieDataset();
    this.pieChart = ChartFactory.createPieChart("", this.pieDataset, true, true, true);
    final PiePlot plot = (PiePlot) this.pieChart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    this.chartPanel = new ChartPanel(this.pieChart, true);
}

From source file:room.utilization.BarGraph.java

private void createBarGraph() {
    Container contentPane = getContentPane();

    contentPane.setBackground(Color.WHITE);

    setSize(700, 500);/*  www.jav  a  2  s  .c  o m*/
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setLocation(500, 250);
    setIconImage(new ImageIcon(
            "C:\\Users\\Olasubomi\\Documents\\NetBeansProjects\\Room Utilization\\src\\room\\utilization\\icon.png")
                    .getImage());
    contentPane.add(createPanel());
    setVisible(true);
}

From source file:com.mirth.connect.client.ui.ChangePasswordDialog.java

public ChangePasswordDialog(User currentUser, String message) {
    super(PlatformUI.MIRTH_FRAME);
    this.currentUser = currentUser;
    this.parent = PlatformUI.MIRTH_FRAME;
    initComponents();//from   ww w.  j a  va 2  s .c om

    mirthHeadingLabel.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);

    passwordTextArea.setText(message);
    passwordTextArea.setBackground(Color.WHITE);
    passwordTextArea.setDisabledTextColor(Color.RED);

    finishButton.setEnabled(false);

    setModal(true);

    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            cancelButtonActionPerformed(null);
        }
    });

    pack();
    Dimension dlgSize = getPreferredSize();
    Dimension frmSize = parent.getSize();
    Point loc = parent.getLocation();

    if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) {
        setLocationRelativeTo(null);
    } else {
        setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
    }

    setVisible(true);
}

From source file:Main.java

public Main() {
    UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(1, 0, 0, 0));
    UIManager.put("TabbedPane.contentAreaColor", new ColorUIResource(Color.GREEN));
    UIManager.put("TabbedPane.focus", new ColorUIResource(Color.ORANGE));
    UIManager.put("TabbedPane.selected", new ColorUIResource(Color.YELLOW));
    UIManager.put("TabbedPane.darkShadow", new ColorUIResource(Color.DARK_GRAY));
    UIManager.put("TabbedPane.borderHightlightColor", new ColorUIResource(Color.LIGHT_GRAY));
    UIManager.put("TabbedPane.light", new ColorUIResource(Color.WHITE));
    UIManager.put("TabbedPane.tabAreaBackground", new ColorUIResource(Color.CYAN));
    UIManager.put("ToolTip.background", Color.WHITE);
    UIManager.put("ToolTip.border", new BorderUIResource(new LineBorder(Color.BLACK)));
    this.updateUI();

    this.setBackground(Color.BLUE);

    JPanel testPanel = new JPanel();
    testPanel.setLayout(new BorderLayout());
    testPanel.add(new JLabel("Hello World"), BorderLayout.NORTH);
    testPanel.add(new JTextArea("Looks nice out there :)"), BorderLayout.CENTER);

    JPanel testPanel2 = new JPanel();
    testPanel2.setLayout(new BorderLayout());
    testPanel2.add(new JLabel("Good Bye World"), BorderLayout.NORTH);
    testPanel2.add(new JTextArea("OK"), BorderLayout.CENTER);

    this.addTab("Hello World", testPanel);
    this.addTab("World", testPanel2);
}

From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.panels.Server.java

public Server() {

    setLayout(new BorderLayout(0, 0));
    JTabbedPane serverFunctions = new JTabbedPane(JTabbedPane.LEFT);

    serverFunctions.setBackground(Color.WHITE);
    this.setBackground(Color.WHITE);
    serverFunctions.addTab("Display", null, null, null);
    serverFunctions.addTab("File Manager", null, null, null);
    serverFunctions.addTab("Console", null, null, null);

    add(serverFunctions, BorderLayout.CENTER);

}

From source file:no.imr.sea2data.guibase.chart.XYBarChart.java

public XYBarChart() {
    dataset = new XYSeriesCollection(new XYSeries("Series 1"));
    JFreeChart chart = ChartFactory.createXYBarChart("", "X axis", false, "Y axis", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.white);
    chart.getTitle().setPaint(Color.black);
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, 12));
    chart.addSubtitle(trendLegend);/*www.j  av a2  s . c  o m*/
    chart.addSubtitle(trendLegend2);
    trendLegend.setPosition(RectangleEdge.TOP);
    trendLegend2.setPosition(RectangleEdge.TOP);
    plot = (XYPlot) chart.getPlot();
    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setShadowVisible(false);
    chartPanel = new ChartPanel(chart);
    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
}

From source file:Charts2D.java

public Charts2D() {
    super("2D Charts");
    setSize(720, 280);/*from  www .  jav  a2s.  co m*/
    getContentPane().setLayout(new GridLayout(1, 3, 10, 0));
    getContentPane().setBackground(Color.white);

    int[] xData = new int[8];
    int[] yData = new int[8];
    for (int i = 0; i < xData.length; i++) {
        xData[i] = i;
        yData[i] = (int) (Math.random() * 100);
        if (i > 0)
            yData[i] = (yData[i - 1] + yData[i]) / 2;
    }

    JChart2D chart = new JChart2D(JChart2D.LineChart, xData.length, xData, yData, "Line Chart");
    chart.setStroke(new BasicStroke(5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
    chart.setLineColor(new Color(0, 28, 28));
    getContentPane().add(chart);

    chart = new JChart2D(JChart2D.ColumnChart, xData.length, xData, yData, "Column Chart");
    GradientPaint gp = new GradientPaint(0, 100, Color.white, 0, 300, Color.blue, true);
    chart.setGradient(gp);
    chart.setEffectIndex(JChart2D.Gradientffect);
    chart.setDrawShadow(true);
    getContentPane().add(chart);

    chart = new JChart2D(JChart2D.PieChart, xData.length, xData, yData, "Pie Chart");
    ImageIcon icon = new ImageIcon("largeJava2slogo.GIF");
    chart.setForegroundImage(icon.getImage());
    chart.setEffectIndex(JChart2D.ImageEffect);
    chart.setDrawShadow(true);
    getContentPane().add(chart);

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    setVisible(true);
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setAutoRangeIncludesZero(false);
    StatisticalBarRenderer statisticalbarrenderer = new StatisticalBarRenderer();
    statisticalbarrenderer.setErrorIndicatorPaint(Color.black);
    statisticalbarrenderer.setIncludeBaseInRange(false);
    categoryplot.setRenderer(statisticalbarrenderer);
    statisticalbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    statisticalbarrenderer.setBaseItemLabelsVisible(true);
    statisticalbarrenderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER));
    return jfreechart;
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Statistical Line Chart Demo 1", "Type", "Value",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setUpperMargin(0.0D);/*from w  w  w  .  j  a  va  2s . c  o  m*/
    categoryaxis.setLowerMargin(0.0D);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setAutoRangeIncludesZero(true);
    StatisticalLineAndShapeRenderer statisticallineandshaperenderer = new StatisticalLineAndShapeRenderer(true,
            false);
    categoryplot.setRenderer(statisticallineandshaperenderer);
    return jfreechart;
}