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:external.jung.demo.RoadEditorDemo.java

Color colorIndex(int v) {
    switch (v) {/*w ww.  ja  va 2  s  . c o m*/
    case 1:
        return Color.BLUE;
    case 2:
        return Color.CYAN;
    }
    return Color.BLACK;

}

From source file:UserInterface.PDCPrimaryDoctorRole.PDCPrimaryDoctorReportsJPanel.java

private void populateGraphs(Patient patient, String attribute) {
    int lowerNormal = 0;
    int higherNormal = 0;
    int yAxis = 0;
    DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();
    for (VitalSigns vitalSigns : patient.getVitalSignsHistory().getVitalSignsHistory()) {

        if (attribute.equalsIgnoreCase("ECG")) {
            yAxis = vitalSigns.getEcg();
            lowerNormal = 46;//from   www .  j a  v a 2 s  .co m
            higherNormal = 50;
        } else if (attribute.equalsIgnoreCase("HEART RATE")) {
            yAxis = vitalSigns.getHeartRate();
            lowerNormal = 60;
            higherNormal = 90;
        } else if (attribute.equalsIgnoreCase("RESPIRATORY RATE")) {
            yAxis = vitalSigns.getHeartRate();
            lowerNormal = 12;
            higherNormal = 25;
        } else if (attribute.equalsIgnoreCase("WEIGHT IN KG")) {
            yAxis = vitalSigns.getHeartRate();
            lowerNormal = 80;
            higherNormal = 85;
        } else if (attribute.equalsIgnoreCase("SYSTOLIC BLOOD PRESSURE")) {
            yAxis = vitalSigns.getHeartRate();
            lowerNormal = 90;
            higherNormal = 120;
        }
        Date currentTimeStamp = new Date();
        int currentTime = (int) (currentTimeStamp.getTime()) / (1000 * 60);
        int vitalSignsTime = (int) vitalSigns.getTimeStamp().getTime() / (1000 * 60);
        if (currentTime - vitalSignsTime <= 1) {
            line_chart_dataset.addValue(yAxis, attribute, vitalSigns.getTimeStamp());
        }

    }

    JFreeChart lineChart = ChartFactory.createLineChart(attribute + " Over Time", "Time", attribute,
            line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot pi = lineChart.getCategoryPlot();
    pi.setRangeGridlinePaint(Color.WHITE);
    pi.getRenderer().setSeriesPaint(0, Color.GREEN);
    pi.setBackgroundPaint(Color.BLACK);

    ValueMarker marker = new ValueMarker(lowerNormal);
    marker.setLabel("Normal Range");
    marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    marker.setLabelPaint(Color.WHITE);
    marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
    marker.setPaint(Color.CYAN);
    pi.addRangeMarker(marker);

    ValueMarker marker2 = new ValueMarker(higherNormal);
    marker2.setLabel("Normal Range");
    marker2.setLabelPaint(Color.WHITE);
    marker2.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    marker2.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
    marker2.setPaint(Color.CYAN);
    pi.addRangeMarker(marker2);
    reportJPanel.setLayout(new java.awt.BorderLayout());
    ChartPanel panel = new ChartPanel(lineChart);
    reportJPanel.add(panel, BorderLayout.CENTER);
    reportJPanel.validate();
}

From source file:jmeanshift.ChartProof.java

private void bubblyBubblesScatter(JPanel panel) {

    JFreeChart chart = ChartFactory.createScatterPlot(TITLE, "X1", "X2", dataset, PlotOrientation.VERTICAL,
            true, true, false);//from  w  ww. jav a2 s .co  m

    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.yellow));

    plot = chart.getXYPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.BLUE);
    plot.setRangeGridlinePaint(Color.CYAN);
    plot.setForegroundAlpha(0.65f);

    domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setLowerBound(0);
    domainAxis.setUpperBound(255);
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis = (NumberAxis) plot.getRangeAxis();

    rangeAxis.setLowerBound(0);
    rangeAxis.setUpperBound(255);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.addChartMouseListener(this);
    panel.setLayout(new GridLayout(0, 1));
    panel.add(chartPanel);

}

