Example usage for java.awt Color gray

List of usage examples for java.awt Color gray

Introduction

In this page you can find the example usage for java.awt Color gray.

Prototype

Color gray

To view the source code for java.awt Color gray.

Click Source Link

Document

The color gray.

Usage

From source file:it.illinois.adsc.ema.softgrid.monitoring.ui.SPMainFrame.java

private void setupGUI() throws Exception {
    this.getContentPane().setLayout(new GridBagLayout());
    chartPanel = getChartPanel();/*from ww  w  . j  a  va 2s . c om*/
    this.setPreferredSize(new Dimension(800, 700));

    alertPanel.setPreferredSize(new Dimension(200, 700));
    alertPanel.setMinimumSize(new Dimension(200, 700));
    alertPanel.setMaximumSize(new Dimension(200, 700));

    transientPanel.setPreferredSize(new Dimension(200, 700));
    transientPanel.setMinimumSize(new Dimension(200, 700));
    transientPanel.setMaximumSize(new Dimension(200, 700));

    queryTextArea.setPreferredSize(new Dimension(300, 100));
    queryTextArea.setMinimumSize(new Dimension(300, 100));
    queryTextArea.setMaximumSize(new Dimension(300, 100));

    monitorButton.setPreferredSize(new Dimension(30, 30));
    monitorButton.setMinimumSize(new Dimension(30, 30));
    monitorButton.setMaximumSize(new Dimension(30, 30));
    monitorButton.setToolTipText("Execute and Monitor");

    exitButton.setPreferredSize(new Dimension(30, 30));
    exitButton.setMinimumSize(new Dimension(30, 30));
    exitButton.setMaximumSize(new Dimension(30, 30));
    exitButton.setToolTipText("Close and Exit");

    clearButton.setPreferredSize(new Dimension(30, 30));
    clearButton.setMinimumSize(new Dimension(30, 30));
    clearButton.setMaximumSize(new Dimension(30, 30));
    clearButton.setToolTipText("Reset");

    runButton.setPreferredSize(new Dimension(30, 30));
    runButton.setMinimumSize(new Dimension(30, 30));
    runButton.setMaximumSize(new Dimension(30, 30));
    runButton.setToolTipText("Initialize the server...!");

    alertPanel.setLayout(new VerticalFlowLayout());
    transientPanel.setLayout(new BorderLayout());
    //      System.out.println("new File(\"../MonitorEngine/Images/execute-xxl.png\").exists() = " + new File("../MonitorEngine/Images/execute-xxl.png").exists());
    //      System.out.println("execute-xxl.png = " + new File("execute-xxl.png").exists());
    //      System.out.println("new File().getAbsolutePath() = " + new File("openmuc.jar").getAbsolutePath());
    Image img = new ImageIcon(ImageIO.read(getClass().getClassLoader().getResourceAsStream("execute-xxl.png")))
            .getImage();
    Image newimg = img.getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
    ImageIcon icon = new ImageIcon(newimg);
    monitorButton.setIcon(icon);

    img = new ImageIcon(ImageIO.read(getClass().getClassLoader().getResourceAsStream("stop-xxl.png")))
            .getImage();
    newimg = img.getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
    icon = new ImageIcon(newimg);
    exitButton.setIcon(icon);

    img = new ImageIcon(ImageIO.read(getClass().getClassLoader().getResourceAsStream("reset-xxl.png")))
            .getImage();
    newimg = img.getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
    icon = new ImageIcon(newimg);
    clearButton.setIcon(icon);

    img = new ImageIcon(ImageIO.read(getClass().getClassLoader().getResourceAsStream("start-xxl.png")))
            .getImage();
    newimg = img.getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
    icon = new ImageIcon(newimg);
    runButton.setIcon(icon);
    altertScrolPane.getViewport().add(alertPanel, null);
    altertScrolPane.setBorder(BorderFactory.createEtchedBorder());
    logAreaScrollPane.getViewport().add(logTextArea, null);
    logAreaScrollPane.setBorder(BorderFactory.createEtchedBorder());

    JPanel tempQueryPanel = new JPanel();
    JPanel buttonPanel = new JPanel();
    //      tempQueryPanel.setBorder(BorderFactory.createTitledBorder("Monitor Query"));
    tempQueryPanel.setLayout(new GridBagLayout());
    buttonPanel.setLayout(new GridBagLayout());
    buttonPanel.setBorder(BorderFactory.createEtchedBorder());
    buttonPanel.setOpaque(true);
    buttonPanel.setBackground(Color.gray);
    buttonPanel.add(runButton, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(6, 12, 3, 12), 0, 0));
    buttonPanel.add(monitorButton, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(3, 12, 3, 12), 0, 0));
    buttonPanel.add(clearButton, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(3, 12, 3, 12), 0, 0));
    buttonPanel.add(exitButton, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(3, 12, 3, 12), 0, 0));
    //      tempQueryPanel.add(splitPane, new GridBagConstraints(0, 0, 1, 6, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    tempQueryPanel.add(buttonPanel, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.CENTER,
            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    tempQueryPanel.add(queryScrolPane, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    mainTabbedPane.add(splitPane, "Controller");

    mainTabbedPane.add(ConfigPanel.getInstance(), "Configuration");

    splitPane.setTopComponent(tempQueryPanel);
    splitPane.setDividerLocation(152);
    splitPane.setBottomComponent(resultTabbedPane);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.getContentPane().add(mainTabbedPane, new GridBagConstraints(0, 0, 1, 2, 0.75, 0.25,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(12, 12, 12, 0), 0, 0));
    //      this.getContentPane().add(alertTitile, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(12, 0, 0, 12), 0, 0));
    //      this.getContentPane().add(altertScrolPane, new GridBagConstraints(1, 1, 1, 2, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 12, 12), 0, 0));
    //      tempQueryPanel.add(queryScrolPane, new GridBagConstraints(0, 0, 1, 5, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //      this.getContentPane().add(logAreaScrollPane, new GridBagConstraints(0, 2, 1, 1, 0.75, 0.75, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(12, 12, 12, 0), 0, 0));
    exitButton.addActionListener(this);
    monitorButton.addActionListener(this);
    clearButton.addActionListener(this);
    clearButton.setEnabled(false);
    clearButton.setVisible(false);
    monitorButton.setEnabled(true);
    runButton.addActionListener(this);
    queryTextArea.setContentType("text/html");
    queryTextArea.setText("select overloadrank from virtual");

    messageHandler = new MessageUIHandler(logTextArea, logAreaScrollPane);
    ConfigPanel.getInstance().setupConfigPanel();
}

