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:sernet.gs.ui.rcp.main.bsi.views.chart.StufenBarChart.java

protected JFreeChart createBarChart(Object dataset) {
    final float plotForegroundAlpha = 0.6f;
    JFreeChart chart = ChartFactory.createStackedBarChart3D(null, Messages.StufenBarChart_1,
            Messages.StufenBarChart_2, (CategoryDataset) dataset, PlotOrientation.HORIZONTAL, false, true,
            false);//from   w  w  w. j a va  2 s. c om
    chart.setBackgroundPaint(Color.white);
    chart.getPlot().setForegroundAlpha(plotForegroundAlpha);
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    return chart;

}

From source file:ws.moor.bt.gui.charts.BlockOrigin.java

private JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart3D("Block Origin", dataset, false, false, false);
    chart.setBackgroundPaint(Color.white);

    ((PiePlot3D) chart.getPlot()).setSectionPaint(0, Color.YELLOW);
    ((PiePlot3D) chart.getPlot()).setSectionPaint(0, Color.GREEN);

    return chart;
}

From source file:org.wsm.database.tools.editor.ui.GraphPane.java

public GraphPane() {
    GridBagLayout gbl = new GridBagLayout();
    this.setLayout(gbl);

    this.qesi = new QueryExecStatsInfo();
    this.qesi.addPropertyChangeListener(this);
    dcd = new DefaultCategoryDataset();
    JFreeChart chart = getChart(CHART_TYPE_BAR_3D);

    chart.setBackgroundPaint(Color.white);

    cp = new ChartPanel(chart);
    cp.setBorder(BorderFactory.createTitledBorder(null, "Graph", TitledBorder.LEADING, TitledBorder.TOP,
            UIConstants.LABEL_FONT));/*from   www .  j  a  v a  2  s  .  c  o m*/

    cp.setMouseZoomable(true, true);
    //cp.setPreferredSize(new Dimension(700, 500));
    gbl.setConstraints(cp, SwingUtils.getGridBagConstraints(0, 0, 2, 1));

    this.add(cp);
    JPanel graphTypeSelectionPanel = new JPanel();
    viewBarGraph = new JRadioButton("View Bar Graph", true);
    viewLineGraph = new JRadioButton("View Line Graph", false);
    viewLineGraph.setEnabled(false);
    ButtonGroup bg = new ButtonGroup();
    bg.add(viewBarGraph);
    bg.add(viewLineGraph);

    GridBagLayout graphTypeGBL = new GridBagLayout();
    graphTypeSelectionPanel.setLayout(graphTypeGBL);

    graphTypeGBL.setConstraints(viewBarGraph, SwingUtils.getGridBagConstraints(0, 0));
    graphTypeGBL.setConstraints(viewLineGraph, SwingUtils.getGridBagConstraints(1, 0));
    graphTypeSelectionPanel.add(viewBarGraph);
    graphTypeSelectionPanel.add(viewLineGraph);
    viewBarGraph.addActionListener(this);
    viewLineGraph.addActionListener(this);

    graphTypeSelectionPanel.setBorder(BorderFactory.createTitledBorder(null, "Graph Type", TitledBorder.LEADING,
            TitledBorder.TOP, UIConstants.LABEL_FONT));

    gbl.setConstraints(graphTypeSelectionPanel, SwingUtils.getGridBagConstraints(0, 1, 2, 1));

    this.add(graphTypeSelectionPanel);
    //this.setBounds(50, 100, 100, 200);
    this.setBackground(Color.WHITE);
}

From source file:com.js.quickestquail.ui.stats.LanguageStat.java

private JFreeChart generateChart() {
    JFreeChart chart = ChartFactory.createPieChart(
            java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.language.title"), // chart title 
            generateDataset(), // data    
            true, // include legend   
            true, false);/*from  w  w w .  j av a2s.co m*/
    chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0));
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    return chart;
}

From source file:org.nbheaven.sqe.codedefects.dashboard.controlcenter.panels.Statistics.java

