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:umontreal.ssj.charts.SSJCategorySeriesCollection.java

/**
 * Gives the default color associated with a series
 *
 * @param   index Index of the series in the CategoryDataset object.
 * @return        default color object./*from  w  ww .ja  v a 2  s . c  o  m*/
 */
protected static Color getDefaultColor(int index) {
    if (index % 6 == 0)
        return Color.RED;
    else if (index % 6 == 1)
        return Color.BLUE;
    else if (index % 6 == 2)
        return Color.GREEN;
    else if (index % 6 == 3)
        return Color.YELLOW;
    else if (index % 6 == 4)
        return Color.MAGENTA;
    else
        return Color.CYAN;
}

From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java

private JFreeChart createChart(XYDataset dataset, String title, String xTitle, String yTitle) {

    colors.add(Color.BLACK);/*  ww w.j  a v  a2 s  . c om*/
    colors.add(1, Color.BLUE);
    colors.add(1, Color.RED);
    colors.add(1, Color.GREEN);
    colors.add(1, Color.YELLOW);
    colors.add(1, Color.CYAN);
    colors.add(1, Color.MAGENTA);
    colors.add(1, new Color(111, 83, 64));
    colors.add(1, new Color(153, 51, 255));
    colors.add(1, new Color(102, 204, 255));
    colors.add(1, new Color(85, 80, 126));
    colors.add(1, new Color(168, 80, 126));

    chart = ChartFactory.createXYLineChart(title, xTitle, yTitle, dataset, PlotOrientation.VERTICAL, true, true,
            false);

    chart.setBackgroundPaint(Color.white);

    chart.getXYPlot().setBackgroundPaint(Color.white);
    chart.getXYPlot().setDomainGridlinePaint(Color.white);
    chart.getXYPlot().setRangeGridlinePaint(Color.white);

    int numSeries = series.getSeriesCount();

    XYLineAndShapeRenderer renderer = ((XYLineAndShapeRenderer) chart.getXYPlot().getRenderer());

    renderer.setDrawSeriesLineAsPath(true);

    renderer.setSeriesStroke(0, new BasicStroke(2.0F));

    renderer.setSeriesStroke(1,
            new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 2 }, 0));

    renderer.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(3, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(4, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(5, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, 0));

    renderer.setSeriesStroke(6, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(7, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f, 6.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    for (int i = 0; i < numSeries; i++) {

        if (i == colors.size()) {

            colors = addColors(colors, numSeries);

        }

        if (viewWithOutColor) {
            renderer.setSeriesPaint(i, Color.BLACK);
        } else {
            String name = series.getSeries(i).getKey().toString();

            if (!controlCurveColor.containsKey(name)) {
                renderer.setSeriesPaint(i, colors.get(i));
                controlCurveColor.put(name, colors.get(i));

            } else {

                renderer.setSeriesPaint(i, controlCurveColor.get(name));

            }

            renderer.setSeriesShapesVisible(i, viewPointsForm);

            if (viewWhiteBackground) {
                chart.getXYPlot().setBackgroundPaint(Color.WHITE);
            }
        }
    }
    chart.getXYPlot().setRenderer(renderer);

    return chart;
}

From source file:ExposedFloat.java

public void init() {

    Panel buttonPanel = new PanelWithInsets(0, 0, 0, 0);
    buttonPanel.setLayout(new GridLayout(6, 2, 5, 5));
    buttonPanel.add(maximumButton);/*from ww  w .  j ava2  s .c  o  m*/
    buttonPanel.add(minimumButton);
    buttonPanel.add(positiveInfinityButton);
    buttonPanel.add(negativeInfinityButton);
    buttonPanel.add(piButton);
    buttonPanel.add(notANumberButton);
    buttonPanel.add(new Button(multByZeroButtonString));
    buttonPanel.add(new Button(changeSignButtonString));
    buttonPanel.add(new Button(doubleButtonString));
    buttonPanel.add(new Button(halveButtonString));
    buttonPanel.add(new RepeaterButton(incrementButtonString));
    buttonPanel.add(new RepeaterButton(decrementButtonString));

    binaryField = new Label("00000000000000000000000000000000");
    signField = new Label("0");
    exponentField = new Label("00000000");
    mantissaField = new Label("000000000000000000000000");
    hexField = new Label("00000000");
    base2Field = new Label("0");
    base10Field = new Label("0");

    Font fieldFont = new Font("TimesRoman", Font.PLAIN, 12);
    binaryField.setFont(fieldFont);
    signField.setFont(fieldFont);
    exponentField.setFont(fieldFont);
    mantissaField.setFont(fieldFont);
    hexField.setFont(fieldFont);
    base2Field.setFont(fieldFont);
    base10Field.setFont(fieldFont);

    Panel numberPanel = new Panel();
    numberPanel.setBackground(Color.white);
    numberPanel.setLayout(new GridLayout(7, 1));
    numberPanel.add(signField);
    numberPanel.add(exponentField);
    numberPanel.add(mantissaField);
    Panel binaryPanel = new Panel();
    binaryPanel.setLayout(new BorderLayout());
    binaryPanel.add("Center", binaryField);
    numberPanel.add(binaryPanel);

    Panel hexPanel = new Panel();
    hexPanel.setLayout(new BorderLayout());
    hexPanel.add("Center", hexField);
    numberPanel.add(hexPanel);
    numberPanel.add(base2Field);
    numberPanel.add(base10Field);

    Panel labelPanel = new Panel();
    labelPanel.setBackground(Color.white);
    labelPanel.setLayout(new GridLayout(7, 1));
    Font labelFont = new Font("Helvetica", Font.ITALIC, 11);
    Label label = new Label(signString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(exponentString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(mantissaString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(binaryString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(hexString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(base2String, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(base10String, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);

    Panel dataPanel = new Panel();
    dataPanel.setLayout(new BorderLayout());
    dataPanel.add("West", labelPanel);
    dataPanel.add("Center", numberPanel);

    ColoredLabel title = new ColoredLabel(titleString, Label.CENTER, Color.cyan);
    title.setFont(new Font("Helvetica", Font.BOLD, 12));

    setBackground(Color.green);
    setLayout(new BorderLayout(5, 5));
    add("North", title);
    add("West", buttonPanel);
    add("Center", dataPanel);
}

From source file:graph.jung2.MyLensDemo.java

public void init() {

    // create a simple graph for the demo
    TemporalNetworkOfWikipediaNodes net = null;
    try {//from  w w w  .  j a v a  2  s.c  o  m

        // net = new TemporalNetworkOfWikipediaNodes(null, null);
        net = new TemporalNetworkOfWikipediaNodes(r, level);
        graph = net.createSampleNetwork(); //getCC_EDIT_Graph();

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

    //        if ( net == null ) {
    //            graph = TemporalNetworkOfWikipediaNodes.createSampleNetwork();
    //        }
    //        else {
    //            graph = net.getGraph();
    //        }

    graphLayout = new FRLayout<String, Number>(graph);
    ((FRLayout) graphLayout).setMaxIterations(1000);

    Dimension preferredSize = new Dimension(600, 600);
    Map<String, Point2D> map = new HashMap<String, Point2D>();
    Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map);
    grid = this.generateVertexGrid(map, preferredSize, 25);
    gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize);

    final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>(
            graphLayout, preferredSize);
    vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);

    PickedState<String> ps = vv.getPickedVertexState();
    PickedState<Number> pes = vv.getPickedEdgeState();
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(ps, Color.red, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.cyan));
    vv.setBackground(Color.white);

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

    final Transformer<String, Shape> ovals = vv.getRenderContext().getVertexShapeTransformer();
    final Transformer<String, Shape> squares = new ConstantTransformer(new Rectangle2D.Float(-10, -10, 20, 20));

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());

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

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    hyperbolicViewSupport = new ViewLensSupport<String, Number>(vv,
            new HyperbolicShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse());
    hyperbolicLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new HyperbolicTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse());
    magnifyViewSupport = new ViewLensSupport<String, Number>(vv,
            new MagnifyShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    magnifyLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new MagnifyTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    hyperbolicLayoutSupport.getLensTransformer()
            .setLensShape(hyperbolicViewSupport.getLensTransformer().getLensShape());
    magnifyViewSupport.getLensTransformer()
            .setLensShape(hyperbolicLayoutSupport.getLensTransformer().getLensShape());
    magnifyLayoutSupport.getLensTransformer()
            .setLensShape(magnifyViewSupport.getLensTransformer().getLensShape());

    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());
        }
    });

    ButtonGroup radio = new ButtonGroup();
    JRadioButton normal = new JRadioButton("None");
    normal.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (hyperbolicViewSupport != null) {
                    hyperbolicViewSupport.deactivate();
                }
                if (hyperbolicLayoutSupport != null) {
                    hyperbolicLayoutSupport.deactivate();
                }
                if (magnifyViewSupport != null) {
                    magnifyViewSupport.deactivate();
                }
                if (magnifyLayoutSupport != null) {
                    magnifyLayoutSupport.deactivate();
                }
            }
        }
    });

    final JRadioButton hyperView = new JRadioButton("Hyperbolic View");
    hyperView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton hyperModel = new JRadioButton("Hyperbolic Layout");
    hyperModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyView = new JRadioButton("Magnified View");
    magnifyView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyModel = new JRadioButton("Magnified Layout");
    magnifyModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    JLabel modeLabel = new JLabel("     Mode Menu >>");
    modeLabel.setUI(new VerticalLabelUI(false));
    radio.add(normal);
    radio.add(hyperModel);
    radio.add(hyperView);
    radio.add(magnifyModel);
    radio.add(magnifyView);
    normal.setSelected(true);

    graphMouse.addItemListener(hyperbolicLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyViewSupport.getGraphMouse().getModeListener());

    ButtonGroup graphRadio = new ButtonGroup();
    JRadioButton graphButton = new JRadioButton("Graph");
    graphButton.setSelected(true);
    graphButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(graphLayout);
                vv.getRenderContext().setVertexShapeTransformer(ovals);
                vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
                vv.repaint();
            }
        }
    });
    JRadioButton gridButton = new JRadioButton("Grid");
    gridButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(gridLayout);
                vv.getRenderContext().setVertexShapeTransformer(squares);
                vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null));
                vv.repaint();
            }
        }
    });
    graphRadio.add(graphButton);
    graphRadio.add(gridButton);

    JPanel modePanel = new JPanel(new GridLayout(3, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Display"));
    modePanel.add(graphButton);
    modePanel.add(gridButton);

    JMenuBar menubar = new JMenuBar();
    menubar.add(graphMouse.getModeMenu());
    gzsp.setCorner(menubar);

    Box controls = Box.createHorizontalBox();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel hyperControls = new JPanel(new GridLayout(3, 2));
    hyperControls.setBorder(BorderFactory.createTitledBorder("Examiner Lens"));
    zoomControls.add(plus);
    zoomControls.add(minus);

    hyperControls.add(normal);
    hyperControls.add(new JLabel());

    hyperControls.add(hyperModel);
    hyperControls.add(magnifyModel);

    hyperControls.add(hyperView);
    hyperControls.add(magnifyView);

    controls.add(zoomControls);
    controls.add(hyperControls);
    controls.add(modePanel);
    controls.add(modeLabel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:sk.stuba.fiit.kvasnicka.topologyvisual.topology.Topology.java

/**
 * reverts all changes made by Routing mode
 *///from  w  w w. ja v a 2 s.c  o  m
private void clearRoutingMode() {
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<TopologyEdge>(vv.getPickedEdgeState(), Color.black, Color.cyan));
}

From source file:com.att.aro.ui.view.diagnostictab.plot.AlarmPlot.java

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        logger.info("analysis data is null");
    } else {//from  w w w. ja v a 2 s.  c o m
        alarmDataCollection.removeAllSeries();
        pointerAnnotation.clear();

        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            logger.info("didn't get analysis trace data!");

        } else {
            // Remove old annotation from previous plots
            Iterator<XYPointerAnnotation> pointers = pointerAnnotation.iterator();
            while (pointers.hasNext()) {
                plot.removeAnnotation(pointers.next());
            }

            for (AlarmType eventType : AlarmType.values()) {
                XYIntervalSeries series = new XYIntervalSeries(eventType);
                seriesMap.put(eventType, series);
                alarmDataCollection.addSeries(series);
            }
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult()
                    .getTraceresult();
            List<AlarmInfo> alarmInfos = traceresult.getAlarmInfos();
            List<ScheduledAlarmInfo> pendingAlarms = getHasFiredAlarms(traceresult.getScheduledAlarms());
            Iterator<ScheduledAlarmInfo> iterPendingAlarms = pendingAlarms.iterator();
            double firedTime = 0;
            while (iterPendingAlarms.hasNext()) {
                ScheduledAlarmInfo scheduledEvent = iterPendingAlarms.next();
                AlarmType pendingAlarmType = scheduledEvent.getAlarmType();
                if (pendingAlarmType != null) {
                    firedTime = (scheduledEvent.getTimeStamp() - scheduledEvent.getRepeatInterval()) / 1000;
                    seriesMap.get(pendingAlarmType).add(firedTime, firedTime, firedTime, 1, 0.8, 1);
                    eventMapPending.put(firedTime, scheduledEvent);
                    // logger.fine("populateAlarmScheduledPlot type:\n" +
                    // pendingAlarmType
                    // + "\ntime " + scheduledEvent.getTimeStamp()
                    // + "\nrepeating " + firedTime);
                }
            }

            Iterator<AlarmInfo> iter = alarmInfos.iterator();
            while (iter.hasNext()) {
                AlarmInfo currEvent = iter.next();
                if (currEvent != null) {
                    AlarmType alarmType = currEvent.getAlarmType();
                    if (alarmType != null) {
                        firedTime = currEvent.getTimeStamp() / 1000;

                        /*
                         * Catching any alarms align to quanta as being
                         * inexactRepeating alarms
                         */
                        if ((currEvent.getTimestampElapsed() / 1000) % 900 < 1) {
                            seriesMap.get(alarmType).add(firedTime, firedTime, firedTime, 1, 0, 0.7);

                            // Adding an arrow to mark these
                            // inexactRepeating alarms
                            XYPointerAnnotation xypointerannotation = new XYPointerAnnotation(alarmType.name(),
                                    firedTime, 0.6, 3.92699082D);
                            xypointerannotation.setBaseRadius(20D);
                            xypointerannotation.setTipRadius(1D);
                            pointerAnnotation.add(xypointerannotation);
                            plot.addAnnotation(xypointerannotation);

                            // logger.info("SetInexactRepeating alarm type: "
                            // + alarmType
                            // + " time " + firedTime
                            // + " epoch " + currEvent.getTimestampEpoch()
                            // + " elapsed:\n" +
                            // currEvent.getTimestampElapsed()/1000);
                        } else {
                            seriesMap.get(alarmType).add(firedTime, firedTime, firedTime, 1, 0, 0.5);
                        }
                        eventMap.put(firedTime, currEvent);
                    }
                }
            }
            XYItemRenderer renderer = plot.getRenderer();
            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.RTC_WAKEUP), Color.red);

            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.RTC), Color.pink);

            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.ELAPSED_REALTIME_WAKEUP), Color.blue);

            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.ELAPSED_REALTIME), Color.cyan);

            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.UNKNOWN), Color.black);

            // Assign ToolTip to renderer
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    AlarmInfo info = eventMap.get(dataset.getX(series, item));
                    Date epochTime = new Date();
                    if (info != null) {

                        epochTime.setTime((long) info.getTimestampEpoch());

                        StringBuffer displayInfo = new StringBuffer(
                                ResourceBundleHelper.getMessageString("alarm.tooltip.prefix"));
                        displayInfo.append(MessageFormat.format(
                                ResourceBundleHelper.getMessageString("alarm.tooltip.content"),
                                info.getAlarmType(), info.getTimeStamp() / 1000, epochTime.toString()));
                        if ((info.getTimestampElapsed() / 1000) % 900 < 1) {
                            displayInfo.append(
                                    ResourceBundleHelper.getMessageString("alarm.tooltip.setInexactRepeating"));
                        }
                        displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.suffix"));
                        return displayInfo.toString();
                    }
                    ScheduledAlarmInfo infoPending = eventMapPending.get(dataset.getX(series, item));
                    if (infoPending != null) {

                        epochTime.setTime(
                                (long) (infoPending.getTimestampEpoch() - infoPending.getRepeatInterval()));

                        StringBuffer displayInfo = new StringBuffer(
                                ResourceBundleHelper.getMessageString("alarm.tooltip.prefix"));
                        displayInfo.append(MessageFormat.format(
                                ResourceBundleHelper.getMessageString("alarm.tooltip.contentWithName"),
                                infoPending.getAlarmType(),
                                (infoPending.getTimeStamp() - infoPending.getRepeatInterval()) / 1000,
                                epochTime.toString(), infoPending.getApplication(),
                                infoPending.getRepeatInterval() / 1000));
                        displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.suffix"));
                        return displayInfo.toString();
                    }
                    return null;
                }
            });

        }
    }
    plot.setDataset(alarmDataCollection);
    //      return plot;
}

