Example usage for java.awt Color cyan

List of usage examples for java.awt Color cyan

Introduction

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

Prototype

Color cyan

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

Click Source Link

Document

The color cyan.

Usage

From source file:com.sdk.connector.chart.FrequencyDomainRenderer.java

/**
 * Creates a new demo application./*w w  w  . j a  va 2 s.c o  m*/
 *
 * @param title  the frame title.
 */
public FrequencyDomainRenderer(String title, JPanel panel, String side, String type) {

    this.side = side;
    this.type = type;
    serie.setKey(side);

    dataset.addSeries(serie);
    JFreeChart chart = ChartFactory.createXYAreaChart(title,
            java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.xlabel"),
            java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.ylabel2"),
            dataset, PlotOrientation.VERTICAL, true, true, false);

    //        TextTitle t1 = new TextTitle( "Espectro de Frequncia Estimado (PSD)", new Font("SansSerif", Font.BOLD, 14)  );
    //        //TextTitle t2 = new TextTitle( "valores atualizados a cada potncia de 2", new Font("SansSerif", Font.PLAIN, 11)      );
    //        chart.addSubtitle(t1);
    chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    chart.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    chart.getRenderingHints().put(RenderingHints.KEY_ALPHA_INTERPOLATION,
            RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
    chart.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS,
            RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    chart.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    chart.getRenderingHints().put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
    chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    chart.getRenderingHints().put(RenderingHints.KEY_TEXT_LCD_CONTRAST, 100);
    //chart.addSubtitle(t2);
    plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.BLUE);
    plot.setRangeGridlinePaint(Color.CYAN);
    plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f));
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f));

    //plot.setRangePannable(true);
    plot.setForegroundAlpha(0.65f);

    //XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer = plot.getRenderer();
    renderer.setSeriesOutlinePaint(0, Color.BLACK);
    if (side.startsWith(
            java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("side.left"))) {
        renderer.setSeriesPaint(0, Color.BLUE);
    } else {
        renderer.setSeriesPaint(0, Color.RED);
    }
    //        renderer.setSeriesLinesVisible(0, true);
    //        renderer.setSeriesShapesVisible(0, false);
    //        renderer.setSeriesLinesVisible(1, true);
    //        renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.BLACK);
    plot.setRangeGridlinePaint(Color.BLACK);
    plot.setForegroundAlpha(0.5f);

    Color color1 = new Color(0, 0, 0, 24);
    Color color2 = new Color(255, 255, 255, 24);

    GradientPaint gp = new GradientPaint(0, 0, color1, 0, 0, color2);
    plot.setBackgroundPaint(gp);

    final ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setTickMarkPaint(Color.black);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    NumberAxis numDomainAxis = (NumberAxis) plot.getDomainAxis();
    numDomainAxis.setAutoRangeIncludesZero(true);
    //
    //        final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)");
    //
    //        plot.setRangeAxis(rangeAxis);
    final ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setTickMarkPaint(Color.black);

    numRangeAxis = (NumberAxis) plot.getRangeAxis();
    numRangeAxis.setAutoRangeIncludesZero(true);

    vlfTarget.setLabel("VLF");
    vlfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9));
    vlfTarget.setLabelAnchor(RectangleAnchor.CENTER);
    vlfTarget.setLabelTextAnchor(TextAnchor.CENTER);
    vlfTarget.setPaint(new Color(0, 100, 255, 128));
    // plot.addRangeMarker(target, Layer.BACKGROUND);
    plot.addDomainMarker(vlfTarget, Layer.BACKGROUND);

    lfTarget.setLabel("LF");
    lfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9));
    lfTarget.setLabelAnchor(RectangleAnchor.CENTER);
    lfTarget.setLabelTextAnchor(TextAnchor.CENTER);
    lfTarget.setPaint(new Color(255, 255, 0, 128));
    // plot.addRangeMarker(target, Layer.BACKGROUND);
    plot.addDomainMarker(lfTarget, Layer.BACKGROUND);

    hfTarget.setLabel("HF");
    hfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9));
    hfTarget.setLabelAnchor(RectangleAnchor.CENTER);
    hfTarget.setLabelTextAnchor(TextAnchor.CENTER);
    hfTarget.setPaint(new Color(255, 0, 255, 128));
    // plot.addRangeMarker(target, Layer.BACKGROUND);
    plot.addDomainMarker(hfTarget, Layer.BACKGROUND);
    plot.setNoDataMessage(
            java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("message.wait"));

    chartPanel = new ChartPanel(chart);

    panel.setLayout(new GridLayout(0, 1));
    panel.add(chartPanel);
    panel.repaint();
    panel.revalidate();

}