private static JFreeChart createOverviewPanel(DefaultCategoryDataset dataSet) {

    JFreeChart overview = org.jfree.chart.ChartFactory.createStackedBarChart(null, null, "CodeDefects", dataSet,
            PlotOrientation.HORIZONTAL, false, true, false);
    overview.setBorderVisible(false);/*  w  w  w .  j a v  a  2  s  .  c  o m*/
    overview.setBackgroundPaint(Color.WHITE);
    overview.setAntiAlias(true);
    overview.setNotify(true);

    CategoryPlot overviewPlot = overview.getCategoryPlot();
    overviewPlot.setRangeGridlinePaint(Color.BLACK);
    overviewPlot.setDomainGridlinePaint(Color.BLACK);
    overviewPlot.setBackgroundPaint(Color.WHITE);
    overviewPlot.setForegroundAlpha(0.7f);
    overviewPlot.setRangeAxisLocation(AxisLocation.getOpposite(overviewPlot.getRangeAxisLocation()));

    CategoryAxis domainAxis = overviewPlot.getDomainAxis();
    domainAxis.setVisible(true);

    LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects");
    rangeAxis.setLabel(null);
    rangeAxis.setStrictValuesFlag(false);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    overviewPlot.setRangeAxis(rangeAxis);

    CategoryItemRenderer categoryItemRenderer = new StackedBarRenderer(); //3D();
    //        categoryItemRenderers[0].setPaint(Color.RED);
    categoryItemRenderer.setSeriesPaint(0, Color.RED);
    categoryItemRenderer.setSeriesPaint(1, Color.ORANGE);
    categoryItemRenderer.setSeriesPaint(2, Color.YELLOW);

    categoryItemRenderer.setBaseItemLabelsVisible(true);

    overviewPlot.setRenderer(categoryItemRenderer);

    return overview;
}

From source file:ws.moor.bt.gui.charts.DownloadRatePerPeer.java

private JFreeChart createChart() {

    JFreeChart chart = ChartFactory.createBarChart("Top 20 Download Rates", "Remote IP", "KB/s",
            createDataset(), PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0));

    return chart;
}

From source file:cn.z.Ocr5.java