From source file:org.metacsp.utility.UI.FiniteStateAutomatonFrame.java

public FiniteStateAutomatonFrame(ObservableGraph<String[], Interval> graph) {
    super("Constraint Network");

    g = graph;/*from   www.ja va 2s  .com*/
    g.addGraphEventListener(new GraphEventListener<String[], Interval>() {

        public void handleGraphEvent(GraphEvent<String[], Interval> evt) {
            System.err.println("got " + evt);
            /****/
            vv.getRenderContext().getPickedVertexState().clear();
            vv.getRenderContext().getPickedEdgeState().clear();
            try {

                layout.initialize();

                try {
                    Relaxer relaxer = new VisRunner((IterativeContext) layout);
                    relaxer.stop();
                    relaxer.prerelax();
                } catch (java.lang.ClassCastException e) {
                }

                StaticLayout<String[], Interval> staticLayout = new StaticLayout<String[], Interval>(g, layout);
                LayoutTransition<String[], Interval> lt = new LayoutTransition<String[], Interval>(vv,
                        vv.getGraphLayout(), staticLayout);
                Animator animator = new Animator(lt);
                animator.start();
                //                  vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.repaint();

            } catch (Exception e) {
                System.out.println(e);

            }
            /****/
        }
    });

    //create a graphdraw
    //layout = new FRLayout<State,Interval>(g);
    //layout = new SpringLayout<State,Interval>(g);
    //layout = new StaticLayout<State,Interval>(g,new STNTransformer());
    layout = new FRLayout2<String[], Interval>(g);
    //layout = new CircleLayout<State,Interval>(g);
    //layout = new ISOMLayout<State,Interval>(g);
    //layout = new KKLayout<State,Interval>(g);
    layout.setSize(new Dimension(600, 600));

    try {
        Relaxer relaxer = new VisRunner((IterativeContext) layout);
        relaxer.stop();
        relaxer.prerelax();
    } catch (java.lang.ClassCastException e) {
    }

    Layout<String[], Interval> staticLayout = new StaticLayout<String[], Interval>(g, layout);

    vv = new VisualizationViewer<String[], Interval>(staticLayout, new Dimension(600, 600));

    JRootPane rp = this.getRootPane();
    rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().setBackground(java.awt.Color.lightGray);
    getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));

    vv.setGraphMouse(new DefaultModalGraphMouse<String[], Interval>());

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String[]>());
    vv.setForeground(Color.black);

    //draw edge labels
    Transformer<Interval, String> stringer = new Transformer<Interval, String>() {
        public String transform(Interval e) {
            return e.toString();
        }
    };

    vv.getRenderContext().setEdgeLabelTransformer(stringer);
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Interval>(vv.getPickedEdgeState(), Color.black, Color.cyan));

    vv.addComponentListener(new ComponentAdapter() {

        /**
         * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent)
         */
        @Override
        public void componentResized(ComponentEvent arg0) {
            super.componentResized(arg0);
            System.err.println("resized");
            layout.setSize(arg0.getComponent().getSize());
        }
    });

    getContentPane().add(vv);
    switchLayout = new JButton("Switch to SpringLayout");
    switchLayout.addActionListener(new ActionListener() {

        @SuppressWarnings("unchecked")
        public void actionPerformed(ActionEvent ae) {
            Dimension d = vv.getSize();//new Dimension(600,600);
            if (switchLayout.getText().indexOf("Spring") > 0) {
                switchLayout.setText("Switch to FRLayout");
                //layout = new SpringLayout<State,Interval>(g, new ConstantTransformer(EDGE_LENGTH));
                layout = new SpringLayout<String[], Interval>(g);
                layout.setSize(d);

                try {
                    Relaxer relaxer = new VisRunner((IterativeContext) layout);
                    relaxer.stop();
                    relaxer.prerelax();
                } catch (java.lang.ClassCastException e) {
                }

                StaticLayout<String[], Interval> staticLayout = new StaticLayout<String[], Interval>(g, layout);
                LayoutTransition<String[], Interval> lt = new LayoutTransition<String[], Interval>(vv,
                        vv.getGraphLayout(), staticLayout);
                Animator animator = new Animator(lt);
                animator.start();
                //   vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.repaint();

            } else {
                switchLayout.setText("Switch to SpringLayout");
                layout = new FRLayout<String[], Interval>(g, d);
                layout.setSize(d);

                try {
                    Relaxer relaxer = new VisRunner((IterativeContext) layout);
                    relaxer.stop();
                    relaxer.prerelax();
                } catch (java.lang.ClassCastException e) {
                }

                StaticLayout<String[], Interval> staticLayout = new StaticLayout<String[], Interval>(g, layout);
                LayoutTransition<String[], Interval> lt = new LayoutTransition<String[], Interval>(vv,
                        vv.getGraphLayout(), staticLayout);
                Animator animator = new Animator(lt);
                animator.start();
                //   vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.repaint();

            }
        }
    });

    getContentPane().add(switchLayout, BorderLayout.SOUTH);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.pack();
    this.setVisible(true);

}