From source file:edu.ucla.stat.SOCR.chart.SuperValueChart.java

/**
 * Creates a chart./*www  .jav a2 s.  co  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(ValueDataset dataset) {
    // create the chart...
    // OPTIONAL CUSTOMISATION COMPLETED.
    CompassPlot plot = new CompassPlot(dataset);
    plot.setSeriesNeedle(7);
    plot.setSeriesPaint(0, Color.red);
    plot.setSeriesOutlinePaint(0, Color.red);
    plot.setRoseHighlightPaint(Color.CYAN);
    JFreeChart chart = new JFreeChart(plot);

    return chart;

}

From source file:com.joey.software.plottingToolkit.PlotingToolkit.java

public static Color getPlotColor(int number) {
    switch (number) {
    case 0:/* ww  w  .  j a  v  a  2 s.  c o  m*/
        return Color.RED;
    case 1:
        return Color.GREEN;
    case 2:
        return Color.BLUE;
    case 3:
        return Color.CYAN;
    case 4:
        return Color.PINK;
    case 5:
        return Color.magenta;
    default:
        return ImageOperations.getRandomColor();
    }
}

From source file:com.google.code.facebook.graph.sna.applet.FacebookGraphApplet.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoom features./*from  w  w  w  . ja  v  a  2 s.c  o  m*/
 * 
 */
