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:Engine.Player.java

public ArrayList<DPolygon> GetPolygons(double x, double y) {
    /*Cube head = new Cube(- halfHeadSize + x, - halfHeadSize + y, ViewFrom[2] - halfHeadSize + epsBody,
    halfHeadSize * 2.0, halfHeadSize * 2.0, halfHeadSize * 2.0, Color.YELLOW, PlayerId);
    head.Polys[2].DrawablePolygon.texture = GenerateTerrain.img;
            /* w w w. j  a  va  2 s .  c o m*/
            
    Cube neck = new Cube(- halfNeckSize + x, - halfNeckSize + y, ViewFrom[2] - headSize + halfNeckSize,
        halfNeckSize * 2.0, halfNeckSize * 2.0, halfNeckSize, Color.PINK, PlayerId);
    Cube corpus = new Cube(- halfCorupsXSize + x, - halfCorupsYSize + y, ViewFrom[2] - corpusZSize - headSize + halfNeckSize - epsBody,
        halfCorupsXSize * 2.0, halfCorupsYSize * 2.0, 2 * halfCorpusZSize, Color.BLUE, PlayerId);
            
    Cube legs = new Cube(- halfLegSizeX + x, - halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody,
        2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId);
            
    Cube hands = new Cube(- halfHandsXSize + x, - halfHandsYSize + y, ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody,
        halfHandsXSize * 2.0, halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId);
            
            
            
    ArrayList<DPolygon> all = new ArrayList<DPolygon>();
            
    rot += 0.01;
            
    head.rotation = rot;
    head.setRotAdd();
    head.updatePoly();
            
    neck.rotation = rot;
    neck.updatePoly();
            
    corpus.rotation = rot;
    corpus.updatePoly();
            
    legs.rotation = rot;
    legs.updatePoly();
            
    hands.rotation = rot;
    hands.updatePoly();
            
            
    AddArrayToArrayList(all, head.GetPolygons());
    AddArrayToArrayList(all, neck.GetPolygons());
    AddArrayToArrayList(all, corpus.GetPolygons());
    AddArrayToArrayList(all, hands.GetPolygons());
    AddArrayToArrayList(all, legs.GetPolygons());*/

    //rot = Math.PI*0.75;
    //rot += 0.01;

    /*if (MoveDirection != null)
    {
    //0
    if (Math.abs(MoveDirection.getX()) < 0.1 && MoveDirection.getY() > 0.1) rot = 0;
    //1/4
    if (MoveDirection.getX() > 0.1 && MoveDirection.getY() > 0.1) rot = -Math.PI / 4.0;
    //1/2
    if (MoveDirection.getX() > 0.1 && Math.abs(MoveDirection.getY()) < 0.1) rot = -Math.PI / 2.0;
    //3/4
    if (MoveDirection.getX() > 0.1 && MoveDirection.getY() < 0.1) rot = -3.0 * Math.PI / 4.0;
    //1
    if (Math.abs(MoveDirection.getX()) < 0.1 && MoveDirection.getY() < 0.1) rot = -Math.PI;
    //5/4
    if (MoveDirection.getX() < 0.1 && MoveDirection.getY() < 0.1) rot = -5.0 * Math.PI / 4.0;
    //3/2
    if (MoveDirection.getX() < 0.1 && Math.abs(MoveDirection.getY()) < 0.1) rot = -3.0 * Math.PI / 2.0;
    //7/4
    if (MoveDirection.getX() < 0.1 && MoveDirection.getY() > 0.1) rot = -7.0 * Math.PI / 4.0;
            
    rot += 2 *  Math.PI / 4;
    }*/
    if (PositionIFace != null) {
        rot = Math.PI / 4.0;

        Vector3D v1 = new Vector3D(PositionIFace.getX(), PositionIFace.getY(), 0);
        Vector3D v2 = new Vector3D(ViewFrom[0], ViewFrom[1], 0);
        Vector3D v3 = (v1.subtract(v2)).normalize();

        Vector3D cross = Vector3D.crossProduct(v3, new Vector3D(1, 0, 0));
        double dot = Vector3D.dotProduct(v3, new Vector3D(1, 0, 0));

        double angle = Math.atan2(cross.getZ(), dot);
        rot += -angle;
    }

    double xx = -halfHeadSize + x;
    double yy = -halfHeadSize + y;
    double[] r = rotatePoint(xx, yy, xx, yy, rot - Math.PI * 0.75);

    Cube head = new Cube(r[0], r[1], ViewFrom[2] - halfHeadSize + epsBody, halfHeadSize * 2.0,
            halfHeadSize * 2.0, halfHeadSize * 2.0, Color.YELLOW, PlayerId);

    head.Polys[2].DrawablePolygon.texture = GenerateTerrain.img;

    Cube neck = new Cube(-halfNeckSize + x, -halfNeckSize + y, ViewFrom[2] - headSize + halfNeckSize,
            halfNeckSize * 2.0, halfNeckSize * 2.0, halfNeckSize, Color.PINK, PlayerId);
    Cube corpus = new Cube(-halfCorupsXSize + x, -halfCorupsYSize + y,
            ViewFrom[2] - corpusZSize - headSize + halfNeckSize - epsBody, halfCorupsXSize * 2.0,
            halfCorupsYSize * 2.0, 2 * halfCorpusZSize, Color.BLUE, PlayerId);

    Cube legs = new Cube(-halfLegSizeX + x, -halfLegSizeY + y,
            ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody,
            2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId);

    xx = -halfHandsXSize + x;
    yy = -halfHandsYSize + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y;
    r = rotatePoint(xx, yy, x - 0.5, y - halfHandsYSize, rot - Math.PI * 0.75);

    Cube handLeft = new Cube(r[0], r[1], ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody, 1,
            halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId);

    xx = halfHandsXSize + x - 1;
    yy = -halfHandsYSize + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y;
    r = rotatePoint(xx, yy, x - 0.5, y - halfHandsYSize, rot - Math.PI * 0.75);

    Cube handRight = new Cube(r[0], r[1], ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody, 1,
            halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId);

    xx = -2 + x;
    yy = -halfLegSizeY + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y;
    r = rotatePoint(xx, yy, x - 0.75, y - halfLegSizeY, rot - Math.PI * 0.75);

    Cube legLeft = new Cube(r[0], r[1],
            ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 1.5,
            halfLegSizeY * 2.0, legZSize, Color.CYAN, PlayerId);

    xx = 2 + x - 1.5;
    yy = -halfLegSizeY + y;//- halfHandsYSize + (halfHandsYSize / 2.0) + y;
    r = rotatePoint(xx, yy, x - 0.75, y - halfLegSizeY, rot - Math.PI * 0.75);

    Cube legRight = new Cube(r[0], r[1],
            ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody, 1.5,
            halfLegSizeY * 2.0, legZSize, Color.CYAN, PlayerId);
    //Cube legs = new Cube(- halfLegSizeX + x, - halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody,
    //      2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId);

    ArrayList<DPolygon> all = new ArrayList<DPolygon>();

    //rot += 0.00;

    head.rotation = rot;
    head.setRotAdd();
    head.updatePoly();

    neck.rotation = rot;
    neck.updatePoly();

    corpus.rotation = rot;
    corpus.updatePoly();

    legs.rotation = rot;
    legs.updatePoly();

    handLeft.rotation = rot;
    handLeft.updatePoly();

    handRight.rotation = rot;
    handRight.updatePoly();

    legLeft.rotation = rot;
    legLeft.updatePoly();

    legRight.rotation = rot;
    legRight.updatePoly();

    AddArrayToArrayList(all, head.GetPolygons());
    AddArrayToArrayList(all, neck.GetPolygons());
    AddArrayToArrayList(all, corpus.GetPolygons());
    AddArrayToArrayList(all, handLeft.GetPolygons());
    AddArrayToArrayList(all, handRight.GetPolygons());
    AddArrayToArrayList(all, legLeft.GetPolygons());
    AddArrayToArrayList(all, legRight.GetPolygons());

    /*
            
            
            
            
            
    //rot = Math.PI*0.75;
    rot += 0.01;
    double xx = - halfHeadSize + x;
    double yy = - halfHeadSize + y;
    double[]r = rotatePoint(xx, yy, xx, yy, rot - Math.PI*0.75);
            
    Cube head = new Cube(r[0], r[1], ViewFrom[2] - halfHeadSize + epsBody,
    halfHeadSize * 2.0, halfHeadSize * 2.0, halfHeadSize * 2.0, Color.YELLOW, PlayerId, x, y, rot - Math.PI*0.75);
            
    head.Polys[2].DrawablePolygon.texture = GenerateTerrain.img;
            
            
    Cube neck = new Cube(- halfNeckSize + x, - halfNeckSize + y, ViewFrom[2] - headSize + halfNeckSize,
        halfNeckSize * 2.0, halfNeckSize * 2.0, halfNeckSize, Color.PINK, PlayerId, x, y, rot - Math.PI*0.75);
    Cube corpus = new Cube(- halfCorupsXSize + x, - halfCorupsYSize + y, ViewFrom[2] - corpusZSize - headSize + halfNeckSize - epsBody,
        halfCorupsXSize * 2.0, halfCorupsYSize * 2.0, 2 * halfCorpusZSize, Color.BLUE, PlayerId, x, y, rot - Math.PI*0.75);
            
    Cube legs = new Cube(- halfLegSizeX + x, - halfLegSizeY + y, ViewFrom[2] - legZSize - corpusZSize - headSize + halfNeckSize - epsBody - epsBody,
        2 * halfLegSizeX, 2 * halfLegSizeY, legZSize, Color.MAGENTA, PlayerId, x, y, rot - Math.PI*0.75);
            
    //xx = - halfHandsXSize + 0.5 + x;
    //yy = - halfHandsYSize + (halfHandsYSize / 2.0) + y;
            
    Cube hands = new Cube(- halfHandsXSize + x, - halfHandsYSize + y, ViewFrom[2] - handsZSize - headSize + halfNeckSize - epsBody,
        1, halfHandsYSize * 2.0, handsZSize, Color.CYAN, PlayerId, x, y, rot - Math.PI*0.75);
            
     ArrayList<DPolygon> all = new ArrayList<DPolygon>();
            
    AddArrayToArrayList(all, head.GetPolygons());
    AddArrayToArrayList(all, neck.GetPolygons());
    AddArrayToArrayList(all, corpus.GetPolygons());
    AddArrayToArrayList(all, hands.GetPolygons());
    AddArrayToArrayList(all, legs.GetPolygons());*/
    return all;
}

