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:sanger.team16.gui.genevar.eqtl.query.SNPGeneAssocPlot.java

public SNPGeneAssocPlot(List<Tuple> tuples, double max, double min) throws ArrayIndexOutOfBoundsException {
    JPanel mainPanel = new JPanel(new GridLayout(0, 3));
    mainPanel.setBackground(Color.white);

    int size = tuples.size();
    for (int i = 0; i < size; i++) {
        Tuple tuple = tuples.get(i);/*from  w w w  .  j  a v a  2 s  . co m*/
        String populationName = tuple.populationName;

        // if (trait.expressionRanks != null) {   // BUG FIXED 02/02/10
        if (tuple.phenotypes != null && tuple.phenotypes.length != 0) {
            CategoryDataset dataset = this.createDataset(tuple);
            JFreeChart chart = createChart(populationName, dataset, max, min);
            chart.setBackgroundPaint(Color.white);

            TextTitle textTitle = new TextTitle(tuple.subtitle);
            textTitle.setFont(new Font("SansSerif", Font.PLAIN, 12));
            //subtitle1.setPosition(RectangleEdge.BOTTOM);
            textTitle.setHorizontalAlignment(HorizontalAlignment.CENTER);
            chart.addSubtitle(textTitle);

            ChartPanel chartPanel = new ChartPanel(chart);
            chartPanel.setPreferredSize(this.getAutoPreferredSize()); // Original Dimension(680, 420)
            mainPanel.add(chartPanel);

        } else {
            BaseJPane empty = new BaseJPane(2, 50, 0, 0);
            empty.setPreferredSize(this.getAutoPreferredSize());
            BaseJPane na = new BaseJPane();
            na.setLayout(new BorderLayout());

            JLabel name = new JLabel("      " + populationName);
            name.setFont(new Font("Arial", Font.BOLD, 12));
            name.setForeground(Color.gray);
            na.add(name, BorderLayout.PAGE_START);

            JLabel message = new JLabel("Not Available");
            message.setForeground(Color.lightGray);
            na.add(message, BorderLayout.CENTER);

            empty.add(Box.createHorizontalGlue());
            empty.add(na);
            empty.add(Box.createHorizontalGlue());
            empty.setBaseSpringBox();

            mainPanel.add(empty);
        }
    }

    this.add(mainPanel);
}

From source file:edu.emory.library.tast.database.graphs.GraphTypeXY.java

public JFreeChart createChart(Object[] data) {

    CategoryTableXYDataset dataset = new CategoryTableXYDataset();

    JFreeChart chart = ChartFactory.createXYLineChart(null, getSelectedIndependentVariable().getLabel(),
            TastResource.getText("components_charts_barvalue"), dataset, PlotOrientation.VERTICAL, true, true,
            false);/* w  w w  . j  a va  2 s  .  c  om*/

    Format formatter = getSelectedIndependentVariable().getFormat();

    XYPlot plot = chart.getXYPlot();
    if (formatter != null)
        ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride((NumberFormat) formatter);

    chart.setBackgroundPaint(Color.white);

    List allDataSeries = getDataSeries();
    for (int j = 0; j < allDataSeries.size(); j++) {
        DataSeries dataSearies = (DataSeries) allDataSeries.get(j);
        String dataSeriesLabel = dataSearies.formatForDisplay();
        for (int i = 0; i < data.length; i++) {
            Object[] row = (Object[]) data[i];
            Number x = (Number) row[0];
            Number y = (Number) row[j + 1];
            if (x != null && y != null)
                dataset.add(x.doubleValue(), y.doubleValue(), dataSeriesLabel);
        }
    }

    LegendItemCollection legendItems = chart.getPlot().getLegendItems();
    for (int i = 0; i < legendItems.getItemCount(); i++) {
        LegendItem legendItem = legendItems.get(i);
        DataSeries dataSearies = (DataSeries) allDataSeries.get(i);
        if (legendItem.getFillPaint() instanceof Color) {
            dataSearies.setColor(((Color) legendItem.getFillPaint()));
        }
    }

    return chart;

}

From source file:org.sakaiproject.evaluation.tool.reporting.EvalLikertChartBuilder.java