From source file:eu.europa.esig.dss.applet.util.ComponentFactory.java

/**
 * @param currentStep/* ww w .  ja  v a2  s  . c  o m*/
 * @param maxStep
 * @return
 */
public static JPanel createWizardStepPanel(final int currentStep, final int maxStep) {

    final List<String> colSpecs = new ArrayList<String>();

    for (int i = 1; i <= maxStep; i++) {
        colSpecs.add("default:grow");
    }

    final FormLayout layout = new FormLayout(StringUtils.join(colSpecs, ","), "pref");
    final PanelBuilder builder = ComponentFactory.createBuilder(layout);
    final CellConstraints cc = new CellConstraints();

    for (int i = 1; i <= maxStep; i++) {
        final JPanel subPanel = ComponentFactory
                .createPanel(i == currentStep ? DEFAULT_HIGHLIGHT : DEFAULT_BACKGROUND);
        subPanel.add(ComponentFactory.createLabel(String.valueOf(i)));

        final Border border = (i != maxStep) ? BorderFactory.createMatteBorder(0, 1, 0, 0, Color.GRAY)
                : BorderFactory.createMatteBorder(0, 1, 0, 1, Color.GRAY);
        subPanel.setBorder(border);
        builder.add(subPanel, cc.xy(i, 1));
    }

    final JPanel panel = ComponentFactory.createPanel(builder);
    panel.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.GRAY));
    return panel;
}

From source file:com.ctsim.dmi.MainFrame.java