From source file:com.bdb.weather.display.freeplot.SummaryFreePlot.java

/**
 * Create the JFreeChart series for the wind values.
 * //from   www  .j  av  a  2 s  .c om
 * @param stroke The stroke for the series
 */
private List<FreePlotSeries<SummaryRecord>> createWindSeries(Stroke stroke) {
    List<FreePlotSeries<SummaryRecord>> list = new ArrayList<>();
    int n = 0;
    list.add(new FreePlotSeries<>(AVG_WIND_SERIES_NAME, n++, Color.CYAN, stroke, SummaryRecord::getAvgWindSpeed,
            dateMethod, period));
    list.add(new FreePlotSeries<>(MAX_WIND_SERIES_NAME, n++, Color.yellow, stroke,
            SummaryRecord::getMaxWindSpeed, dateMethod, period));
    list.add(new FreePlotSeries<>(MAX_GUST_SERIES_NAME, n++, Color.yellow, stroke,
            SummaryRecord::getMaxWindGust, dateMethod, period));

    return list;
}

From source file:org.bigwiv.blastgraph.gui.BlastGraphFrame.java

private void vvInit() {

    // vv init/*from  w  ww  .  j  a  va2 s  .c om*/
    try {
        layout = getLayoutFor(layoutType, emptyGraph);
    } catch (Exception e) {
        e.printStackTrace();
    }
    vv = new VisualizationViewer<HitVertex, ValueEdge>(layout);
    vv.setBackground(Color.white);

    rc = vv.getRenderContext();

    annotatingPlugin = new AnnotatingGraphMousePlugin<HitVertex, ValueEdge>(rc);

    graphMouse = new MyAnnotatingModalGraphMouse<HitVertex, ValueEdge>(rc, annotatingPlugin);

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

    rc.setPickSupport(new MyShapePickSupport<HitVertex, ValueEdge>(vv));
    rc.setVertexShapeTransformer(new VertexShape(Global.graph));
    rc.setVertexFillPaintTransformer(new VertexPainter());

    // rc.setEdgeShapeTransformer(new EdgeShape.Line<HitVertex,
    // ValueEdge>());
    // rc.setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(
    // 2.5f)));

    rc.setVertexDrawPaintTransformer(new Transformer<HitVertex, Paint>() {
        @Override
        public Paint transform(HitVertex hv) {
            if (vv.getPickedVertexState().isPicked(hv)) {
                return Color.cyan;
            } else {
                return Color.BLACK;
            }
        }
    });

    vv.setVertexToolTipTransformer(new VertexToolTip<HitVertex>());
    vv.setEdgeToolTipTransformer(new EdgeToolTip<ValueEdge>());
}