From source file:edu.uci.ics.jung.samples.PluggableRendererDemo.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public JPanel startFunction() {
    Graph<Integer, Number> g = getGraph();

    Layout<Integer, Number> layout = new FRLayout<Integer, Number>(g);
    //        layout.setSize(new Dimension(5000,5000));
    vv = new VisualizationViewer<Integer, Number>(layout);

    PickedState<Integer> picked_state = vv.getPickedVertexState();

    //        affineTransformer = vv.getLayoutTransformer();
    self_loop = new SelfLoopEdgePredicate<Integer, Number>();
    // create decorators
    seedFillColor = new SeedFillColor<Integer>(picked_state);
    seedDrawColor = new SeedDrawColor<Integer>(picked_state);
    ewcs = new EdgeWeightStrokeFunction<Number>(edge_weight);
    vsh = new VertexStrokeHighlight<Integer, Number>(g, picked_state);
    vff = new VertexFontTransformer<Integer>();
    eff = new EdgeFontTransformer<Number>();
    vs_none = new ConstantTransformer(null);
    es_none = new ConstantTransformer(null);
    vssa = new VertexShapeSizeAspect<Integer, Number>(g, voltages);
    show_edge = new DirectionDisplayPredicate<Integer, Number>(true, true);
    show_arrow = new DirectionDisplayPredicate<Integer, Number>(true, false);
    show_vertex = new VertexDisplayPredicate<Integer, Number>(false);

    // uses a gradient edge if unpicked, otherwise uses picked selection
    edgeDrawPaint = new GradientPickedEdgePaintFunction<Integer, Number>(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan), vv);
    edgeFillPaint = new GradientPickedEdgePaintFunction<Integer, Number>(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan), vv);

    vv.getRenderContext().setVertexFillPaintTransformer(seedFillColor);
    vv.getRenderContext().setVertexDrawPaintTransformer(seedDrawColor);
    vv.getRenderContext().setVertexStrokeTransformer(vsh);
    vv.getRenderContext().setVertexLabelTransformer(vs_none);
    vv.getRenderContext().setVertexFontTransformer(vff);
    vv.getRenderContext().setVertexShapeTransformer(vssa);
    vv.getRenderContext().setVertexIncludePredicate(show_vertex);

    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeDrawPaint);
    vv.getRenderContext().setEdgeLabelTransformer(es_none);
    vv.getRenderContext().setEdgeFontTransformer(eff);
    vv.getRenderContext().setEdgeStrokeTransformer(ewcs);
    vv.getRenderContext().setEdgeIncludePredicate(show_edge);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>());
    vv.getRenderContext().setEdgeArrowPredicate(show_arrow);

    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.black));
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());

    vv.setBackground(Color.white);
    GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
    jp.add(scrollPane);//w  ww .  ja  va 2 s  .  c  o  m
    gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);
    gm.add(new PopupGraphMousePlugin());

    addBottomControls(jp);
    vssa.setScaling(true);

    vv.setVertexToolTipTransformer(new VoltageTips<Number>());
    vv.setToolTipText(
            "<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");

    return jp;
}

From source file:samples.graph.PluggableRendererDemo.java

public JPanel startFunction() {
    Graph g = getGraph();/*from  w w  w  .j a  va 2 s.  c om*/

    pr = new PluggableRenderer();
    Layout layout = new FRLayout(g);
    vv = new VisualizationViewer(layout, pr);
    // add Shape based pick support
    vv.setPickSupport(new ShapePickSupport());
    PickedState picked_state = vv.getPickedState();

    affineTransformer = vv.getLayoutTransformer();

    // create decorators
    vcf = new SeedColor(picked_state);
    ewcs = new EdgeWeightStrokeFunction(edge_weight);
    vsh = new VertexStrokeHighlight(picked_state);
    ff = new FontHandler();
    vs_none = new ConstantVertexStringer(null);
    es_none = new ConstantEdgeStringer(null);
    vssa = new VertexShapeSizeAspect(voltages);
    show_edge = new DirectionDisplayPredicate(true, true);
    show_arrow = new DirectionDisplayPredicate(true, false);
    show_vertex = new VertexDisplayPredicate(false);

    // uses a gradient edge if unpicked, otherwise uses picked selection
    edgePaint = new GradientPickedEdgePaintFunction(
            new PickableEdgePaintFunction(picked_state, Color.black, Color.cyan), vv, vv, picked_state);

    pr.setVertexPaintFunction(vcf);
    pr.setVertexStrokeFunction(vsh);
    pr.setVertexStringer(vs_none);
    pr.setVertexFontFunction(ff);
    pr.setVertexShapeFunction(vssa);
    pr.setVertexIncludePredicate(show_vertex);

    pr.setEdgePaintFunction(edgePaint);
    pr.setEdgeStringer(es_none);
    pr.setEdgeFontFunction(ff);
    pr.setEdgeStrokeFunction(ewcs);
    pr.setEdgeIncludePredicate(show_edge);
    pr.setEdgeShapeFunction(new EdgeShape.Line());
    pr.setEdgeArrowPredicate(show_arrow);
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());

    vv.setBackground(Color.white);
    GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
    jp.add(scrollPane);
    gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);
    gm.add(new PopupGraphMousePlugin());

    addBottomControls(jp);
    vssa.setScaling(true);

    vv.setToolTipFunction(new VoltageTips());
    vv.setToolTipText(
            "<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");

    return jp;
}

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