private void initGraphics() {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    if (App.isTurnOn) {
        g2.drawImage(speedoDial, 100, 50, this);

        t2 = Calendar.getInstance();
        if (t2.getTimeInMillis() - t1.getTimeInMillis() > 300) {
            isFlashOn = !isFlashOn;/*from w  w w  .jav a  2s.c om*/
            t1 = Calendar.getInstance();
        }

        drawBrake();
        drawTargetDestance();
        drawPin();
        drawATOStatus();
        drawAtenna();
        drawATPStatus();
        drawDoorIndicator();
        drawCeillingSpeed();
        drawDoorStatus();
        drawScroll();
        drawSkipStop();
        drawID();
        drawButtons();
        drawTime();

        drawColorBar();

        g2.setColor(Color.GRAY);
        g2.setFont(new Font("Loma", Font.PLAIN, 12));
        g2.drawString("(" + x + ", " + y + ")", 20, 20);

        //operationLoop();
    }
}

From source file:be.nbb.demetra.dfm.output.simulation.RealTimePerspGraphView.java

private void showDetail(Graphs g) {
    XYPlot plot = detailChart.getXYPlot();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelPaint(Color.GRAY);
    plot.setRangeAxis(yAxis);//from  w w w.  java 2  s.  c o m

    NumberAxis xAxis = new NumberAxis();
    xAxis.setTickLabelPaint(Color.GRAY);
    xAxis.setTickUnit(new NumberTickUnit(10));
    xAxis.setRange(horizons.get(0), horizons.get(horizons.size() - 1));
    xAxis.setVerticalTickLabels(true);
    plot.setDomainAxis(xAxis);

    plot.setDataset(TRUE_DATA_INDEX, new BasicXYDataset(Collections.singletonList(g.S1_)));
    plot.setDataset(FCTS_INDEX, new BasicXYDataset(Collections.singletonList(g.S2_)));
    plot.setDataset(ARIMA_DATA_INDEX, new BasicXYDataset(Collections.singletonList(g.S3_)));

    rescaleAxis((NumberAxis) plot.getRangeAxis());

    detailChart.setTitle(g.label_);
    chartPanel.setChart(detailChart);
    chartPanel.setToolTipText("Right click to show complete data");
    chartPanel.setPopupMenu(buildMenu().getPopupMenu());
    onColorSchemeChanged();

    selectedGraph = g;
}

From source file:edu.ucla.stat.SOCR.chart.demo.EventFrequencyDemo1.java

public void resetExample() {

    dataset = createDataset(true);/*from   ww w  . j a  v  a  2 s.  c o m*/

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);

    //      setSummary(dataset);
    setChart();

    hasExample = true;
    convertor.dataset2Table(dataset);
    JTable tempDataTable = convertor.getTable();
    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount() + 1);

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    DecimalFormat f = new DecimalFormat("#.#E0");
    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            if (j != 0) {
                try {
                    long time = f.parse((String) tempDataTable.getValueAt(i, j)).longValue();
                    Date date = new Date(time);
                    dataTable.setValueAt(new Day(date).toString(), i, j);
                } catch (ParseException e) {
                    dataTable.setValueAt("NaN", i, j);
                }
            } else
                dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }
    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    addButtonDependent();
    int columnCount = dataset.getColumnCount();
    for (int i = 0; i < columnCount; i++)
        addButtonIndependent();

    updateStatus(url);
}

From source file:com.rapidminer.gui.plotter.charts.ParallelPlotter2.java