From source file:sim.graph.MyPluggableRendererDemo.java

public JPanel startFunction() {
    //        Graph g = getGraph();
    setupGraph();//  ww  w . j  a v  a  2 s  .c o m
    pr = new PluggableRenderer();
    Layout layout = new FRLayout(net);
    //      net.removeAllVertices();
    model = new DefaultVisualizationModel(layout);
    //        model.addChangeListener(this);
    visViewer = new VisualizationViewer(model, pr);

    // add Shape based pick support
    visViewer.setPickSupport(new ShapePickSupport());
    PickedState picked_state = visViewer.getPickedState();

    affineTransformer = visViewer.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), visViewer, visViewer,
            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());

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

    addBottomControls();
    //        jp.add(control_panel, BorderLayout.SOUTH);

    vssa.setScaling(true);

    visViewer.setToolTipFunction(new VoltageTips());
    visViewer.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:network.view.relacoesEntidadesUI.GraphViewEntity.java

@SuppressWarnings("deprecation")
public GraphViewEntity(Grafo g) {

    try {/*from  www. j a  va 2s.  co m*/
        //this.grafo = g;
        graph = getGraph(g);
    } catch (Exception e) {
        graph = TestGraphs.getOneComponentGraph();
    }

    vv = paintGraph(graph, g);

    frame = new JFrame("Relao entre Entidades");
    Container content = frame.getContentPane();
    panel = new JPanel(new BorderLayout());
    panel.add(vv);

    content.add(panel);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setIconImage(SwingResourceManager.getImage(GraphViewEntity.class,
            "/br/atech/smartsearch/view/images/logo-small.JPG"));
    dialog = new JDialog(frame);

    content = dialog.getContentPane();

    // create the BirdsEyeView for zoom/pan
    final edu.uci.ics.jung.visualization.BirdsEyeVisualizationViewer bird = new edu.uci.ics.jung.visualization.BirdsEyeVisualizationViewer(
            vv, 0.25f, 0.25f);

    JButton reset = new JButton("Sem Zoom");
    // 'reset' unzooms the graph via the Lens
    reset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            bird.resetLens();
        }
    });
    final ScalingControl scaler = new ViewScalingControl();
    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, 0.9f, vv.getCenter());
        }
    });
    JButton help = new JButton("Ajuda");
    help.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String zoomHelp = "<html><center>Arraste o retngulo azul para deslocar a imagem<p>"
                    + "Arraste um lado do retngulo para ajustar o zoom</center></html>";
            JOptionPane.showMessageDialog(dialog, zoomHelp);
        }
    });
    JPanel controls = new JPanel(new GridLayout(2, 2));
    controls.add(plus);
    controls.add(minus);
    controls.add(reset);
    controls.add(help);
    content.add(bird);
    content.add(controls, BorderLayout.SOUTH);

    JButton zoomer = new JButton("Mostrar tela de zoom");
    zoomer.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dialog.pack();
            int w = dialog.getWidth() + 5;
            int h = dialog.getHeight() + 5; // 35;
            dialog.setLocation((int) (frame.getLocationOnScreen().getX() + frame.getWidth() - w),
                    (int) frame.getLocationOnScreen().getY() + frame.getHeight() - h);
            //dialog.show();
            dialog.setVisible(true);
            //bird.initLens();
        }
    });

    // [mcrb] Popup menu (Agrupar/Remover/Remover Selecao)
    popup = new JPopupMenu();

    menuItem = new JMenuItem("Agrupar Nodos");
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //TODO
        }
    });
    popup.add(menuItem);

    menuItem = new JMenuItem("Remover Nodo");
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myVertexDisplayPredicate.filter(true);
            clicksFiltro.add(selecionado);
            pr.setVertexPaintFunction(new MyVertexPaintFunction());
            vv.repaint();
        }
    });
    popup.add(menuItem);

    menuItem = new JMenuItem("Remover Seleo");
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            clicks = new ArrayList<Vertex>();
            pr.setVertexPaintFunction(new MyVertexPaintFunction());
            // para evitar que o 'ultimo selecionado permaneca em destaque:
            selecionado = null;
            vv.repaint();
        }
    });
    popup.add(menuItem);

    labelFiltroArestas = new JLabel("Apresentar arestas com tamanho maior que ");
    textFieldFiltroArestas = new JTextField(2);

    buttonFiltroArestas = new JButton("Filtrar");
    buttonEliminarFiltroArestas = new JButton("Remover Filtros");
    buttonEliminarFiltroArestas.setEnabled(false);

    buttonFiltroArestas.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Object objValue = textFieldFiltroArestas.getText();
            try {
                new Integer((String) objValue).intValue();
            } catch (NumberFormatException ex) {
                objValue = "0";
                textFieldFiltroArestas.setText("");
            }
            espessurasSelecionadas.add(objValue);
            myEdgeDisplayPredicate.filter(true, espessurasSelecionadas.toArray());
            buttonEliminarFiltroArestas.setEnabled(true);
            vv.repaint();
        }
    });

    buttonEliminarFiltroArestas.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            textFieldFiltroArestas.setText("");
            espessurasSelecionadas = new ArrayList<Object>();
            myEdgeDisplayPredicate.filter(false, espessurasSelecionadas.toArray());
            vv.repaint();
        }
    });

    JPanel p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));

    // [inicio] acrescimo dos botoes de zoom
    JButton mais = new JButton();
    mais.setToolTipText("Ampliar");
    mais.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    mais.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton menos = new JButton();
    menos.setToolTipText("Reduzir");
    menos.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    menos.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });
    // [fim] acrescimo dos botoes de zoom

    final Color[] cores = { Color.BLACK, Color.BLUE, Color.CYAN, Color.DARK_GRAY, Color.GRAY, Color.GREEN,
            Color.MAGENTA, Color.ORANGE, Color.RED };

    JButton agrupamento = new JButton("Agrupar");
    agrupamento.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            clusterAndRecolor(new SubLayoutDecorator(new FRLayout(graph)), 1, cores, true);
            vv.validate();
            vv.repaint();
        }
    });

    p.add(mais);
    p.add(menos);
    p.add(zoomer);
    p.add(labelFiltroArestas);
    p.add(textFieldFiltroArestas);
    p.add(buttonFiltroArestas);
    p.add(buttonEliminarFiltroArestas);
    p.add(agrupamento);

    frame.getContentPane().add(p, BorderLayout.NORTH);
    frame.setSize(900, 600);
    frame.setVisible(true);
}