@SuppressWarnings("deprecation")
public JFreeChart makeLikertChart() {

    DefaultCategoryDataset likertDataset = new DefaultCategoryDataset();

    for (int i = 0; i < responses.length; i++) {
        likertDataset.addValue(values[i], "Responses", responses[i]);
    }//from   ww  w .  j  a v a2  s . c o m

    JFreeChart chart = ChartFactory.createBarChart(null, // "Likert Chart", // Chart title
            null, // "Choices", // domain axis label
            null, // "# of Responses", // range axis label
            likertDataset, PlotOrientation.HORIZONTAL, false, // show legend
            false, // show tooltips
            false // show URLs
    );

    // Set the background colours
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);

    // Configure the bar colors and display
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, new Color(244, 252, 212));
    renderer.setDrawBarOutline(true);
    renderer.setOutlinePaint(new Color(34, 35, 237));
    renderer.setOutlineStroke(new BasicStroke(0.5f));
    renderer.setBaseItemLabelsVisible(true);
    if (showPercentages) {
        renderer.setBaseItemLabelGenerator(new LikertPercentageItemLabelGenerator(this.responseCount));
    } else {
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    }
    // Turn off the Top Value Axis
    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setVisible(false);
    rangeAxis.setUpperMargin(0.35);
    rangeAxis.resizeRange(1.1f);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setMaximumCategoryLabelWidthRatio(0.4f);
    domainAxis.setMaximumCategoryLabelLines(2);

    // Set the font for the labels
    Font labelFont = new Font("Serif", Font.PLAIN, 6);

    CategoryItemRenderer itemRenderer = plot.getRenderer();
    itemRenderer.setBaseItemLabelFont(labelFont);

    plot.setOutlinePaint(null);

    domainAxis.setLabelFont(labelFont);
    domainAxis.setTickLabelFont(labelFont);
    rangeAxis.setLabelFont(labelFont);
    rangeAxis.setTickLabelFont(labelFont);

    return chart;
}

From source file:irille.pub.verify.RandomImageServlet.java

/**
 * ???,,?16,//from   w  w w  . ja v  a 2  s. co  m
 * @param num   ??
 * @param out   ?
 * @throws IOException
 */
protected static void render(String num, boolean gif, OutputStream out) throws IOException {
    if (num.getBytes().length > 4)
        throw new IllegalArgumentException("The length of param num cannot exceed 4.");
    int width = 50;
    int height = 18;
    BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = (Graphics2D) bi.getGraphics();
    g.setColor(Color.WHITE);
    g.fillRect(0, 0, width, height);
    Font mFont = new Font("Tahoma", Font.BOLD | Font.ITALIC, 16);
    g.setFont(mFont);
    g.setColor(Color.BLACK);
    g.drawString(num, 2, 15);
    if (gif) {
        AnimatedGifEncoder e = new AnimatedGifEncoder();
        e.setTransparent(Color.WHITE);
        e.start(out);
        e.setDelay(0);
        e.addFrame(bi);
        e.finish();
    } else {
        ImageIO.write(bi, "png", out);
    }
}

From source file:org.gvsig.gui.beans.graphic.GraphicChartPanel.java

public GraphicChartPanel() {
    dataset = new XYSeriesCollection();

    createChart();/*from   ww  w  .  j  a  va2 s  .  c o  m*/

    initialize();

    Plot plot = this.jPanelChart.getChart().getPlot();
    plot.setOutlineStroke(new BasicStroke(1));
    plot.setOutlinePaint(Color.black);

    chart.setBackgroundPaint(Color.white);
    plot.setBackgroundPaint(new Color(245, 245, 245));
}

From source file:com.MainChart.java