@Override
public void updatePlotter() {
    prepareData();/*www  .j a va2  s .  co  m*/

    JFreeChart chart = createChart(this.dataset);

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // general plot settings
    XYPlot plot = chart.getXYPlot();
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

    // domain axis
    SymbolAxis axis = null;
    if (this.dataTable.isSupportingColumnWeights()) {
        List<Double> weightList = new LinkedList<>();
        for (int column = 0; column < dataTable.getNumberOfColumns(); column++) {
            if ((!dataTable.isSpecial(column)) && (column != colorColumn)) {
                weightList.add(this.dataTable.getColumnWeight(column));
            }
        }
        double[] weights = new double[weightList.size()];
        int index = 0;
        for (Double d : weightList) {
            weights[index++] = d;
        }
        axis = new WeightBasedSymbolAxis(null, domainAxisMap, weights);
    } else {
        axis = new SymbolAxis(null, domainAxisMap);
    }
    axis.setTickLabelFont(LABEL_FONT);
    axis.setLabelFont(LABEL_FONT_BOLD);

    // rotate labels
    if (isLabelRotating()) {
        axis.setTickLabelsVisible(true);
        axis.setVerticalTickLabels(true);
    }

    chart.getXYPlot().setDomainAxis(axis);

    // renderer
    final ColorizedLineAndShapeRenderer renderer = new ColorizedLineAndShapeRenderer(this.colorMap);
    plot.setRenderer(renderer);

    // legend settings
    if ((colorColumn >= 0) && (this.dataTable.isNominal(colorColumn))) {
        final LegendItemCollection legendItemCollection = new LegendItemCollection();
        for (int i = 0; i < this.dataTable.getNumberOfValues(colorColumn); i++) {
            legendItemCollection.add(new LegendItem(this.dataTable.mapIndex(colorColumn, i), null, null, null,
                    new Rectangle2D.Double(0, 0, 7, 7),
                    getColorProvider()
                            .getPointColor(i / (double) (this.dataTable.getNumberOfValues(colorColumn) - 1)),
                    new BasicStroke(0.75f), Color.GRAY));
        }
        chart.addLegend(new LegendTitle(new LegendItemSource() {

            @Override
            public LegendItemCollection getLegendItems() {
                return legendItemCollection;
            }
        }));

        LegendTitle legend = chart.getLegend();
        if (legend != null) {
            legend.setPosition(RectangleEdge.TOP);
            legend.setFrame(BlockBorder.NONE);
            legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
            legend.setItemFont(LABEL_FONT);
        }
    } else if (colorColumn >= 0) {
        chart.addLegend(new LegendTitle(new LegendItemSource() {

            @Override
            public LegendItemCollection getLegendItems() {
                LegendItemCollection itemCollection = new LegendItemCollection();
                itemCollection.add(new LegendItem("Dummy"));
                return itemCollection;
            }
        }) {

            private static final long serialVersionUID = 1288380309936848376L;

            @Override
            public Object draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area,
                    java.lang.Object params) {
                if (dataTable.isDate(colorColumn) || dataTable.isTime(colorColumn)
                        || dataTable.isDateTime(colorColumn)) {
                    drawSimpleDateLegend(g2, (int) (area.getCenterX() - 170), (int) (area.getCenterY() + 7),
                            dataTable, colorColumn, renderer.getMinColorValue(), renderer.getMaxColorValue());
                    return new BlockResult();
                } else {
                    final String minColorString = Tools.formatNumber(renderer.getMinColorValue());
                    final String maxColorString = Tools.formatNumber(renderer.getMaxColorValue());
                    drawSimpleNumericalLegend(g2, (int) (area.getCenterX() - 90), (int) (area.getCenterY() + 7),
                            dataTable.getColumnName(colorColumn), minColorString, maxColorString);
                    return new BlockResult();
                }
            }

            @Override
            public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area) {
                draw(g2, area, null);
            }

        });
    }

    // chart panel
    if (panel instanceof AbstractChartPanel) {
        panel.setChart(chart);
    } else {
        panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN);
        final ChartPanelShiftController controller = new ChartPanelShiftController(panel);
        panel.addMouseListener(controller);
        panel.addMouseMotionListener(controller);
    }

    // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
    panel.getChartRenderingInfo().setEntityCollection(null);
}

From source file:edu.cmu.sv.modelinference.eventtool.EventVisualizer.java

