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

public MyCanvas() {
    setBackground(Color.white);
    addMouseMotionListener(this);
    addMouseListener(this);
}

From source file:de.fub.maps.project.plugins.tasks.eval.heading.HeadingHistogramm.java

/**
 * Creates new form HeadingHistogramm/*from  www .  j  a  va  2  s  .c o  m*/
 */
public HeadingHistogramm() {
    initComponents();
    barChart = ChartFactory.createXYBarChart(null, "Degree", false, null, dataset, PlotOrientation.VERTICAL,
            true, true, true);
    barChart.setBackgroundPaint(Color.WHITE);
    barChart.getPlot().setBackgroundPaint(Color.WHITE);
    XYBarRenderer barRenderer = new XYBarRenderer(.05);
    barRenderer.setShadowVisible(false);
    barRenderer.setBarPainter(new StandardXYBarPainter());
    barRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    barChart.getXYPlot().setRenderer(barRenderer);
    chartpanel = new ChartPanel(barChart, false);
    add(chartpanel, BorderLayout.CENTER);
}

From source file:statistic.graph.XYChart.java

public XYChart(String title, String xAxisLabel, String yAxis, XYSeriesCollection collection, boolean linear) {
    super(title, JFreeChart.DEFAULT_TITLE_FONT, new XYPlot(), true);
    this.collection = collection;
    setBackgroundPaint(Color.WHITE);
    setTitle(title);//w  w  w.j  av a 2s  . co m
    plot = (XYPlot) getPlot();
    plot.setDataset(collection);
    if (linear) {
        plot.setRenderer(new DefaultXYItemRenderer());
    } else {
        plot.setRenderer(new XYStepRenderer());
    }
    plot.setOrientation(PlotOrientation.VERTICAL);
    initXAxis(xAxisLabel);
    plot.setRangeAxis(new NumberAxis(yAxis));
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
}

From source file:richclient.EvolutionChart.java

/**
 * Creates a chart.//from   w  w w .  j a v a2s.co  m
 *
 * @param dataset the data for the chart.
 *
 * @return a chart.
 */