@Override
public void init() {
    super.init();
    // create a simple graph for the demo
    fetchUserGraph();
    final Collection<? extends Entity<FieldEnum, ConnectionEnum>> vertices = graph.getVertices();

    // a Map for the labels
    Map<Entity<FieldEnum, ConnectionEnum>, String> map = new HashMap<Entity<FieldEnum, ConnectionEnum>, String>();
    Iterator<? extends Entity<FieldEnum, ConnectionEnum>> iterator = vertices.iterator();
    while (iterator.hasNext()) {
        Entity<FieldEnum, ConnectionEnum> entity = iterator.next();
        map.put(entity, entity.getLabel());
    }

    FRLayout<Entity<FieldEnum, ConnectionEnum>, EdgeAdapter<ConnectionEnum>> layout = new FRLayout<Entity<FieldEnum, ConnectionEnum>, EdgeAdapter<ConnectionEnum>>(
            (Graph<Entity<FieldEnum, ConnectionEnum>, EdgeAdapter<ConnectionEnum>>) graph);
    layout.setMaxIterations(100);
    vv = new VisualizationViewer<Entity<FieldEnum, ConnectionEnum>, EdgeAdapter<ConnectionEnum>>(layout,
            new Dimension(2000, 2000));

    Transformer<Entity<FieldEnum, ConnectionEnum>, Paint> vpf = new PickableVertexPaintTransformer<Entity<FieldEnum, ConnectionEnum>>(
            vv.getPickedVertexState(), Color.white, Color.yellow);
    vv.getRenderContext().setVertexFillPaintTransformer(vpf);
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<EdgeAdapter<ConnectionEnum>>(vv.getPickedEdgeState(), Color.black,
                    Color.cyan));

    vv.setBackground(Color.white);

    // a Map for the Icons
    final Map<Entity<FieldEnum, ConnectionEnum>, Icon> iconMap = new HashMap<Entity<FieldEnum, ConnectionEnum>, Icon>();
    new Thread(new Runnable() {
        public void run() {
            Iterator<? extends Entity<FieldEnum, ConnectionEnum>> iterator = vertices.iterator();
            while (iterator.hasNext()) {
                try {
                    Entity<FieldEnum, ConnectionEnum> entity = iterator.next();
                    //                     Icon icon = 
                    //                        new LayeredIcon(new ImageIcon("http://facebookgraph.appspot.com/proxy?url=" + entity.getPicture(PictureType.SQUARE), "Profile Picture").getImage());
                    //                       iconMap.put(entity, icon);

                    Image image = getImageFromEntity(entity);
                    if (image != null && image.getWidth(null) > 0 && image.getHeight(null) > 0) {
                        Icon icon = new LayeredIcon(image);
                        iconMap.put(entity, icon);
                        if ((iconMap.size() % 5) == 0) {
                            vv.repaint();
                        }
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            vv.repaint();
        }

    }).start();

    final Transformer<Entity<FieldEnum, ConnectionEnum>, String> vertexStringerImpl = new VertexStringerImpl<Entity<FieldEnum, ConnectionEnum>>(
            map);
    Transformer<EdgeAdapter<ConnectionEnum>, String> edgeStringerImpl = new Transformer<EdgeAdapter<ConnectionEnum>, String>() {
        public String transform(EdgeAdapter<ConnectionEnum> edge) {
            return edge.toString();
        }
    };
    vv.getRenderContext().setEdgeLabelTransformer(edgeStringerImpl);
    vv.getRenderContext().setVertexLabelTransformer(vertexStringerImpl);
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));

    // features on and off. For a real application, use VertexIconAndShapeFunction instead.
    final VertexIconShapeTransformer<Entity<FieldEnum, ConnectionEnum>> vertexImageShapeFunction = new VertexIconShapeTransformer<Entity<FieldEnum, ConnectionEnum>>(
            new EllipseVertexShapeTransformer<Entity<FieldEnum, ConnectionEnum>>());

    final DefaultVertexIconTransformer<Entity<FieldEnum, ConnectionEnum>> vertexIconFunction = new DefaultVertexIconTransformer<Entity<FieldEnum, ConnectionEnum>>();

    vertexImageShapeFunction.setIconMap(iconMap);
    vertexIconFunction.setIconMap(iconMap);

    vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);

    // Get the pickedState and add a listener that will decorate the
    // Vertex images with a checkmark icon when they are picked
    PickedState<Entity<FieldEnum, ConnectionEnum>> ps = vv.getPickedVertexState();
    ps.addItemListener(new PickWithIconListener(vertexIconFunction));

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new Transformer<Entity<FieldEnum, ConnectionEnum>, String>() {
        @Override
        public String transform(Entity<FieldEnum, ConnectionEnum> entity) {
            return entity.getDescription();
        }
    });

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JComboBox modeBox = graphMouse.getModeComboBox();
    JPanel modePanel = new JPanel();
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modePanel.add(modeBox);

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(scaleGrid);

    controls.add(modePanel);
    content.add(controls, BorderLayout.SOUTH);

    this.viewSupport = new MagnifyImageLensSupport<Entity<FieldEnum, ConnectionEnum>, EdgeAdapter<ConnectionEnum>>(
            vv);
    //           new ViewLensSupport<Number,Number>(vv, new HyperbolicShapeTransformer(vv, 
    //              vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)), 
    //                new ModalLensGraphMouse());

    this.modelSupport = new LayoutLensSupport<Entity<FieldEnum, ConnectionEnum>, EdgeAdapter<ConnectionEnum>>(
            vv);

    graphMouse.addItemListener(modelSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(viewSupport.getGraphMouse().getModeListener());

    ButtonGroup radio = new ButtonGroup();
    JRadioButton none = new JRadioButton("None");
    none.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (viewSupport != null) {
                viewSupport.deactivate();
            }
            if (modelSupport != null) {
                modelSupport.deactivate();
            }
        }
    });
    none.setSelected(true);

    JRadioButton hyperView = new JRadioButton("View");
    hyperView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            viewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    JRadioButton hyperModel = new JRadioButton("Layout");
    hyperModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            modelSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    radio.add(none);
    radio.add(hyperView);
    radio.add(hyperModel);

    JMenuBar menubar = new JMenuBar();
    JMenu modeMenu = graphMouse.getModeMenu();
    menubar.add(modeMenu);

    JPanel lensPanel = new JPanel(new GridLayout(2, 0));
    lensPanel.setBorder(BorderFactory.createTitledBorder("Lens"));
    lensPanel.add(none);
    lensPanel.add(hyperView);
    lensPanel.add(hyperModel);
    controls.add(lensPanel);
}