From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileToolDynamicRangePanel.java

public void updatePlotPanel() {
    // Chack data size of
    int length = getDataLength();

    if (xData.length != length) {
        xData = new float[length];
    }//w  ww. ja v  a  2  s .c o  m

    if (aScan.length != length) {
        aScan = new float[length];
    }

    // Update X Range
    float[] range = xRange;
    for (int i = 0; i < xData.length; i++) {
        xData[i] = (range[0] + (range[1] - range[0]) * (i / (xData.length - 1)));
    }

    updateAScan();

    XYSeriesCollection datCol1 = PlotingToolkit.getCollection(xData, aScan, "Data");

    XYLineAndShapeRenderer dataRender1 = new XYLineAndShapeRenderer(true, false);

    dataRender1.setSeriesPaint(0, Color.CYAN);
    dataPlot.getXYPlot().setRenderer(0, dataRender1);
    dataPlot.getXYPlot().setDataset(0, datCol1);
}

From source file:uk.co.moonsit.sockets.GraphClient.java

private Color getSeriesColor(int index) {
    if (index > 10) {
        index = index % 11;//from www .ja  v a  2s.  c  o m
    }
    switch (index) {
    case 0:
        return Color.BLUE.brighter().brighter();
    case 1:
        return Color.RED.brighter();
    case 2:
        return Color.GREEN.darker();
    case 3:
        return Color.CYAN.darker();
    case 4:
        return Color.ORANGE.darker();
    case 5:
        return Color.DARK_GRAY;
    case 6:
        return Color.MAGENTA;
    case 7:
        return Color.BLUE.darker().darker();
    case 8:
        return Color.CYAN.darker().darker();
    case 9:
        return Color.BLACK.brighter();
    case 10:
        return Color.RED.darker();
    }
    return Color.LIGHT_GRAY;
}