public static BufferedImage removeBackgroud(File picFile) throws Exception {

    BufferedImage img = ImageIO.read(picFile);
    final int width = img.getWidth();
    final int height = img.getHeight();

    // int blackThreshold = 300;

    // img.getMinX() img.getMinY()
    for (int x = img.getMinX(); x < width; x++) {
        for (int y = img.getMinY(); y < height; y++) {

            Color color = new Color(img.getRGB(x, y));
            if ((color.getBlue() < 120) || ((color.getRed() + color.getGreen() + color.getBlue()) < 50)) { //
                img.setRGB(x, y, Color.WHITE.getRGB());
            } else if ((color.getRed() + color.getGreen() + color.getBlue()) < 400) {
                img.setRGB(x, y, Color.BLACK.getRGB());
            }/*from ww  w .  j a va  2  s  . co  m*/

            int nearly = 0;
            int vertical = 0;
            int horizontal = 0;

            if (x > 0) {
                Color leftColor = new Color(img.getRGB(x - 1, y));
                if ((leftColor.getRed() + leftColor.getGreen() + leftColor.getBlue()) < 400) {
                    nearly++;
                    horizontal++;
                }
            }
            if (x < width - 1) {
                Color rightColor = new Color(img.getRGB(x + 1, y));
                if ((rightColor.getRed() + rightColor.getGreen() + rightColor.getBlue()) < 400) {
                    nearly++;
                    horizontal++;
                }
            }
            if (y > 0) {
                Color topColor = new Color(img.getRGB(x, y - 1));
                if ((topColor.getRed() + topColor.getGreen() + topColor.getBlue()) < 400) {
                    nearly++;
                    vertical++;
                }
            }
            if (y < height - 1) {
                Color bottomColor = new Color(img.getRGB(x, y + 1));
                if ((bottomColor.getRed() + bottomColor.getGreen() + bottomColor.getBlue()) < 400) {
                    nearly++;
                    vertical++;
                }
            }

            if (x > 0 && y > 0) {
                Color leftTopColor = new Color(img.getRGB(x - 1, y - 1));
                if ((leftTopColor.getRed() + leftTopColor.getGreen() + leftTopColor.getBlue()) < 400) {
                    nearly++;
                }
            }
            if (x < width - 1 && y < height - 1) {
                Color rightBottomColor = new Color(img.getRGB(x + 1, y + 1));
                if ((rightBottomColor.getRed() + rightBottomColor.getGreen()
                        + rightBottomColor.getBlue()) < 400) {
                    nearly++;
                }
            }
            if (x < width - 1 && y > 0) {
                Color rightTopColor = new Color(img.getRGB(x + 1, y - 1));
                if ((rightTopColor.getRed() + rightTopColor.getGreen() + rightTopColor.getBlue()) < 400) {
                    nearly++;
                }
            }
            if (x > 0 && y < height - 1) {
                Color leftBottomColor = new Color(img.getRGB(x - 1, y + 1));
                if ((leftBottomColor.getRed() + leftBottomColor.getGreen() + leftBottomColor.getBlue()) < 400) {
                    nearly++;
                }
            }

            if (nearly < 2) {
                img.setRGB(x, y, Color.WHITE.getRGB());
            }
            /*
            if (horizontal < 1 && vertical > 0) {
            img.setRGB(x, y, Color.WHITE.getRGB());
            }
            if (horizontal > 0 && vertical < 1) {
            img.setRGB(x, y, Color.WHITE.getRGB());
            }
            */

            /*
            if (isWhite(img.getRGB(x, y), whiteThreshold) == 1) {
            img.setRGB(x, y, Color.WHITE.getRGB());
            } else {
            img.setRGB(x, y, Color.BLACK.getRGB());
            }
                    
                    
            if (getColorBright(img.getRGB(x, y)) < 100) {
            int count = isBlack(img.getRGB(x - 1, y), blackThreshold) + isBlack(img.getRGB(x + 1, y), blackThreshold) + isBlack(img.getRGB(x, y - 1), blackThreshold) + isBlack(img.getRGB(x, y + 1), blackThreshold) + isBlack(img.getRGB(x + 1, y + 1), blackThreshold) + isBlack(img.getRGB(x - 1, y - 1), blackThreshold) + isBlack(img.getRGB(x + 1, y -1 ), blackThreshold) + isBlack(img.getRGB(x - 1, y + 1), blackThreshold);
            System.out.println(count);
            if (count < 2) {
                img.setRGB(x, y, Color.WHITE.getRGB());
            }
            //     img.setRGB(x, y, Color.WHITE.getRGB());
            }
            */

            //                if(getColorBright(img.getRGB(x, y)) > 600) {
            //                    img.setRGB(x, y, Color.WHITE.getRGB());
            //                } else {
            //                    /*
            //                    // ?Graphics2D
            //                    Graphics2D g2d = img.createGraphics();
            //                    // ?
            //                    // 1.0f? 0-1.0????
            //                    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f));
            //                    // 
            //                    g2d.setColor(new Color(255,0,0));
            //                    g2d.setStroke(new BasicStroke(1));
            //                    // g2d.draw
            //                    // 
            //                    // ? ?
            //                    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
            //                    g2d.dispose();
            //                    */
            //
            //                    img.setRGB(x, y, Color.BLACK.getRGB());
            //                    /*
            //                    System.out.println(getColorBright(img.getRGB(x, y)) + ":");
            //                    System.out.println(getColorBright(img.getRGB(x + 1, y)) + "-" + getColorBright(img.getRGB(x + 1, y + 1)) + "-" + getColorBright(img.getRGB(x, y + 1)));
            //                    System.out.println(getColorBright(img.getRGB(x - 1, y)) + "-" + getColorBright(img.getRGB(x - 1, y - 1)) + "-" + getColorBright(img.getRGB(x, y - 1)));
            //                    System.out.println(getColorBright(img.getRGB(x - 1, y + 1)) + "-" + getColorBright(img.getRGB(x + 1, y - 1)));
            //                    */
            //
            //                    /*
            //                    int i = 0;
            //                    i = ((x < width - 1) && getColorBright(img.getRGB(x + 1, y)) < 30)? i + 1 : i;
            //                    i = ((x < width - 1) && (y < height - 1) && getColorBright(img.getRGB(x + 1, y + 1)) < 30)? i + 1 : i;
            //                    i = ((y < height - 1) && getColorBright(img.getRGB(x, y + 1)) < 30)? i + 1 : i;
            //                    i = ((x > 0) && getColorBright(img.getRGB(x - 1, y)) < 30)? i + 1 : i;
            //                    i = ((x > 0) && (y > 0) && getColorBright(img.getRGB(x - 1, y - 1)) < 30)? i + 1 : i;
            //                    i = ((y > 0) && getColorBright(img.getRGB(x, y - 1)) < 30)? i + 1 : i;
            //                    i = ((x < width - 1) && (y > 0) && getColorBright(img.getRGB(x + 1, y - 1)) < 30)? i + 1 : i;
            //                    i = ((x > 0) && (y < height - 1) && getColorBright(img.getRGB(x - 1, y + 1)) < 30)? i + 1 : i;
            //
            //                    if(i > 1) {
            //                        img.setRGB(x, y, Color.BLACK.getRGB());
            //                    } else {
            //                        img.setRGB(x, y, Color.WHITE.getRGB());
            //                    }
            //                    */
            //                }

            /*
            int i = 0;
            i = (getColorBright(img.getRGB(x + 1, y)) == 0)? i + 1 : i;
            i = (getColorBright(img.getRGB(x + 1, y + 1)) == 0)? i + 1 : i;
            i = (getColorBright(img.getRGB(x, y + 1)) == 0)? i + 1 : i;
            i = (getColorBright(img.getRGB(x - 1, y)) == 0)? i + 1 : i;
            i = (getColorBright(img.getRGB(x - 1, y - 1)) == 0)? i + 1 : i;
            i = (getColorBright(img.getRGB(x, y - 1)) == 0)? i + 1 : i;
                    
            System.out.println(getColorBright(img.getRGB(x, y)) + ":");
            System.out.println(getColorBright(img.getRGB(x + 1, y)) + "-" + getColorBright(img.getRGB(x + 1, y + 1)) + "-" + getColorBright(img.getRGB(x, y + 1)));
            System.out.println(getColorBright(img.getRGB(x - 1, y)) + "-" + getColorBright(img.getRGB(x - 1, y - 1)) + "-" + getColorBright(img.getRGB(x, y - 1)));
            System.out.println(getColorBright(img.getRGB(x - 1, y + 1)) + "-" + getColorBright(img.getRGB(x + 1, y - 1)));
            if(getColorBright(img.getRGB(x, y)) == 0 &&  i < 3) {
            img.setRGB(x, y, Color.WHITE.getRGB());
            }
            */

            /*
            // ?for????
            // ??object
            Object data = img.getRaster().getDataElements(x, y, null);
            int red = img.getColorModel().getRed(data);
            int blue = img.getColorModel().getBlue(data);
            int green = img.getColorModel().getGreen(data);
            System.out.println((red + blue + green) + "-" + getColorBright(img.getRGB(x, y)));
            red = (red * 3 + green * 6 + blue * 1)/10;
            green = red;
            blue = green;
                    
            // r?g?b?rgbbufferedImage????rgbrgb8388608?255*255*255?16777216
            int rgb = (red * 256 + green) * 256 + blue;
            if(rgb > 8388608) {
            rgb = rgb - 16777216;
            }
            // rgb
            img.setRGB(x, y, rgb);
            */

        }
    }
    // img = img.getSubimage(1, 1, img.getWidth() - 2, img.getHeight() - 2);
    return img;
}