private static Map<EventClass, Color> assignClassColors(ClassificationResult results) {
    Color[] COLORS = { Color.GREEN, Color.RED, Color.BLACK, Color.BLUE, Color.GRAY, Color.CYAN, Color.DARK_GRAY,
            Color.MAGENTA };/*from  w w w .j  a v a  2 s .com*/
    int colorIdx = 0;
    Map<EventClass, Color> cluster2Color = new HashMap<>();
    for (EventClass cl : results.getEventClasses()) {
        cluster2Color.put(cl, COLORS[colorIdx % COLORS.length]);
        colorIdx++;
    }
    return cluster2Color;
}

From source file:com.haskins.cloudtrailviewer.feature.MetricsFeature.java

private void showChart(String service) {

    final TimeSeriesCollection chartData = generateTimeSeriesData(service);

    JFreeChart chart = ChartFactory.createTimeSeriesChart(service, "Time", "Calls", chartData, false, true,
            false);//from   w ww .j a v a2 s  . c  o  m

    // draw outter line
    XYLineAndShapeRenderer lineAndShapeRenderer = new XYLineAndShapeRenderer();
    lineAndShapeRenderer.setPaint(new Color(64, 168, 228, 75));
    lineAndShapeRenderer.setSeriesShape(0, new Ellipse2D.Double(-3, -3, 6, 6));
    lineAndShapeRenderer.setSeriesShapesFilled(0, true);
    lineAndShapeRenderer.setSeriesShapesVisible(0, true);
    lineAndShapeRenderer.setUseOutlinePaint(true);
    lineAndShapeRenderer.setUseFillPaint(true);

    // draw filled area
    XYAreaRenderer renderer = new XYAreaRenderer();
    renderer.setPaint(new Color(64, 168, 228, 50));

    // configure Plot
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlineVisible(false);

    plot.setDataset(0, chartData);
    plot.setDataset(1, chartData);

    plot.setRenderer(0, lineAndShapeRenderer);
    plot.setRenderer(1, renderer);

    plot.getDomainAxis().setLowerMargin(0);
    plot.getDomainAxis().setUpperMargin(0);

    // format chart title
    TextTitle t = chart.getTitle();
    t.setFont(new Font("Arial", Font.BOLD, 14));

    // Cross Hairs
    xCrosshair = new Crosshair(Double.NaN, Color.GRAY, new BasicStroke(0f));
    xCrosshair.setLabelVisible(true);
    xCrosshair.setLabelGenerator(new DateTimeCrosshairLabelGenerator());

    CrosshairOverlay crosshairOverlay = new CrosshairOverlay();
    crosshairOverlay.addDomainCrosshair(xCrosshair);

    // Create the panel
    chartPanel = new ChartPanel(chart);
    chartPanel.setMinimumDrawWidth(0);
    chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
    chartPanel.setMinimumDrawHeight(0);
    chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
    chartPanel.setMouseZoomable(true, false);
    chartPanel.setDomainZoomable(true);
    chartPanel.setRangeZoomable(false);
    chartPanel.addChartMouseListener(this);
    chartPanel.addOverlay(crosshairOverlay);

    // update the display
    chartCards.removeAll();
    chartCards.add(chartPanel, "");
    chartCards.revalidate();
}

From source file:de.mpg.escidoc.pubman.statistic_charts.StatisticChartServlet.java

/**
 * Creates the statistic chart./*from  ww w. j  a v a2s  .c o m*/
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private JFreeChart createChart(CategoryDataset dataset) {

    // create the chart
    JFreeChart chart = ChartFactory.createStackedBarChart(null, // chart title
            "", // domain axis label
            "", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            false, // tooltips?
            false // URLs?
    );

    // set the background color for the chart
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(new Color(0xf5, 0xf5, 0xf5));
    plot.setDomainGridlinePaint(Color.gray);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.gray);

    // set the range axis to display integers only
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerBound(0);
    // disable bar outlines...
    StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series
    /*
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue,
        0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.red,
        0.0f, 0.0f, new Color(64, 0, 0));
    */
    Color series1Color = new Color(0xfa, 0x80, 0x72);
    Color series2Color = new Color(0x64, 0x95, 0xed);
    renderer.setSeriesPaint(1, series1Color);
    renderer.setSeriesPaint(0, series2Color);

    //remove shadow
    renderer.setShadowVisible(false);
    //

    //Labels in bars
    /*
    renderer.setSeriesItemLabelsVisible(0, true);
    renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());
    renderer.setSeriesItemLabelPaint(0, Color.white);
    renderer.setSeriesItemLabelsVisible(1, true);
    renderer.setSeriesItemLabelGenerator(1, new StandardCategoryItemLabelGenerator());
    renderer.setSeriesItemLabelPaint(1, Color.white);
      */

    //setCategorySummary(dataset);

    //rotate labels on x-axis
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    return chart;

}