From source file:jcine.CineForm.java

private void buildHall(Asiento[] asientos) {
    //Encontraremos las dimensiones de sala
    Integer maxX = 0;/*from   www. j a  v  a  2 s . c o m*/
    Integer maxY = 0;
    for (int i = 0; i < asientos.length; i++) {
        if (asientos[i].getPosX() > maxX) {
            maxX = asientos[i].getPosX();
        }
        if (asientos[i].getPosY() > maxY) {
            maxY = asientos[i].getPosY();
        }
    }
    //los tamaos de sillas
    Integer sizeX = pHall.getWidth() / maxX;
    Integer sizeY = pHall.getHeight() / maxY;

    Boolean[][] matrix = new Boolean[maxX][maxY];

    //sillas
    for (int i = 0; i < asientos.length; i++) {
        JButton btn = new JButton("btn_" + Integer.toString(i));
        btn.setText(asientos[i].getName());
        btn.setLocation(sizeX * (asientos[i].getPosX() - 1), sizeY * (asientos[i].getPosY() - 1));
        btn.setSize(sizeX - SPACER, sizeY - SPACER);
        btn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chairPressed(evt);
            }
        });
        matrix[asientos[i].getPosX() - 1][asientos[i].getPosY() - 1] = true;
        pHall.add(btn);
    }
    //pasillos
    for (int x = 0; x < maxX; x++) {
        for (int y = 0; y < maxY; y++) {
            if (matrix[x][y] == null) {
                JPanel panel = new JPanel();
                panel.setBackground(Color.cyan);
                panel.setLocation(x * sizeX - SPACER, y * sizeY - SPACER);
                panel.setSize(sizeX + 2 * SPACER, sizeY + 2 * SPACER);
                pHall.add(panel);
            }
        }
    }
    pHall.repaint();
}

From source file:de.unidue.inf.is.ezdl.gframedl.tools.relations.DLObjectGraphView.java

private void setRenderers() {
    vv.getRenderContext().setVertexLabelTransformer(new Transformer<DLObject, String>() {

        @Override//from   ww  w.j a v a  2  s.c o m
        public String transform(DLObject v) {
            String result = "";
            if (v instanceof Person) {
                result = ((Person) v).getFirstName() + " " + ((Person) v).getLastName();
            }
            if (v instanceof TextDocument) {
                result = ((TextDocument) v).getTitle();
            }
            return result;
        }
    });
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.red));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));
    vv.getRenderContext().setVertexShapeTransformer(new VertexShapeFunction<DLObject>());

    vv.getRenderContext().setVertexIconTransformer(new Transformer<DLObject, Icon>() {

        @Override
        public Icon transform(final DLObject v) {
            final int size = getVertexSize(v);
            return new Icon() {

                @Override
                public int getIconHeight() {
                    return size;
                }

                @Override
                public int getIconWidth() {
                    return size;
                }

                @Override
                public void paintIcon(Component c, Graphics g, int x, int y) {
                    int halfSize = size / 2;
                    if (vv.getPickedVertexState().isPicked(v)) {
                        g.setColor(Color.yellow);
                    } else {
                        g.setColor(Color.lightGray);
                    }
                    g.fillOval(x, y, size, size);

                    if (vv.getPickedVertexState().isPicked(v)) {
                        g.setColor(Color.red);
                    } else {
                        g.setColor(Color.black);
                    }
                    g.drawOval(x, y, size, size);

                    int iconX = x + halfSize - 8;
                    int iconY = y + halfSize - 8;

                    if (v instanceof Person) {
                        Icons.MEDIA_AUTHOR.get16x16().paintIcon(c, g, iconX, iconY);
                    }
                    if (v instanceof TextDocument) {
                        Icons.MEDIA_TEXT.get16x16().paintIcon(c, g, iconX, iconY);
                    }
                    if (v instanceof Term) {
                        Icons.MEDIA_TERM.get16x16().paintIcon(c, g, iconX, iconY);
                    }
                }
            };
        }
    });

    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.black));
    vv.setBackground(Color.white);
}