From source file:com.js.quickestquail.ui.stats.CountryStat.java

private JFreeChart generateChart() {
    JFreeChart chart = ChartFactory.createPieChart(
            java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.country.title"), // chart title 
            generateDataset(), // data    
            true, // include legend   
            true, false);/*from  w  ww.  j a  v  a2s  . c  o  m*/
    chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0));
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    return chart;
}

From source file:Main.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */// ww  w . j ava 2 s .  com
private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("MenuLayoutDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    Main demo = new Main();
    Container contentPane = frame.getContentPane();
    contentPane.setBackground(Color.WHITE); // contrasting bg
    contentPane.add(demo.createMenuBar(), BorderLayout.LINE_START);

    // Display the window.
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:edu.mit.fss.tutorial.part4.ControlPanel.java

/**
 * Instantiates a new control panel.// w w w .j  a  v a2  s  . c om
 */
public ControlPanel() {
    setFocusable(true); // required for key listener
    setPreferredSize(new Dimension(300, 300));
    setBackground(Color.white);

    // Add a new KeyAdapter object instance to bind actions to key presses.
    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (boundElement == null) {
                // Do nothing if no element is bound.
                return;
            }
            if (e.getKeyCode() == KeyEvent.VK_UP) {
                // Increment Y-velocity.
                boundElement.setVelocity(boundElement.getVelocity().add(new Vector3D(0, 1, 0)));
            } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
                // Decrement Y-velocity.
                boundElement.setVelocity(boundElement.getVelocity().add(new Vector3D(0, -1, 0)));
            } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
                // Decrement X-velocity.
                boundElement.setVelocity(boundElement.getVelocity().add(new Vector3D(-1, 0, 0)));
            } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
                // Increment X-velocity.
                boundElement.setVelocity(boundElement.getVelocity().add(new Vector3D(1, 0, 0)));
            }
        }
    });
}