From source file:net.sf.jasperreports.swing.JRViewerPanel.java

private void initComponents() {
    scrollPane = new javax.swing.JScrollPane();
    scrollPane.getHorizontalScrollBar().setUnitIncrement(5);
    scrollPane.getVerticalScrollBar().setUnitIncrement(5);

    pnlTabs = new javax.swing.JTabbedPane();
    pnlInScroll = new javax.swing.JPanel();
    pnlPage = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    pnlLinks = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel9 = new javax.swing.JPanel();
    lblPage = new PageRenderer();

    setMinimumSize(new java.awt.Dimension(450, 150));
    setPreferredSize(new java.awt.Dimension(450, 150));

    setLayout(new java.awt.BorderLayout());
    addComponentListener(new java.awt.event.ComponentAdapter() {
        @Override/* w w w  .  ja  va 2s. co  m*/
        public void componentResized(java.awt.event.ComponentEvent evt) {
            pnlMainComponentResized(evt);
        }
    });

    pnlTabs.addChangeListener(new javax.swing.event.ChangeListener() {
        @Override
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            pnlTabsStateChanged(evt);
        }
    });
    add(pnlTabs, java.awt.BorderLayout.CENTER);

    scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    pnlInScroll.setLayout(new java.awt.GridBagLayout());

    pnlPage.setLayout(new java.awt.BorderLayout());
    pnlPage.setMinimumSize(new java.awt.Dimension(100, 100));
    pnlPage.setPreferredSize(new java.awt.Dimension(100, 100));

    jPanel4.setLayout(new java.awt.GridBagLayout());
    jPanel4.setMinimumSize(new java.awt.Dimension(100, 120));
    jPanel4.setPreferredSize(new java.awt.Dimension(100, 120));

    pnlLinks.setLayout(null);
    pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5));
    pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5));
    pnlLinks.setOpaque(false);
    pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mousePressed(java.awt.event.MouseEvent evt) {
            pnlLinksMousePressed(evt);
        }

        @Override
        public void mouseReleased(java.awt.event.MouseEvent evt) {
            pnlLinksMouseReleased(evt);
        }
    });
    pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        @Override
        public void mouseDragged(java.awt.event.MouseEvent evt) {
            pnlLinksMouseDragged(evt);
        }
    });

    GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    jPanel4.add(pnlLinks, gridBagConstraints);

    jPanel5.setBackground(java.awt.Color.gray);
    jPanel5.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel5.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
    jPanel4.add(jPanel5, gridBagConstraints);

    jPanel6.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel6.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    jPanel4.add(jPanel6, gridBagConstraints);

    jPanel7.setBackground(java.awt.Color.gray);
    jPanel7.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel7.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel4.add(jPanel7, gridBagConstraints);

    jPanel8.setBackground(java.awt.Color.gray);
    jPanel8.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel8.setPreferredSize(new java.awt.Dimension(5, 5));
    jLabel1.setText("jLabel1");
    jPanel8.add(jLabel1);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    jPanel4.add(jPanel8, gridBagConstraints);

    jPanel9.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel9.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    jPanel4.add(jPanel9, gridBagConstraints);

    lblPage.setBackground(java.awt.Color.white);
    lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    lblPage.setOpaque(true);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel4.add(lblPage, gridBagConstraints);

    pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    pnlInScroll.add(pnlPage, gridBagConstraints);

    scrollPane.setViewportView(pnlInScroll);
    add(scrollPane, java.awt.BorderLayout.CENTER);

}