From source file:com.mentor.questa.ucdb.jenkins.QuestaCoverageAction.java

private JFreeChart createBarChart(final StaplerRequest req, final CategoryDataset dataset, final String title) {
    JFreeChart chart = ChartFactory.createBarChart(title, //title
            null, //categoryaxislabel, 
            null, //valueaxislabel    
            dataset, //dataset
            PlotOrientation.HORIZONTAL, //orientation
            false, //legend
            true, //tooltips
            false //urls
    );/*from ww  w.  j  a v  a  2  s .c  om*/

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

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);

    final BarRenderer cir = new BarRenderer() {
        private final Paint[] colors = { Color.red, Color.blue, Color.green, Color.yellow, Color.orange,
                Color.cyan, Color.magenta, Color.blue };

        /**
         * Returns the paint for an item. Overrides the default behavior
         * inherited from AbstractSeriesRenderer.
         *
         * @param row the series.
         * @param column the category.
         *
         * @return The item color.
         */
        @Override
        public Paint getItemPaint(final int row, final int column) {
            return colors[column % colors.length];
        }
    };
    cir.setMaximumBarWidth(0.35);
    plot.setRenderer(cir);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    return chart;
}

From source file:uk.ac.ncl.aries.entanglement.cli.export.MongoGraphToGDF.java

private static Map<String, Color> loadColorMappings(File propFile) throws IOException {
    FileInputStream is = new FileInputStream(propFile);
    Properties props = new Properties();
    props.load(is);/*from   w w w.j  a  v a  2  s  .  c o  m*/
    is.close();

    Map<String, Color> nodeTypeToColour = new HashMap<>();
    for (String nodeType : props.stringPropertyNames()) {
        String colorString = props.getProperty(nodeType);
        Color color;

        switch (colorString) {
        case "BLACK":
            color = Color.BLACK;
            break;
        case "BLUE":
            color = Color.BLUE;
            break;
        case "CYAN":
            color = Color.CYAN;
            break;
        case "DARK_GRAY":
            color = Color.DARK_GRAY;
            break;
        case "GRAY":
            color = Color.GRAY;
            break;
        case "GREEN":
            color = Color.GREEN;
            break;
        case "LIGHT_GRAY":
            color = Color.LIGHT_GRAY;
            break;
        case "MAGENTA":
            color = Color.MAGENTA;
            break;
        case "ORANGE":
            color = Color.ORANGE;
            break;
        case "PINK":
            color = Color.PINK;
            break;
        case "RED":
            color = Color.RED;
            break;
        case "WHITE":
            color = Color.WHITE;
            break;
        case "YELLOW":
            color = Color.YELLOW;
            break;
        default:
            color = DEFAULT_COLOR;
        }

        nodeTypeToColour.put(nodeType, color);
    }
    return nodeTypeToColour;
}

From source file:com.bdb.weather.display.summary.TemperatureDeviationPlotPanel.java