public JPanel startFunction() {
    Graph<Integer, Number> g = getGraph();

    Layout<Integer, Number> layout = new FRLayout<Integer, Number>(g);
    //        layout.setSize(new Dimension(5000,5000));
    vv = new VisualizationViewer<Integer, Number>(layout);

    PickedState<Integer> picked_state = vv.getPickedVertexState();

    //        affineTransformer = vv.getLayoutTransformer();
    self_loop = new SelfLoopEdgePredicate<Integer, Number>();
    // create decorators
    seedFillColor = new SeedFillColor<Integer>(picked_state);
    seedDrawColor = new SeedDrawColor<Integer>(picked_state);
    ewcs = new EdgeWeightStrokeFunction<Number>(edge_weight);
    vsh = new VertexStrokeHighlight<Integer, Number>(g, picked_state);
    vff = new VertexFontTransformer<Integer>();
    eff = new EdgeFontTransformer<Number>();
    vs_none = new ConstantTransformer(null);
    es_none = new ConstantTransformer(null);
    vssa = new VertexShapeSizeAspect<Integer, Number>(g, voltages);
    show_edge = new DirectionDisplayPredicate<Integer, Number>(true, true);
    show_arrow = new DirectionDisplayPredicate<Integer, Number>(true, false);
    show_vertex = new VertexDisplayPredicate<Integer, Number>(false);

    // uses a gradient edge if unpicked, otherwise uses picked selection
    edgeDrawPaint = new GradientPickedEdgePaintFunction<Integer, Number>(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan), vv);
    edgeFillPaint = new GradientPickedEdgePaintFunction<Integer, Number>(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan), vv);

    vv.getRenderContext().setVertexFillPaintTransformer(seedFillColor);
    vv.getRenderContext().setVertexDrawPaintTransformer(seedDrawColor);
    vv.getRenderContext().setVertexStrokeTransformer(vsh);
    vv.getRenderContext().setVertexLabelTransformer(vs_none);
    vv.getRenderContext().setVertexFontTransformer(vff);
    vv.getRenderContext().setVertexShapeTransformer(vssa);
    vv.getRenderContext().setVertexIncludePredicate(show_vertex);

    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeDrawPaint);
    vv.getRenderContext().setEdgeLabelTransformer(es_none);
    vv.getRenderContext().setEdgeFontTransformer(eff);
    vv.getRenderContext().setEdgeStrokeTransformer(ewcs);
    vv.getRenderContext().setEdgeIncludePredicate(show_edge);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>());
    vv.getRenderContext().setEdgeArrowPredicate(show_arrow);

    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.black));
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());

    vv.setBackground(Color.white);
    GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
    jp.add(scrollPane);//from   w  w  w . j  av a  2 s.  c  o m
    gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);
    gm.add(new PopupGraphMousePlugin());

    addBottomControls(jp);
    vssa.setScaling(true);

    vv.setVertexToolTipTransformer(new VoltageTips<Number>());
    vv.setToolTipText(
            "<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");

    return jp;
}

From source file:de.unikassel.jung.PluggableRendererDemo.java