public MainChart(String applicationTitle, String chartTitle) throws IOException {
    super(applicationTitle);
    this.multiHashtable = new Hashtable<>();
    // This will create the dataset 
    // PieDataset dataset = createDataset();
    // based on the dataset we create the chart
    final JFreeChart chart = ChartFactory.createBarChart("GPA Analysis By Country", // chart title
            "Country", // domain axis label
            "GPA", // range axis label
            createDataset(), // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );/*from   ww  w .  j av  a 2 s  . c om*/

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

    plot.setBackgroundPaint(SystemColor.inactiveCaption);//change background color

    //set  bar chart color

    //CategoryItemRenderer renderer = new CustomRenderer(); 
    //plot.setRenderer(renderer);
    // we put the chart into a panel
    ChartPanel chartPanel = new ChartPanel(chart);
    // default size
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    // add it to our application
    setContentPane(chartPanel);

}

From source file:UserInterface.Doctor.DoctorWorkAreaJPanel.java

/**
 * Creates new form DoctorDroneJPanel//from www .j ava  2s. com
 */
public DoctorWorkAreaJPanel(JPanel userProcessContainer, UserAccount account, Organization organization,
        Enterprise enterprise, QuickAssist system) {
    initComponents();
    this.setBackground(Color.white);
    this.userProcessContainer = userProcessContainer;
    this.account = account;
    this.organization = organization;
    setStatus();

    for (Organization org : enterprise.getOrganizationDirectory().getOrganizationList()) {
        if (org instanceof DoctorOrganization) {
            doctorOrganization = (DoctorOrganization) org;
        }
    }

    populateTable();

}

From source file:com.haskins.cloudtrailviewer.utils.ChartFactory.java

private static ChartPanel createPieChart(String type, List<Entry<String, Integer>> events, int width,
        int height) {

    DefaultPieDataset dataset = new DefaultPieDataset();

    for (Map.Entry<String, Integer> event : events) {
        dataset.setValue(event.getKey(), event.getValue());
    }// w w  w  .  j a  va 2  s . c om

    JFreeChart jFChart;
    if (type.contains("3d")) {
        jFChart = org.jfree.chart.ChartFactory.createPieChart3D("", dataset, false, true, false);
    } else {
        jFChart = org.jfree.chart.ChartFactory.createPieChart("", dataset, false, true, false);
    }

    PiePlot plot = (PiePlot) jFChart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.01);
    plot.setOutlineVisible(false);
    plot.setLabelGenerator(null);

    // use gradients and white borders for the section colours
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    TextTitle t = jFChart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setFont(new Font("Arial", Font.BOLD, 16));

    final ChartPanel jChartPanel = new ChartPanel(jFChart, width, height, width, height, width, height, false,
            false, true, true, false, true);
    jChartPanel.setMinimumDrawWidth(0);
    jChartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
    jChartPanel.setMinimumDrawHeight(0);
    jChartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);

    return jChartPanel;
}

From source file:de.mprengemann.intellij.plugin.androidicons.util.ImageUtils.java

public static void updateImage(JLabel imageContainer, File imageFile, Format format) {
    if (imageFile == null || !imageFile.exists()) {
        return;/*w  ww.  j  av  a2s.com*/
    }
    BufferedImage img = null;
    try {
        img = ImageIO.read(imageFile);
    } catch (IOException e) {
        e.printStackTrace();
    }
    if (img == null) {
        return;
    }
    int imageWidth = img.getWidth();
    int imageHeight = img.getHeight();
    int imageViewWidth = (int) imageContainer.getPreferredSize().getWidth();
    int imageViewHeight = (int) imageContainer.getPreferredSize().getHeight();
    double factor = getScaleFactorToFit(new Dimension(imageWidth, imageHeight),
            new Dimension(imageViewWidth, imageViewHeight));
    imageWidth = (int) (factor * imageWidth);
    imageHeight = (int) (factor * imageHeight);
    if (imageWidth <= 0 || imageHeight <= 0 || imageViewWidth <= 0 || imageViewHeight <= 0) {
        return;
    }
    BufferedImage tmp = UIUtil.createImage(imageViewWidth, imageViewHeight, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = tmp.createGraphics();
    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    int x = (imageViewWidth - imageWidth) / 2;
    int y = (imageViewHeight - imageHeight) / 2;
    if (format == Format.PNG || format == Format.XML) {
        g2.drawImage(img, x, y, imageWidth, imageHeight, null);
    } else {
        g2.drawImage(img, x, y, imageWidth, imageHeight, Color.WHITE, null);
    }
    g2.dispose();
    imageContainer.setIcon(new ImageIcon(tmp));
}

From source file:MenuLayoutDemo.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///from  www  .j a v  a2 s .c o  m
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.
    MenuLayoutDemo demo = new MenuLayoutDemo();
    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);
}