public TemperatureDeviationPlotPanel(SummaryInterval interval, ViewLauncher theLauncher,
        SummarySupporter theSupporter) {
    this.setPrefSize(500, 300);
    this.interval = interval;
    chart = ChartFactory.createXYBarChart("Deviation from Average Temperature", "Date", true,
            "Deviation (" + Temperature.getDefaultUnit() + ")", null, PlotOrientation.VERTICAL, true, true,
            false);// w  w w.j a v  a 2 s  .  co m

    chartViewer = new ChartViewer(chart);
    chartViewer.setPrefSize(500, 300);
    chartViewer.addChartMouseListener(new ChartMouseListenerFX() {
        @Override
        public void chartMouseClicked(ChartMouseEventFX event) {
            ChartEntity entity = event.getEntity();
            //
            // Was a point on the plot selected?
            //
            if (entity instanceof XYItemEntity) {
                XYItemEntity itemEntity = (XYItemEntity) entity;
                XYDataset dataset = itemEntity.getDataset();
                Number x = dataset.getXValue(itemEntity.getSeriesIndex(), itemEntity.getItem());
                LocalDate date = LocalDate.from(Instant.ofEpochMilli(x.longValue()));
                boolean doubleClick = event.getTrigger().getClickCount() == 2;
                if (doubleClick) {
                    supporter.launchView(launcher, date);
                }
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEventFX event) {
            // Do nothing
        }
    });
    deviationPlot = (XYPlot) chart.getPlot();
    this.launcher = theLauncher;
    this.supporter = theSupporter;

    DateFormat dateFormat = interval.getLegacyFormat();
    StandardXYItemLabelGenerator labelGen = new StandardXYItemLabelGenerator(
            StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, dateFormat,
            Temperature.getDefaultFormatter());

    StandardXYToolTipGenerator ttGen = new StandardXYToolTipGenerator(
            StandardCategoryToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT_STRING, dateFormat,
            Temperature.getDefaultFormatter());

    valueAxis = deviationPlot.getRangeAxis();
    valueAxis.setUpperMargin(.20);
    valueAxis.setLowerMargin(.20);

    deviationPlot.getDomainAxis().setVerticalTickLabels(true);
    DateAxis dateAxis = (DateAxis) deviationPlot.getDomainAxis();
    dateAxis.setDateFormatOverride(dateFormat);
    //dateAxis.setTickUnit(interval.getDateTickUnit());

    //DefaultTableColumnModel colModel = new DefaultTableColumnModel();

    dataTable = new TableView();
    //dataTable.setModel(tableModel);
    //dataTable.setColumnModel(colModel);

    //dataTable.setAutoCreateColumnsFromModel(false);

    for (int i = 0; i < TABLE_HEADINGS.length; i++) {
        TableColumn col = new TableColumn();
        col.setText(TABLE_HEADINGS[i]);
        //col.setModelIndex(i);
        //colModel.addColumn(col);
    }

    //tableModel.setColumnCount(TABLE_HEADINGS.length);

    this.setTabContents(chartViewer, dataTable);

    lowRenderer.setBasePaint(Color.BLUE);
    lowRenderer.setBaseItemLabelGenerator(labelGen);
    lowRenderer.setBaseToolTipGenerator(ttGen);
    lowRenderer.setBarAlignmentFactor(.6);
    lowRenderer.setShadowVisible(false);

    meanRenderer.setSeriesPaint(0, Color.CYAN);
    meanRenderer.setBaseItemLabelGenerator(labelGen);
    meanRenderer.setBaseToolTipGenerator(ttGen);
    meanRenderer.setBarAlignmentFactor(.3);
    meanRenderer.setShadowVisible(false);

    highRenderer.setSeriesPaint(0, Color.GRAY);
    highRenderer.setBaseItemLabelGenerator(labelGen);
    highRenderer.setBaseToolTipGenerator(ttGen);
    highRenderer.setShadowVisible(false);
}

From source file:pts4.googlemaps.Gmaps.java

public void drawUnits() {
    for (Unit a : EmergencyUnits) {
        GeoPosition spot = new GeoPosition(a.getLatidude(), a.getLongitude());
        Color color = null;//from w  w  w . jav a 2 s  .c  om
        if (a.getType() == 1) {
            color = Color.cyan;
        }
        if (a.getType() == 2) {
            color = Color.YELLOW;
        }
        if (a.getType() == 3) {
            color = Color.RED;
        }
        units.add(new MyWaypoint(a.getName(), color, spot));
        // Create a waypoint painter that takes all the waypoints
        waypointPainter2.setWaypoints(units);
        waypointPainter2.setRenderer(new FancyWaypointRenderer());
        // Create a waypoint painter that takes all the waypoints
    }
}