public JPanel startFunction() {
    Graph<Integer, Number> g = getGraph();

    Layout<Integer, Number> layout = new FRLayout<Integer, Number>(g);
    // layout.setSize(new Dimension(5000,5000));
    vv = new VisualizationViewer<Integer, Number>(layout);

    PickedState<Integer> picked_state = vv.getPickedVertexState();

    // affineTransformer = vv.getLayoutTransformer();
    self_loop = new SelfLoopEdgePredicate<Integer, Number>();
    // create decorators
    seedFillColor = new SeedFillColor<Integer>(picked_state);
    seedDrawColor = new SeedDrawColor<Integer>(picked_state);
    ewcs = new EdgeWeightStrokeFunction<Number>(edge_weight);
    vsh = new VertexStrokeHighlight<Integer, Number>(g, picked_state);
    vff = new VertexFontTransformer<Integer>();
    eff = new EdgeFontTransformer<Number>();
    vs_none = new ConstantTransformer(null);
    es_none = new ConstantTransformer(null);
    vssa = new VertexShapeSizeAspect<Integer, Number>(g, voltages);
    show_edge = new DirectionDisplayPredicate<Integer, Number>(true, true);
    show_arrow = new DirectionDisplayPredicate<Integer, Number>(true, false);
    show_vertex = new VertexDisplayPredicate<Integer, Number>(false);

    // uses a gradient edge if unpicked, otherwise uses picked selection
    edgeDrawPaint = new GradientPickedEdgePaintFunction<Integer, Number>(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan), vv);
    edgeFillPaint = new GradientPickedEdgePaintFunction<Integer, Number>(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan), vv);

    vv.getRenderContext().setVertexFillPaintTransformer(seedFillColor);
    vv.getRenderContext().setVertexDrawPaintTransformer(seedDrawColor);
    vv.getRenderContext().setVertexStrokeTransformer(vsh);
    vv.getRenderContext().setVertexLabelTransformer(vs_none);
    vv.getRenderContext().setVertexFontTransformer(vff);
    vv.getRenderContext().setVertexShapeTransformer(vssa);
    vv.getRenderContext().setVertexIncludePredicate(show_vertex);

    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeDrawPaint);
    vv.getRenderContext().setEdgeLabelTransformer(es_none);
    vv.getRenderContext().setEdgeFontTransformer(eff);
    vv.getRenderContext().setEdgeStrokeTransformer(ewcs);
    vv.getRenderContext().setEdgeIncludePredicate(show_edge);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>());
    vv.getRenderContext().setEdgeArrowPredicate(show_arrow);

    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.black));
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());

    vv.setBackground(Color.white);
    GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
    jp.add(scrollPane);//from w  ww .java 2s .  c  om
    gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);
    gm.add(new PopupGraphMousePlugin());

    addBottomControls(jp);
    vssa.setScaling(true);

    vv.setVertexToolTipTransformer(new VoltageTips<Number>());
    vv.setToolTipText(
            "<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");

    return jp;
}

From source file:pts4.googlemaps.Gmaps.java