From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java

protected static Color getDefaultColor(int index) {
    if (index % 6 == 0)
        return Color.RED;
    else if (index % 6 == 1)
        return Color.BLUE;
    else if (index % 6 == 2)
        return Color.GREEN;
    else if (index % 6 == 3)
        return Color.YELLOW;
    else if (index % 6 == 4)
        return Color.MAGENTA;
    else/*from ww w  . jav  a2s. c  o m*/
        return Color.CYAN;
}

From source file:no.uio.medicine.virsurveillance.charts.StackedChart_AWT.java

private Color getColor(int index) {
    int index2 = index + this.colorOffset;
    switch (index2) {
    case 0:/*from ww  w  .  j av a  2s .  co  m*/
        return Color.RED;
    case 1:
        return Color.BLUE;
    case 2:
        return Color.GREEN;
    case 3:
        return Color.YELLOW;
    case 4:
        return Color.DARK_GRAY;
    case 5:
        return Color.ORANGE;
    case 6:
        return Color.BLACK;
    case 7:
        return Color.CYAN;
    case 8:
        return Color.GRAY;
    case 9:
        return Color.LIGHT_GRAY;
    case 10:
        return Color.MAGENTA;
    case 11:
        return Color.PINK;
    case 12:
        return Color.WHITE;
    default:
        return getColor((int) Math.floor(Math.random() * 14));
    }

}

From source file:eu.cassandra.csn.gui.CSN.java

/**
 * /*  w w w .j ava 2  s  . co  m*/
 */
private static void setUpVV() {
    vv.setBackground(Color.white);
    vv.getRenderContext()
            .setVertexFillPaintTransformer(MapTransformer.<MyNode, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexShapeTransformer(vertexSize);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<MyNode>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<MyLink>());
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<MyNode, Paint>() {
        public Paint transform(MyNode v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.cyan;
            } else {
                return Color.BLACK;
            }
        }
    });
    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<MyLink, Paint>getInstance(edgePaints));
    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<MyLink, Stroke>() {
        protected final Stroke THIN = new BasicStroke((float) 0.5);
        protected final Stroke THICK = new BasicStroke(1);

        public Stroke transform(MyLink e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY) {
                return THIN;
            } else {
                return THICK;
            }
        }
    });
    vv.setGraphMouse(gm);
    vv.getPickedVertexState().addItemListener(new VertexPickListener());

}