public JFreeChart createChart(XYDataset dataset) {

    // create the chart
    final JFreeChart chart = ChartFactory.createXYLineChart("Market evolution", // chart title
            "Time", // x axis label
            "Value", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setDisplaySeriesShapes(true);
    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, true);
    renderer.setSeriesShapesVisible(1, true);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:include.picture.MyBarChart.java

/**
*?
*//*from   w ww.  java 2  s  . c om*/
public void paint() {
    try {
        check();
        CategoryDataset dataset = getDataSet(series, category, data);
        JFreeChart chart = ChartFactory.createBarChart3D(title, axisXLabel, axisYLabel, dataset,
                PlotOrientation.VERTICAL, true, false, false);
        chart.setBackgroundPaint(Color.WHITE);
        BarRenderer3D renderer = new BarRenderer3D();
        CategoryPlot plot = chart.getCategoryPlot();
        renderer.setMaxBarWidth(0.01);
        renderer.setBaseOutlinePaint(Color.BLACK);
        renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setItemLabelFont(new Font("", Font.PLAIN, 15));
        renderer.setItemLabelsVisible(true);
        renderer.setItemMargin(0.1);
        plot.setRenderer(renderer);
        FileOutputStream fos_jpg = null;
        try {
            fos_jpg = new FileOutputStream(fileName);
            ChartUtilities.writeChartAsJPEG(fos_jpg, 1000, chart, width, height, null);
        } finally {
            try {
                fos_jpg.close();
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    } // end of try-catch

}

From source file:org.matsim.contrib.dvrp.util.chart.RouteChartUtils.java

public static JFreeChart chartRoutes(List<? extends Vehicle> vehicles) {
    CoordDataset lData = new CoordDataset();

    for (int i = 0; i < vehicles.size(); i++) {
        Schedule<?> schedule = vehicles.get(i).getSchedule();
        lData.addSeries(Integer.toString(i), LinkSources.createLinkSource(schedule));
    }/*from  w ww . j a  v  a2 s .c  o m*/

    JFreeChart chart = ChartFactory.createXYLineChart("Routes", "X", "Y", lData, PlotOrientation.VERTICAL, true,
            true, false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setBackgroundPaint(Color.white);

    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setAutoRangeIncludesZero(false);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesShapesVisible(0, true);
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesItemLabelsVisible(0, true);

    renderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() {
        public String generateLabel(XYDataset dataset, int series, int item) {
            return ((CoordDataset) dataset).getText(series, item);
        }
    });

    for (int i = 1; i <= vehicles.size(); i++) {
        renderer.setSeriesShapesVisible(i, true);
        renderer.setSeriesLinesVisible(i, true);
        renderer.setSeriesItemLabelsVisible(i, true);
    }

    return chart;
}

From source file:AntiAlias.java

/** Draw the example */
public void paint(Graphics g1) {
    Graphics2D g = (Graphics2D) g1;
    BufferedImage image = // Create an off-screen image
            new BufferedImage(65, 35, BufferedImage.TYPE_INT_RGB);
    Graphics2D ig = image.createGraphics(); // Get its Graphics for drawing

    // Set the background to a gradient fill. The varying color of
    // the background helps to demonstrate the anti-aliasing effect
    ig.setPaint(new GradientPaint(0, 0, Color.black, 65, 35, Color.white));
    ig.fillRect(0, 0, 65, 35);// w ww  .jav a 2s . com

    // Set drawing attributes for the foreground.
    // Most importantly, turn on anti-aliasing.
    ig.setStroke(new BasicStroke(2.0f)); // 2-pixel lines
    ig.setFont(new Font("Serif", Font.BOLD, 18)); // 18-point font
    ig.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias!
            RenderingHints.VALUE_ANTIALIAS_ON);

    // Now draw pure blue text and a pure red oval
    ig.setColor(Color.blue);
    ig.drawString("Java", 9, 22);
    ig.setColor(Color.red);
    ig.drawOval(1, 1, 62, 32);

    // Finally, scale the image by a factor of 10 and display it
    // in the window. This will allow us to see the anti-aliased pixels
    g.drawImage(image, AffineTransform.getScaleInstance(10, 10), this);

    // Draw the image one more time at its original size, for comparison
    g.drawImage(image, 0, 0, this);
}

From source file:bullioneconomy.bullionchart.java

/**
 * Creates a chart./*  ww  w . j  a v  a2 s.c o  m*/
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Gold Price in Recent Years", // title
            "Date", // x-axis label
            "Price Per 10g", // y-axis label
            dataset, // data
            true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        //renderer.setDefaultShapesVisible(true);
        //renderer.setDefaultShapesFilled(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));

    return chart;

}

From source file:com.mirth.connect.manager.HeapSizeDialog.java

public HeapSizeDialog(String heapSize) {
    super(PlatformUI.MANAGER_DIALOG, true);

    managerController = ManagerController.getInstance();
    getRootPane().registerKeyboardAction(new ActionListener() {
        @Override//from  w ww .  j  av a 2  s . c o  m
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);

    setResizable(false);
    setBackground(Color.white);
    setTitle("Web Start Settings");
    getContentPane().setBackground(Color.white);

    initComponents();

    this.heapSize = StringUtils.isEmpty(heapSize) ? "512m" : heapSize;

    String heapSizeOption = HeapSize.toDisplayName(heapSize);
    if (StringUtils.isBlank(heapSizeOption)) {
        heapSizeOption = this.heapSize;
    }

    // Add any non-default properties to the model
    String property = (String) managerController.getServerProperties()
            .getProperty(ManagerConstants.ADMINISTRATOR_MAX_HEAP_SIZE);
    if (!heapSizeComboboxModel.contains(property)
            && !heapSizeComboboxModel.contains(HeapSize.toDisplayName(property))) {
        heapSizeComboboxModel.add(formatCustomProperty(property));
    }

    // Resort list by sizes
    List<String> mbList = new ArrayList<String>();
    List<String> gbList = new ArrayList<String>();
    for (String size : heapSizeComboboxModel) {
        if (size.contains("M")) {
            mbList.add(size);
        } else {
            gbList.add(size);
        }
    }

    Collections.sort(mbList);
    Collections.sort(gbList);
    mbList.addAll(gbList);

    heapSizeComboBox = new JComboBox(mbList.toArray());
    heapSizeComboBox.getModel().setSelectedItem(formatCustomProperty(heapSizeOption));

    initLayout();
    pack();
    setLocationRelativeTo(PlatformUI.MANAGER_DIALOG);
    setVisible(true);
}

From source file:clienteProfessor.ClickerOne_Resultados.java

public ClickerOne_Resultados(ClickerOne_Cliente cliente) {
    this.cliente = cliente;
    initComponents();//w w  w  . j ava 2  s .  co m
    listaDeAula = aula.AulasDeUmProfessor(this.cliente.get_RA());
    for (ClickerOne_Aula Aux : listaDeAula) {
        ClickerOne_Aula cadaAula = (ClickerOne_Aula) Aux;
        if (!aux.equals(cadaAula.get_nomeAula())) {
            jComboBoxAulas.addItem(cadaAula.get_nomeAula());
            aux = cadaAula.get_nomeAula();
        }
    }
    this.setTitle("Resultados da aula: " + jComboBoxAulas.getSelectedItem());
    jPanel1.setBackground(Color.WHITE);
}