public void createStage() {

    GeoPosition Utrecht = new GeoPosition(52.0907370, 5.1214200);
    /*// Create a waypoint painter that takes all the waypoints
     WaypointPainter<Waypoint> waypointPainter = new WaypointPainter<Waypoint>();
     waypointPainter.setWaypoints(waypoints);*/
    // Set the focus
    mapViewer.setZoom(10);/* ww  w.ja v a  2 s  .co  m*/
    mapViewer.setAddressLocation(Utrecht);

    // Add interactions
    MouseInputListener mia = new PanMouseInputListener(mapViewer);

    mapViewer.addMouseListener(sa);
    mapViewer.addMouseMotionListener(sa);
    mapViewer.setOverlayPainter(sp);
    mapViewer.addMouseListener(mia);
    mapViewer.addMouseMotionListener(mia);
    //mapViewer.addMouseListener(new CenterMapListener(mapViewer));
    mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCenter(mapViewer));
    mapViewer.addKeyListener(new PanKeyListener(mapViewer));

    mapViewer.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent me) {

            //Rechter muisknop klik
            if (me.getButton() == MouseEvent.BUTTON3) {
                GeoPosition mousepoint = mapViewer.convertPointToGeoPosition(me.getPoint());
                Double lat1 = mousepoint.getLatitude();
                Double lng1 = mousepoint.getLongitude();
                Double lat2;
                Double lng2;

                for (MyWaypoint u : units) {
                    lat2 = u.getPosition().getLatitude();
                    lng2 = u.getPosition().getLongitude();

                    if (UnitControl.distFrom(lat1.floatValue(), lng1.floatValue(), lat2.floatValue(),
                            lng2.floatValue()) < (mapViewer.getZoom() * mapViewer.getZoom()
                                    * mapViewer.getZoom() * 2)) {
                        Platform.runLater(new Runnable() {

                            @Override
                            public void run() {

                                MessageBox msg = new MessageBox("Send message to unit " + u.getLabel() + "?",
                                        MessageBoxType.YES_NO);
                                msg.showAndWait();

                                if (msg.getMessageBoxResult() == MessageBoxResult.YES) {

                                    try {
                                        if (gui.messageToUnit(u.getLabel()) == false) {
                                            MessageBox msg2 = new MessageBox("Error connecting to unit",
                                                    MessageBoxType.OK_ONLY);
                                            msg2.show();

                                        }
                                    } catch (IOException ex) {
                                        Logger.getLogger(Gmaps.class.getName()).log(Level.SEVERE, null, ex);
                                    }

                                } else {
                                    //msg.close();
                                }
                            }

                        });
                    }
                }

            } else {
                if (createUnit == true) {
                    Color kleur = null;
                    if (type == 1) {
                        kleur = Color.cyan;
                    }
                    if (type == 2) {
                        kleur = Color.YELLOW;
                    }
                    if (type == 3) {
                        kleur = Color.RED;
                    }
                    GeoPosition plek = mapViewer.convertPointToGeoPosition(me.getPoint());
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            gui.setUnit(plek.getLongitude(), plek.getLatitude());
                        }
                    });

                    for (MyWaypoint p : orders) {
                        if (p.getLabel().equals(id)) {
                            orders.remove(p);
                        }
                    }
                    orders.add(new MyWaypoint(id, kleur, plek));
                    for (Unit a : EmergencyUnits) {
                        if (a.getName().equals(id)) {
                            GeoPosition plek2 = new GeoPosition(a.getLatidude(), a.getLongitude());
                            ChatMessage chat = new ChatMessage(
                                    gui.getIncidentorder() + "\n" + gui.getUnitDescription(), "Meldkamer", id);
                            server.sendMessage(chat);
                            a.setIncident(incidentstring);
                            new Animation(plek, plek2, id, orders, units, Gmaps.this, waypointPainter3);
                        }
                    }
                    createUnit = false;
                    // Create a waypoint painter that takes all the waypoints
                    waypointPainter3.setWaypoints(orders);
                    waypointPainter3.setRenderer(new FancyWaypointRenderer());
                    draw();
                }

                if (simulation == true) {
                    Color kleur = null;
                    if (type == 1) {
                        kleur = Color.cyan;
                    }
                    if (type == 2) {
                        kleur = Color.YELLOW;
                    }
                    if (type == 3) {
                        kleur = Color.RED;
                    }
                    GeoPosition plek = mapViewer.convertPointToGeoPosition(me.getPoint());
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            gui.setUnit(plek.getLongitude(), plek.getLatitude());
                        }
                    });

                    for (MyWaypoint p : orders) {
                        if (p.getLabel().equals(id)) {
                            orders.remove(p);
                        }
                    }
                    orders.add(new MyWaypoint(id, kleur, plek));
                    for (Unit a : EmergencyUnits) {
                        if (a.getName().equals(id)) {
                            GeoPosition plek2 = new GeoPosition(a.getLatidude(), a.getLongitude());
                            ChatMessage chat = new ChatMessage(
                                    gui.getIncidentorder() + "\n" + gui.getUnitDescription(), "Meldkamer", id);
                            server.sendMessage(chat);
                            a.setIncident(incidentstring);
                            Point2D fire = mapViewer.getTileFactory().geoToPixel(plek, mapViewer.getZoom());
                            simulations = new Simulation(plek, plek2, id, orders, units, Gmaps.this,
                                    waypointPainter3);
                            new SimulationAnimation(simulations, plek, plek2, id, orders, units, Gmaps.this,
                                    waypointPainter3);

                        }
                    }
                    createUnit = false;
                    // Create a waypoint painter that takes all the waypoints
                    waypointPainter3.setWaypoints(orders);
                    waypointPainter3.setRenderer(new FancyWaypointRenderer());
                    /*
                     List<Painter<JXMapViewer>> painters = new ArrayList<Painter<JXMapViewer>>();
                     painters.add(simulations);
                     CompoundPainter<JXMapViewer> painter = new CompoundPainter<JXMapViewer>(painters);
                                
                     mapViewer.setOverlayPainter(painter);*/
                    draw();
                    simulation = false;
                }

                if (weather == true) {
                    GeoPosition mousepoint = mapViewer.convertPointToGeoPosition(me.getPoint());
                    Double lat1 = mousepoint.getLatitude();
                    Double lng1 = mousepoint.getLongitude();
                    try {
                        new Weather(lng1, lat1);
                    } catch (IOException ex) {
                        Logger.getLogger(Gmaps.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (JSONException ex) {
                        Logger.getLogger(Gmaps.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
    }); // end MouseAdapter

}

From source file:UserInterface.WaterSupplyAdmin.UsagePatternJPanel.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
    int selectedRow = customerTable.getSelectedRow();
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(null, "Select a customer first");
        return;/*from ww  w .j  av a 2  s  .co  m*/
    }

    Customer customer = (Customer) customerTable.getValueAt(selectedRow, 1);
    if (customer.getSourceSensor() == null) {
        JOptionPane.showMessageDialog(null, "Water Supply not available yet for this customer");
        return;
    }
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (SensorValue sensorValue : customer.getTargetSensor().getSensorValueList()) {
        dataset.addValue(sensorValue.getFlowrate(), "Date", sensorValue.getDate());
    }
    if (customer.getTargetSensor().getSensorValueList().size() == 1) {
        JFreeChart chart = ChartFactory.createBarChart(
                "Customer's water flowrate variation over a period of time", "Time of Usage",
                "FlowRate(gallons/sec)", dataset, PlotOrientation.VERTICAL, true, true, true);
        CategoryPlot p = chart.getCategoryPlot();
        p.setRangeGridlinePaint(Color.cyan);
        ChartFrame frame = new ChartFrame("Bar Char for Weight", chart);

        frame.setVisible(true);
        frame.setSize(450, 350);
    } else {
        JFreeChart chart = ChartFactory.createLineChart(
                "Customer's water flowrate variation over a period of time", "Time of Usage",
                "FlowRate(gallons/sec)", dataset, PlotOrientation.VERTICAL, true, true, true);
        CategoryPlot p = chart.getCategoryPlot();
        p.setRangeGridlinePaint(Color.cyan);
        ChartFrame frame = new ChartFrame("Bar Char for Weight", chart);
        RefineryUtilities.centerFrameOnScreen(frame);

        frame.setVisible(true);
        frame.setSize(450, 350);
    }

}