From source file:edu.harvard.mcz.imagecapture.PositionTemplateEditor.java

/**
 * This method initializes jPanel   //from  w w w .j av  a 2  s . c  o  m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
        gridBagConstraints24.fill = GridBagConstraints.BOTH;
        gridBagConstraints24.gridy = 10;
        gridBagConstraints24.weightx = 1.0;
        gridBagConstraints24.anchor = GridBagConstraints.WEST;
        gridBagConstraints24.gridx = 1;
        GridBagConstraints gridBagConstraints113 = new GridBagConstraints();
        gridBagConstraints113.gridx = 0;
        gridBagConstraints113.anchor = GridBagConstraints.EAST;
        gridBagConstraints113.gridy = 10;
        jLabel9 = new JLabel();
        jLabel9.setText("Taxon Name Barcode");
        GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
        gridBagConstraints23.fill = GridBagConstraints.BOTH;
        gridBagConstraints23.gridy = 13;
        gridBagConstraints23.weightx = 1.0;
        gridBagConstraints23.anchor = GridBagConstraints.WEST;
        gridBagConstraints23.gridx = 1;
        GridBagConstraints gridBagConstraints112 = new GridBagConstraints();
        gridBagConstraints112.gridx = 0;
        gridBagConstraints112.gridy = 13;
        GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
        gridBagConstraints22.fill = GridBagConstraints.BOTH;
        gridBagConstraints22.gridy = 12;
        gridBagConstraints22.weightx = 1.0;
        gridBagConstraints22.anchor = GridBagConstraints.WEST;
        gridBagConstraints22.gridx = 1;
        GridBagConstraints gridBagConstraints111 = new GridBagConstraints();
        gridBagConstraints111.gridx = 0;
        gridBagConstraints111.gridy = 12;
        GridBagConstraints gridBagConstraints110 = new GridBagConstraints();
        gridBagConstraints110.gridx = 1;
        gridBagConstraints110.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints110.gridwidth = 1;
        gridBagConstraints110.anchor = GridBagConstraints.NORTH;
        gridBagConstraints110.gridy = 14;
        jLabelFeedback = new JLabel();
        jLabelFeedback.setText(" ");
        GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
        gridBagConstraints21.fill = GridBagConstraints.BOTH;
        gridBagConstraints21.gridy = 0;
        gridBagConstraints21.weightx = 2.0;
        gridBagConstraints21.anchor = GridBagConstraints.NORTHWEST;
        gridBagConstraints21.gridx = 1;
        GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
        gridBagConstraints13.gridx = 0;
        gridBagConstraints13.anchor = GridBagConstraints.NORTHEAST;
        gridBagConstraints13.gridy = 0;
        jLabel8 = new JLabel();
        jLabel8.setText("ImageFile");
        GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
        gridBagConstraints18.fill = GridBagConstraints.BOTH;
        gridBagConstraints18.gridy = 9;
        gridBagConstraints18.weightx = 1.0;
        gridBagConstraints18.anchor = GridBagConstraints.WEST;
        gridBagConstraints18.gridx = 1;
        GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
        gridBagConstraints17.fill = GridBagConstraints.BOTH;
        gridBagConstraints17.gridy = 8;
        gridBagConstraints17.weightx = 1.0;
        gridBagConstraints17.anchor = GridBagConstraints.WEST;
        gridBagConstraints17.gridx = 1;
        GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
        gridBagConstraints16.fill = GridBagConstraints.BOTH;
        gridBagConstraints16.gridy = 7;
        gridBagConstraints16.weightx = 1.0;
        gridBagConstraints16.anchor = GridBagConstraints.WEST;
        gridBagConstraints16.gridx = 1;
        GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
        gridBagConstraints15.fill = GridBagConstraints.BOTH;
        gridBagConstraints15.gridy = 6;
        gridBagConstraints15.weightx = 1.0;
        gridBagConstraints15.anchor = GridBagConstraints.WEST;
        gridBagConstraints15.gridx = 1;
        GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
        gridBagConstraints14.fill = GridBagConstraints.BOTH;
        gridBagConstraints14.gridy = 5;
        gridBagConstraints14.weightx = 1.0;
        gridBagConstraints14.anchor = GridBagConstraints.WEST;
        gridBagConstraints14.gridx = 1;
        GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
        gridBagConstraints12.fill = GridBagConstraints.BOTH;
        gridBagConstraints12.gridy = 3;
        gridBagConstraints12.weightx = 1.0;
        gridBagConstraints12.anchor = GridBagConstraints.WEST;
        gridBagConstraints12.gridx = 1;
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.anchor = GridBagConstraints.EAST;
        gridBagConstraints11.gridy = 9;
        jLabel7 = new JLabel();
        jLabel7.setText("Specimen");
        jLabel7.setForeground(Color.ORANGE);
        GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
        gridBagConstraints10.gridx = 0;
        gridBagConstraints10.anchor = GridBagConstraints.EAST;
        gridBagConstraints10.gridy = 8;
        jLabel6 = new JLabel();
        jLabel6.setText("Tray Labels");
        jLabel6.setForeground(Color.CYAN);
        GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        gridBagConstraints9.gridx = 0;
        gridBagConstraints9.anchor = GridBagConstraints.EAST;
        gridBagConstraints9.gridy = 7;
        jLabel5 = new JLabel();
        jLabel5.setText("Pin Labels");
        jLabel5.setForeground(Color.MAGENTA);
        GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
        gridBagConstraints8.gridx = 0;
        gridBagConstraints8.anchor = GridBagConstraints.EAST;
        gridBagConstraints8.insets = new Insets(0, 3, 0, 0);
        gridBagConstraints8.gridy = 6;
        jLabel4 = new JLabel();
        jLabel4.setText("Taxon Name Label");
        jLabel4.setForeground(Color.BLUE);
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.gridx = 0;
        gridBagConstraints7.anchor = GridBagConstraints.EAST;
        gridBagConstraints7.gridy = 5;
        jLabel3 = new JLabel();
        jLabel3.setText("Barcode");
        jLabel3.setForeground(Color.RED);
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.gridx = 0;
        gridBagConstraints6.anchor = GridBagConstraints.EAST;
        gridBagConstraints6.gridy = 3;
        jLabel2 = new JLabel();
        jLabel2.setText("Image Size");
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.fill = GridBagConstraints.BOTH;
        gridBagConstraints5.gridy = 2;
        gridBagConstraints5.weightx = 1.0;
        gridBagConstraints5.anchor = GridBagConstraints.WEST;
        gridBagConstraints5.gridx = 1;
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.fill = GridBagConstraints.BOTH;
        gridBagConstraints4.gridy = 1;
        gridBagConstraints4.weightx = 1.0;
        gridBagConstraints4.anchor = GridBagConstraints.WEST;
        gridBagConstraints4.gridx = 1;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.anchor = GridBagConstraints.EAST;
        gridBagConstraints2.gridy = 2;
        jLabel1 = new JLabel();
        jLabel1.setText("Name");
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.anchor = GridBagConstraints.EAST;
        gridBagConstraints1.gridy = 1;
        jLabel = new JLabel();
        jLabel.setText("Template ID");
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 11;
        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.add(getJButtonSave(), gridBagConstraints);
        jPanel.add(jLabel, gridBagConstraints1);
        jPanel.add(jLabel1, gridBagConstraints2);
        jPanel.add(getJTextFieldTemplateId(), gridBagConstraints4);
        jPanel.add(getJTextFieldName(), gridBagConstraints5);
        jPanel.add(jLabel2, gridBagConstraints6);
        jPanel.add(jLabel3, gridBagConstraints7);
        jPanel.add(jLabel4, gridBagConstraints8);
        jPanel.add(jLabel5, gridBagConstraints9);
        jPanel.add(jLabel6, gridBagConstraints10);
        jPanel.add(jLabel7, gridBagConstraints11);
        jPanel.add(getJTextField2(), gridBagConstraints12);
        jPanel.add(getJTextField3(), gridBagConstraints14);
        jPanel.add(getJTextField4(), gridBagConstraints15);
        jPanel.add(getJTextField5(), gridBagConstraints16);
        jPanel.add(getJTextField6(), gridBagConstraints17);
        jPanel.add(getJTextField7(), gridBagConstraints18);
        jPanel.add(jLabel8, gridBagConstraints13);
        jPanel.add(getJTextField8(), gridBagConstraints21);
        jPanel.add(jLabelFeedback, gridBagConstraints110);
        jPanel.add(getJButton(), gridBagConstraints111);
        jPanel.add(getJTextFieldBarcodeScan(), gridBagConstraints22);
        jPanel.add(getJButton1(), gridBagConstraints112);
        jPanel.add(getJTextField(), gridBagConstraints23);
        jPanel.add(jLabel9, gridBagConstraints113);
        jPanel.add(getJTextField9(), gridBagConstraints24);
    }
    return jPanel;
}

From source file:cs.stats.gui.StatsCharts.java

private ChartPanel createChart(String axisLabel, int type) {
    int width = (screenSize.width - (screenSize.width / 35));
    int height = (int) (screenSize.height - (screenSize.height / (double) 4));

    //int width = (screenSize.width - (screenSize.width / 35)) / 2;
    //int height = (int) (screenSize.height - (screenSize.height / (double) 4)) / 2;

    lastValue = new double[SUBPLOT_COUNT];
    //================= visualise standard chart ==========================
    CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new DateAxis("Time"));

    lastValue[0] = 100D;/*from   www .  j  ava 2  s  .  c om*/
    TimeSeries timeseries = null;
    XYPlot xyplot = null;

    //add new timeseries to modularity row
    datasets[type] = new TimeSeriesCollection();

    NumberAxis numberaxis = new NumberAxis(axisLabel);
    numberaxis.setAutoRangeIncludesZero(true);

    //fast
    StandardXYItemRenderer xyItemRender = new StandardXYItemRenderer();
    //original
    //xyItemRender = new StandardXYItemRenderer();

    xyItemRender.setSeriesStroke(0,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(1,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(2,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(3,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(4,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(5,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(6,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(7,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(8,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(9,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));

    //TODO colours need to be defined statically before the renderer is created!
    xyplot = new XYPlot(datasets[type], null, numberaxis, xyItemRender);

    switch (type) {
    case 0: {
        xyItemRender.setSeriesPaint(0, Color.BLACK);
        timeseries = new TimeSeries("Reply rate 1.0", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("Reply rate 0.9", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(2, Color.ORANGE);
        timeseries = new TimeSeries("Reply rate 0.8", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(3, Color.GREEN);
        timeseries = new TimeSeries("Reply rate 0.7", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(4, Color.MAGENTA);
        timeseries = new TimeSeries("Reply rate 0.6", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY);
        timeseries = new TimeSeries("Reply rate 0.5", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(6, Color.YELLOW);
        timeseries = new TimeSeries("Reply rate 0.4", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        //            xyItemRender.setSeriesPaint(7, Color.PINK);
        //            timeseries = new TimeSeries("Reply rate 0.3", org.jfree.data.time.Hour.class);
        //            datasets[type].addSeries(timeseries);
        //
        //            xyItemRender.setSeriesPaint(8, Color.RED);
        //            timeseries = new TimeSeries("Reply rate 0.2", org.jfree.data.time.Hour.class);
        //            datasets[type].addSeries(timeseries);
        //
        //            xyItemRender.setSeriesPaint(9, Color.CYAN);
        //            timeseries = new TimeSeries("Reply rate 0.1", org.jfree.data.time.Hour.class);
        //            datasets[type].addSeries(timeseries);
    }
        break;
    case 1: {
        xyItemRender.setSeriesPaint(0, Color.BLACK);
        timeseries = new TimeSeries("0% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("1% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(2, Color.ORANGE);
        timeseries = new TimeSeries("2% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(3, Color.GREEN);
        timeseries = new TimeSeries("3% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(4, Color.MAGENTA);
        timeseries = new TimeSeries("3.5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY);
        timeseries = new TimeSeries("4% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(6, Color.YELLOW);
        timeseries = new TimeSeries("4.5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(7, Color.PINK);
        timeseries = new TimeSeries("5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(8, Color.RED);
        timeseries = new TimeSeries("5.5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(9, Color.CYAN);
        timeseries = new TimeSeries("6% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 2: {
        xyItemRender.setSeriesPaint(0, Color.GRAY);
        timeseries = new TimeSeries("Average number of thread replies (per hour)",
                org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 3: {
        xyItemRender.setSeriesPaint(0, Color.GREEN);
        timeseries = new TimeSeries("New thread arrival activity change (%)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("Thread reply activity change (%)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 4: {
        xyItemRender.setSeriesPaint(0, Color.GREEN);
        timeseries = new TimeSeries("Mean thread aswer time", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    }

    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    //rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setTickUnit(new NumberTickUnit(0.1));

    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    combineddomainxyplot.add(xyplot);

    ChartPanel chart = null;

    switch (type) {
    case 0: {
        jfreechart1 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart1.getSubtitle(0);

        //set legend fonts
        jfreechart1.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart1.setBorderPaint(Color.black);
        jfreechart1.setBorderVisible(true);
        jfreechart1.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis1 = combineddomainxyplot.getDomainAxis();

        dateAxis1 = (DateAxis) valueAxis1;
        dateAxis1.setTickUnit(new DateTickUnit(1, 1));

        if (scope1 == 0) {
            valueAxis1.setAutoRange(true);
        } else {
            valueAxis1.setFixedAutoRange(scope1);
        }

        chart = new ChartPanel(jfreechart1);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        //chart.add(buildPlotDisplayManagementPanel(valueAxis1, dateAxis1, ddlScope1));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart1.setAntiAlias(false);
    }
        break;
    case 1: {

        jfreechart2 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart2.getSubtitle(0);

        //set legend fonts
        jfreechart2.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart2.setBorderPaint(Color.black);
        jfreechart2.setBorderVisible(true);
        jfreechart2.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis2 = combineddomainxyplot.getDomainAxis();
        dateAxis2 = (DateAxis) valueAxis2;
        dateAxis2.setTickUnit(new DateTickUnit(1, 1));

        if (scope2 == 0) {
            valueAxis2.setAutoRange(true);
        } else {
            valueAxis2.setFixedAutoRange(scope2);
        }

        chart = new ChartPanel(jfreechart2);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart2.setAntiAlias(false);
    }
        break;
    case 2: {

        jfreechart3 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart3.getSubtitle(0);

        //set legend fonts
        jfreechart3.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart3.setBorderPaint(Color.black);
        jfreechart3.setBorderVisible(true);
        jfreechart3.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis3 = combineddomainxyplot.getDomainAxis();
        dateAxis3 = (DateAxis) valueAxis3;

        if (scope3 == 0) {
            valueAxis3.setAutoRange(true);
        } else {
            valueAxis3.setFixedAutoRange(scope3);
        }

        chart = new ChartPanel(jfreechart3);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis3, dateAxis3, ddlScope3));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart3.setAntiAlias(false);
    }
        break;
    case 3: {
        jfreechart4 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart4.getSubtitle(0);

        //set legend fonts
        jfreechart4.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart4.setBorderPaint(Color.black);
        jfreechart4.setBorderVisible(true);
        jfreechart4.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis4 = combineddomainxyplot.getDomainAxis();
        dateAxis4 = (DateAxis) valueAxis4;

        if (scope4 == 0) {
            valueAxis4.setAutoRange(true);
        } else {
            valueAxis4.setFixedAutoRange(scope4);
        }

        chart = new ChartPanel(jfreechart4);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis4, dateAxis4, ddlScope4));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart4.setAntiAlias(false);
    }
        break;
    case 4: {
        jfreechart5 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart5.getSubtitle(0);

        //set legend fonts
        jfreechart5.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart5.setBorderPaint(Color.black);
        jfreechart5.setBorderVisible(true);
        jfreechart5.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis5 = combineddomainxyplot.getDomainAxis();
        dateAxis5 = (DateAxis) valueAxis5;

        if (scope5 == 0) {
            valueAxis5.setAutoRange(true);
        } else {
            valueAxis5.setFixedAutoRange(scope5);
        }

        chart = new ChartPanel(jfreechart5);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis5, dateAxis5, ddlScope5));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart5.setAntiAlias(false);
    }
        break;
    }

    return chart;

}

From source file:it.unibo.alchemist.boundary.monitors.Generic2DDisplay.java

/**
 * Actually draws the environment on the view.
 * //from www . java 2 s .  co  m
 * @param g
 *            {@link Graphics2D} object responsible for drawing
 */
protected final void drawEnvOnView(final Graphics2D g) {
    if (wormhole == null || !isVisible() || !isEnabled()) {
        return;
    }
    accessData();
    if (hooked.isPresent()) {
        final Position hcoor = positions.get(hooked.get());
        final Point hp = wormhole.getViewPoint(hcoor);
        if (hp.distance(getCenter()) > FREEDOM_RADIUS) {
            wormhole.setViewPosition(hp);
        }
    }
    /*
     * Compute nodes in sight and their screen position
     */
    final Map<Node<T>, Point> onView = positions.entrySet().parallelStream()
            .map(pair -> new Pair<>(pair.getKey(), wormhole.getViewPoint(pair.getValue())))
            .filter(p -> wormhole.isInsideView(p.getSecond()))
            .collect(Collectors.toMap(Pair::getKey, Pair::getValue));
    g.setColor(Color.BLACK);
    if (obstacles != null) {
        /*
         * TODO: only draw obstacles if on view
         */
        obstacles.parallelStream().map(this::convertObstacle).forEachOrdered(g::fill);
    }
    if (paintLinks) {
        g.setColor(Color.GRAY);
        onView.keySet().parallelStream().map(neighbors::get)
                .flatMap(neigh -> neigh.getNeighbors().parallelStream()
                        .map(node -> node.compareTo(neigh.getCenter()) > 0 ? new Pair<>(neigh.getCenter(), node)
                                : new Pair<>(node, neigh.getCenter())))
                .distinct().map(
                        pair -> mapPair(pair,
                                node -> Optional.ofNullable(onView.get(node))
                                        .orElse(wormhole.getViewPoint(positions.get(node)))))
                .forEachOrdered(line -> {
                    final Point p1 = line.getFirst();
                    final Point p2 = line.getSecond();
                    g.drawLine(p1.x, p1.y, p2.x, p2.y);
                });
    }
    releaseData();
    if (isDraggingMouse && status == ViewStatus.MOVING && originPoint.isPresent() && endingPoint.isPresent()) {
        for (final Node<T> n : selectedNodes) {
            if (onView.containsKey(n)) {
                onView.put(n, new Point(onView.get(n).x + (endingPoint.get().x - originPoint.get().x),
                        onView.get(n).y + (endingPoint.get().y - originPoint.get().y)));
            }
        }
    }
    g.setColor(Color.GREEN);
    if (effectStack != null) {
        effectStack.forEach(effect -> {
            onView.entrySet().forEach(entry -> {
                final Point p = entry.getValue();
                effect.apply(g, entry.getKey(), p.x, p.y);
            });
        });
    }
    if (isCloserNodeMarked()) {
        final Optional<Map.Entry<Node<T>, Point>> closest = onView.entrySet().parallelStream()
                .min((pair1, pair2) -> {
                    final Point p1 = pair1.getValue();
                    final Point p2 = pair2.getValue();
                    final double d1 = Math.hypot(p1.x - mousex, p1.y - mousey);
                    final double d2 = Math.hypot(p2.x - mousex, p2.y - mousey);
                    return Double.compare(d1, d2);
                });
        if (closest.isPresent()) {
            nearest = closest.get().getKey();
            final int nearestx = closest.get().getValue().x;
            final int nearesty = closest.get().getValue().y;
            drawFriedEgg(g, nearestx, nearesty, Color.RED, Color.YELLOW);
        }
    } else {
        nearest = null;
    }
    if (isDraggingMouse && status == ViewStatus.SELECTING && originPoint.isPresent()
            && endingPoint.isPresent()) {
        g.setColor(Color.BLACK);
        final int x = originPoint.get().x < endingPoint.get().x ? originPoint.get().x : endingPoint.get().x;
        final int y = originPoint.get().y < endingPoint.get().y ? originPoint.get().y : endingPoint.get().y;
        final int width = Math.abs(endingPoint.get().x - originPoint.get().x);
        final int height = Math.abs(endingPoint.get().y - originPoint.get().y);
        g.drawRect(x, y, width, height);
        selectedNodes = onView.entrySet().parallelStream()
                .filter(nodes -> isInsideRectangle(nodes.getValue(), x, y, width, height))
                .map(onScreen -> onScreen.getKey()).collect(Collectors.toSet());
    }
    selectedNodes.parallelStream().map(e -> Optional.ofNullable(onView.get(e))).filter(Optional::isPresent)
            .map(Optional::get).forEachOrdered(p -> drawFriedEgg(g, p.x, p.y, Color.BLUE, Color.CYAN));
}