From source file:geovista.network.gui.NodeLinkView.java

private void doInit() {

    g = g_array[0]; // initial
    // graph//from   www .j  a v a  2 s  .c  o  m
    layout = new AggregateLayout<Integer, Number>(new FRLayout<Integer, Number>((Graph<Integer, Number>) g));
    vv = new VisualizationViewer<Integer, Number>(layout);

    // vv = new VisualizationViewer<Integer, Number>(new FRLayout(g));

    // coordination part
    // nh = new NodeHighlight<String>(vv.getPickedVertexState());
    // nh.ID = 1;
    // nh.node_no = g.getVertexCount();
    // nh.node_count = nh.node_no;
    // nh.synchroFlag = syncFlag;
    // nh.synchroFlag=new ArrayList<Integer>();
    // vv.getRenderContext().setVertexFillPaintTransformer(nh);

    // Node Part

    vv.getRenderContext().setVertexFillPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.cyan;
            } else {
                return Color.red;
            }
        }
    });
    // Filter vertex according to degree
    show_vertex = new VertexDisplayPredicate<Integer, Number>(false);
    vv.getRenderContext().setVertexIncludePredicate(show_vertex);

    // Node Score Label
    // Node Labels
    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.W);

    nonvertexLabel = new ConstantTransformer(null);

    // vertexScores = new VertexScoreTransformer<Integer,
    // Double>(degreeScorer);
    degreeScorer = new DegreeScorer(g);
    transformerDegree = new VertexScoreTransformer<Integer, Double>(degreeScorer);
    vertexLabelDegree = new NumberFormattingTransformer<Integer>(transformerDegree);
    /*
     * vertexLabel= new Transformer <Integer, String>(){ public String
     * transform(Integer s){ return
     * degreeScorer.getVertexScore(s).toString(); //return
     * String.valueOf(degreeScorer.getVertexScore(s)); } };
     */

    barycenterScorer = new BarycenterScorer(g);
    transformerBarycenter = new VertexScoreTransformer<Integer, Double>(barycenterScorer);
    vertexLabelBarycenter = new NumberFormattingTransformer<Integer>(transformerBarycenter);

    /*
     * vertexLabelBarycenter= new Transformer <Integer, String>(){ public
     * String transform(Integer s){ return
     * barycenterScorer.getVertexScore(s).toString();
     * 
     * } };
     */
    betweennessCentrality = new BetweennessCentrality(g);
    transformerBetweenness = new VertexScoreTransformer<Integer, Double>(betweennessCentrality);
    vertexLabelBetweenness = new NumberFormattingTransformer<Integer>(transformerBetweenness);
    // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g);
    /*
     * vertexLabelBetweenness= new Transformer <Integer, String>(){ public
     * String transform(Integer s){ return
     * betweennessCentrality.getVertexScore(s).toString();
     * 
     * } };
     */
    closenessCentrality = new ClosenessCentrality(g);
    transformerCloseness = new VertexScoreTransformer<Integer, Double>(closenessCentrality);
    vertexLabelCloseness = new NumberFormattingTransformer<Integer>(transformerCloseness);
    // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g);
    /*
     * vertexLabelCloseness= new Transformer <Integer, String>(){ public
     * String transform(Integer s){ return
     * closenessCentrality.getVertexScore(s).toString();
     * 
     * } };
     */
    distanceCentralityScorer = new DistanceCentralityScorer(g, true);
    transformerDistanceCentrality = new VertexScoreTransformer<Integer, Double>(distanceCentralityScorer);
    vertexLabelDistanceCentrality = new NumberFormattingTransformer<Integer>(transformerDistanceCentrality);
    // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g);
    /*
     * vertexLabelDistanceCentrality= new Transformer <Integer, String>(){
     * public String transform(Integer s){ return
     * distanceCentralityScorer.getVertexScore(s).toString();
     * 
     * } };
     */
    eigenvectorCentrality = new EigenvectorCentrality(g);
    transformerEigenvector = new VertexScoreTransformer<Integer, Double>(eigenvectorCentrality);
    vertexLabelEigenvector = new NumberFormattingTransformer<Integer>(transformerEigenvector);
    // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g);
    /*
     * vertexLabelEigenvector= new Transformer <Integer, String>(){ public
     * String transform(Integer s){ return
     * eigenvectorCentrality.getVertexScore(s).toString();
     * 
     * } };
     */

    // Collection<? extends Object> verts = g.getVertices();
    // DegreeScorer vertex_degree_scorer= new DegreeScorer(g);

    // System.out.println(vertex_degree_scorer.getVertexScore(0));
    // for(Integer v:verts){
    // System.out.println(vertex_degree_scorer.getVertexScore(v));

    // }
    // vertex_degree_scorer.getVertexScore(verts);
    // vv.getRenderContext().setVertexLabelTransformer(vertex_degree_scorer.getVertexScore(verts).toString());

    // vv.getRenderContext().setVertexLabelTransformer(new
    // ToStringLabeller());

    // Edge Part
    es_none = new ConstantTransformer(null);
    vv.getRenderContext().setEdgeLabelTransformer(es_none);
    // Set Edge Labels
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));
    edge_label = new Transformer<Number, String>() {
        public String transform(Number e) {
            return "Edge:" + String.valueOf(e);
        }
    };

    // Cluster Part

    // vv.getRenderContext().setVertexFillPaintTransformer(MapTransformer.<Integer,Paint>getInstance(vertexPaints));

    /*
     * vv.getRenderContext().setVertexDrawPaintTransformer(new
     * Transformer<Integer,Paint>() { public Paint transform(Integer v) {
     * if(vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else
     * { return Color.BLACK; } } });
     */

    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        protected final Stroke THICK = new BasicStroke(2);

        public Stroke transform(Number e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY) {
                return THIN;
            } else {
                return THICK;
            }
        }
    });
    // vv.getRenderContext().setEdgeLabelTransformer(stringer);

    // Satellite part
    /*
     * satellite = new SatelliteVisualizationViewer<String,Number>(vv, new
     * Dimension(200,200));
     * satellite.getRenderContext().setEdgeDrawPaintTransformer(new
     * PickableEdgePaintTransformer<Number>(satellite.getPickedEdgeState(),
     * Color.black, Color.cyan));
     * satellite.getRenderContext().setVertexFillPaintTransformer(new
     * PickableVertexPaintTransformer
     * <String>(satellite.getPickedVertexState(), Color.red, Color.yellow));
     * 
     * ScalingControl satelliteScaler = new CrossoverScalingControl();
     * satellite.scaleToLayout(satelliteScaler);
     */

    // Vertex
    // vssa = new VertexShapeSizeAspect<Integer,Number>(g, voltages);
    // PickedState<Integer> picked_state = vv.getPickedVertexState();
    // vsh = new VertexStrokeHighlight<Integer,Number>(g, picked_state);
    // vv.getRenderContext().setVertexStrokeTransformer(vsh);

    // Control part
    addControls(this);
    /*
     * // Basic button part 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()); } }); JButton reset = new JButton("reset");
     * reset.addActionListener(new ActionListener() { public void
     * actionPerformed(ActionEvent e) { Layout<String, Number> layout =
     * vv.getGraphLayout(); layout.initialize(); Relaxer relaxer =
     * vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop();
     * relaxer.prerelax(); relaxer.relax(); } } });
     * 
     * 
     * // Tranform and picking part final DefaultModalGraphMouse<Integer,
     * Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
     * vv.setGraphMouse(graphMouse); JComboBox modeBox =
     * graphMouse.getModeComboBox();
     * modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv
     * .getGraphMouse()).getModeListener());
     * 
     * //JComboBox modeBox = graphMouse.getModeComboBox();
     * //modeBox.addItemListener
     * (((DefaultModalGraphMouse)satellite.getGraphMouse
     * ()).getModeListener());
     * 
     * this.setBackground(Color.WHITE); this.setLayout(new BorderLayout());
     * this.add(vv, BorderLayout.CENTER); Class[] combos = getCombos();
     * final JComboBox jcb = new JComboBox(combos); jcb.setRenderer(new
     * DefaultListCellRenderer() { public Component
     * getListCellRendererComponent(JList list, Object value, int index,
     * boolean isSelected, boolean cellHasFocus) { String valueString =
     * value.toString(); valueString = valueString.substring(valueString
     * .lastIndexOf('.') + 1); return
     * super.getListCellRendererComponent(list, valueString, index,
     * isSelected, cellHasFocus); } });
     * 
     * jcb.addActionListener(new LayoutChooser(jcb, vv));
     * jcb.setSelectedItem(FRLayout.class);
     * 
     * JPanel control_panel = new JPanel(new GridLayout(2, 1)); JPanel
     * topControls = new JPanel(); JPanel bottomControls = new JPanel();
     * control_panel.add(topControls); control_panel.add(bottomControls);
     * this.add(control_panel, BorderLayout.NORTH);
     * 
     * final JComboBox graph_chooser = new JComboBox(g_names);
     * 
     * graph_chooser.addActionListener(new GraphChooser(jcb));
     * 
     * topControls.add(jcb); topControls.add(graph_chooser);
     * bottomControls.add(plus); bottomControls.add(minus);
     * bottomControls.add(modeBox); bottomControls.add(reset);
     */

    // Satellite part

    // this.add(satellite,BorderLayout.EAST);
    // Thread t = new Thread(this);
    // t.start();
}