Example usage for java.awt Color YELLOW

List of usage examples for java.awt Color YELLOW

Introduction

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

Prototype

Color YELLOW

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

Click Source Link

Document

The color yellow.

Usage

From source file:org.cyberoam.iview.charts.MeterChart.java

/**
 * This method generates JFreeChart instance for Meter chart with dial port and iView customization.
 * @param reportID//from ww w  . j  a  v a 2s.c  o  m
 * @param rsw
 * @param request
 * @return
 */
public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) {
    ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID);
    JFreeChart chart = null;
    ReportColumnBean reportColumnBean = null;
    GraphBean graphBean = null;
    try {
        DefaultValueDataset data = null;
        graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());
        reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(),
                graphBean.getYColumnId());
        String yColumnDBname = reportColumnBean.getDbColumnName();
        rsw.first();
        double used = Double.parseDouble(rsw.getString(yColumnDBname));
        data = new DefaultValueDataset(100 - used);
        DialPlot plot = new DialPlot(data);
        chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false);

        chart.setBackgroundPaint(Color.white);
        int imgWidth = graphBean.getWidth();
        int imgHeight = graphBean.getHeight();
        if (request != null && request.getParameter("imgwidth") != null
                && !"".equalsIgnoreCase(request.getParameter("imgwidth"))
                && !"null".equalsIgnoreCase(request.getParameter("imgwidth"))) {
            imgWidth = Integer.parseInt(request.getParameter("imgwidth"));
        }
        if (request != null && request.getParameter("imgheight") != null
                && !"".equalsIgnoreCase(request.getParameter("imgheight"))
                && !"null".equalsIgnoreCase(request.getParameter("imgheight"))) {
            imgHeight = Integer.parseInt(request.getParameter("imgheight"));
        }
        plot.setView((1 - ((double) imgWidth / (double) imgHeight)) / 2, plot.getViewY(),
                ((double) imgWidth / (double) imgHeight), plot.getViewHeight());
        StandardDialFrame dialFrame = new StandardDialFrame();
        dialFrame.setBackgroundPaint(new Color(54, 73, 109));
        dialFrame.setRadius(0.8);
        dialFrame.setStroke(new BasicStroke(0));
        plot.setDialFrame(dialFrame);
        GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(),
                new Color(196, 210, 219));
        DialBackground db = new DialBackground(gp);
        db.setGradientPaintTransformer(
                new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
        plot.setBackground(db);

        DialValueIndicator dvi = new DialValueIndicator(0);
        dvi.setRadius(0.55);
        dvi.setBackgroundPaint(gp);
        dvi.setNumberFormat(new DecimalFormat("###"));
        dvi.setFont(new Font("Vandara", Font.CENTER_BASELINE, 10));
        dvi.setOutlinePaint(Color.lightGray);
        plot.addLayer(dvi);

        StandardDialScale scale = new StandardDialScale(0, 100, -120, -300, 10, 4);
        scale.setTickRadius(0.75);
        scale.setTickLabelOffset(0.15);
        scale.setTickLabelFont(new Font("Vandara", Font.CENTER_BASELINE, 9));
        plot.addScale(0, scale);

        StandardDialRange range = new StandardDialRange(0.0, 50.0, Color.green);
        range.setInnerRadius(0.35);
        range.setOuterRadius(0.38);
        plot.addLayer(range);

        StandardDialRange range2 = new StandardDialRange(50.0, 75.0, Color.yellow);
        range2.setInnerRadius(0.35);
        range2.setOuterRadius(0.38);
        plot.addLayer(range2);

        StandardDialRange range3 = new StandardDialRange(75.0, 100.0, Color.red);
        range3.setInnerRadius(0.35);
        range3.setOuterRadius(0.38);
        plot.addLayer(range3);

        DialPointer needle = new DialPointer.Pointer();
        needle.setRadius(0.55);
        plot.addLayer(needle);

        DialCap cap = new DialCap();
        cap.setRadius(0.05);
        plot.setCap(cap);

    } catch (Exception e) {
        CyberoamLogger.appLog.debug("MeterChart=>Exception : " + e, e);
    }
    return chart;
}

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

/**
 * create an instance of a simple graph with controls to
 * demo the zoomand hyperbolic features.
 * //from  w  ww .ja v  a2s.  c  om
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public RadialTreeLensDemo() {

    // create a simple graph for the demo
    // create a simple graph for the demo
    graph = new DelegateForest<String, Integer>();

    createTree();

    layout = new TreeLayout<String, Integer>(graph);
    radialLayout = new RadialTreeLayout<String, Integer>(graph);
    radialLayout.setSize(new Dimension(600, 600));

    Dimension preferredSize = new Dimension(600, 600);

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

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

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());

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

    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());
    rings = new Rings();
    vv.addPreRenderPaintable(rings);

    hyperbolicViewSupport = new ViewLensSupport<String, Integer>(vv,
            new HyperbolicShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse());

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

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

    graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener());

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

    JPanel controls = new JPanel();
    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);
    JPanel modeControls = new JPanel(new BorderLayout());
    modeControls.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modeControls.add(graphMouse.getModeComboBox());
    hyperControls.add(hyperView);

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

From source file:com.greenpepper.confluence.macros.historic.LinearExecutionChartBuilder.java

private void customizeChart(JFreeChart chart) throws IOException {
    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(settings.isBorder());

    TextTitle chartTitle = chart.getTitle();
    customizeTitle(chartTitle, DEFAULT_TITLE_FONT);

    addSubTitle(chart, settings.getSubTitle(), DEFAULT_SUBTITLE_FONT);
    addSubTitle(chart, settings.getSubTitle2(), DEFAULT_SUBTITLE2_FONT);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage(gpUtil.getText("greenpepper.historic.nodata"));

    CategoryItemRenderer renderer = plot.getRenderer();

    int index = 0;
    renderer.setSeriesPaint(index++, GREEN_COLOR);
    if (settings.isShowIgnored())
        renderer.setSeriesPaint(index++, Color.yellow);
    renderer.setSeriesPaint(index, Color.red);

    renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    renderer.setItemURLGenerator(new CategoryURLGenerator() {

        public String generateURL(CategoryDataset data, int series, int category) {
            Comparable valueKey = data.getColumnKey(category);
            ChartLongValue value = (ChartLongValue) valueKey;
            return "javascript:" + settings.getExecutionUID() + "_showExecutionResult('" + value.getId()
                    + "');";
        }//from w w  w .  j a  v  a  2  s  .co  m
    });

    CategoryAxis domainAxis = plot.getDomainAxis();
    customizeAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);

    ValueAxis rangeAxis = plot.getRangeAxis();
    customizeAxis(rangeAxis);
    rangeAxis.setLowerBound(0);

    if (rangeAxis instanceof NumberAxis) {
        ((NumberAxis) rangeAxis).setTickUnit(new NumberTickUnit(1));
    }

    plot.setForegroundAlpha(0.8f);
}

From source file:fungus.JungObserver.java

public JungObserver(String name) {
    this.name = name;
    this.hyphadataPid = Configuration.getPid(name + "." + PAR_HYPHADATA_PROTO);
    this.hyphalinkPid = Configuration.getPid(name + "." + PAR_HYPHALINK_PROTO);
    this.mycocastPid = Configuration.getPid(name + "." + PAR_MYCOCAST_PROTO);
    self = this;/*from   w  w w  .  java  2s . com*/
    mainThread = Thread.currentThread();

    graph = new DirectedSparseGraph<MycoNode, String>();
    edu.uci.ics.jung.algorithms.layout.SpringLayout<MycoNode, String> layout = new edu.uci.ics.jung.algorithms.layout.SpringLayout<MycoNode, String>(
            graph);
    layout.setSize(new Dimension(650, 650));
    layout.setRepulsionRange(75);
    //layout.setForceMultiplier(0.75);
    layout.setStretch(0.85);

    Dimension preferredSize = new Dimension(650, 650);
    VisualizationModel<MycoNode, String> visualizationModel = new DefaultVisualizationModel<MycoNode, String>(
            layout, preferredSize);
    visualizer = new VisualizationViewer<MycoNode, String>(visualizationModel, preferredSize);
    visualizer.addGraphMouseListener(new InfoFrameVertexListener());

    //visualizer = new BasicVisualizationServer<Node,String>(layout);
    //visualizer.setPreferredSize(new Dimension(650, 650));

    Transformer<MycoNode, String> nodeLabeller = new Transformer<MycoNode, String>() {
        public String transform(MycoNode n) {
            return Long.toString(n.getID());
        }
    };

    final Shape biomassCircle = new Ellipse2D.Float(-2.5f, -2.5f, 5.0f, 5.0f);
    final Shape hyphaCircle = new Ellipse2D.Float(-5.0f, -5.0f, 10.0f, 10.0f);
    Transformer<MycoNode, Shape> shapeTransformer = new Transformer<MycoNode, Shape>() {
        public Shape transform(MycoNode n) {
            HyphaData data = n.getHyphaData();
            if (data.isBiomass()) {
                return biomassCircle;
            } else {
                return hyphaCircle;
            }
        }

    };

    Transformer<MycoNode, Paint> nodeFillRenderer = new Transformer<MycoNode, Paint>() {
        public Paint transform(MycoNode n) {
            HyphaData data = (HyphaData) n.getProtocol(hyphadataPid);
            if (!n.isUp()) {
                return Color.BLACK;
            }
            if (data.isBiomass()) {
                return Color.BLUE;
            } else if (data.isExtending()) {
                return Color.RED;
            } else if (data.isBranching()) {
                return Color.YELLOW;
            } else {
                return Color.GREEN;
            }
        }
    };
    Transformer<MycoNode, Paint> nodeShapeRenderer = new Transformer<MycoNode, Paint>() {
        public Paint transform(MycoNode n) {
            HyphaData data = (HyphaData) n.getProtocol(hyphadataPid);
            if (data.isBiomass()) {
                return Color.BLUE;
            } else if (data.isExtending()) {
                return Color.RED;
            } else if (data.isBranching()) {
                return Color.YELLOW;
            } else {
                return Color.GREEN;
            }
        }
    };

    final Stroke biomassStroke = new BasicStroke(0.25f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f);
    final Stroke hyphalStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f);

    Transformer<String, Stroke> edgeStrokeTransformer = new Transformer<String, Stroke>() {
        public Stroke transform(String s) {
            Pair<MycoNode> vertices = graph.getEndpoints(s);
            HyphaData firstData = vertices.getFirst().getHyphaData();
            HyphaData secondData = vertices.getSecond().getHyphaData();
            if (firstData.isHypha() && secondData.isHypha()) {
                return hyphalStroke;
            } else {
                return biomassStroke;
            }
        }
    };

    visualizer.getRenderContext().setVertexFillPaintTransformer(nodeFillRenderer);
    visualizer.getRenderContext().setVertexShapeTransformer(shapeTransformer);
    visualizer.getRenderContext().setVertexLabelTransformer(nodeLabeller);
    visualizer.setVertexToolTipTransformer(new ToStringLabeller<MycoNode>());
    visualizer.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container c = frame.getContentPane();
    c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));

    //JScrollPane scrollPane = new JScrollPane(visualizer);
    //c.add(scrollPane);
    c.add(visualizer);

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));

    JButton pauseButton = new JButton("pause");
    ActionListener pauser = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //e.consume();
            synchronized (self) {
                stepBlocked = true;
                noBlock = false;
                //self.notifyAll();
            }
        }
    };
    pauseButton.addActionListener(pauser);

    JButton stepButton = new JButton("step");
    ActionListener stepper = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("Clicked!\n");
            //e.consume();
            synchronized (self) {
                stepBlocked = false;
                self.notifyAll();
            }
        }
    };
    stepButton.addActionListener(stepper);

    JButton runButton = new JButton("run");
    ActionListener runner = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //e.consume();
            synchronized (self) {
                stepBlocked = false;
                noBlock = true;
                self.notifyAll();
            }
        }
    };
    runButton.addActionListener(runner);

    buttonPane.add(pauseButton);
    buttonPane.add(stepButton);
    buttonPane.add(runButton);
    c.add(buttonPane);

    frame.pack();
    frame.setVisible(true);
}

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

protected static String detectXColorClassic(Color color) {
    String retour = null;/* w  ww  . java  2  s  . c om*/

    int red = color.getRed();
    int green = color.getGreen();
    int blue = color.getBlue();

    // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha
    if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen())
        return "green";
    else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen())
        return "red";
    else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen())
        return "white";
    else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen())
        return "gray";
    else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen())
        return "black";
    else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen())
        return "yellow";
    else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue()
            && green == Color.MAGENTA.getGreen())
        return "magenta";
    else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen())
        return "cyan";
    else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen())
        return "blue";
    else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue()
            && green == Color.DARK_GRAY.getGreen())
        return "darkgray";
    else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue()
            && green == Color.LIGHT_GRAY.getGreen())
        return "lightgray";
    else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen())
        return "orange";
    else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen())
        return "pink";

    if (red == 192 && blue == 128 && green == 64)
        return "brown";
    else if (red == 128 && blue == 128 && green == 0)
        return "olive";
    else if (red == 128 && blue == 0 && green == 128)
        return "violet";
    else if (red == 192 && blue == 0 && green == 64)
        return "purple";
    else
        return null;
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.bargraph.AnimatedBarGraph.java

private static JFreeChart createChart(BarGraphDataSeries dataSeries) {
    if (dataSeries == null)
        return null;

    BarGraphDataSeries ds = dataSeries;/*  w  w w. ja va 2s  .c o  m*/

    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart(ds.getTitle(), // chart title
            ds.getDomainLabel(), // domain axis label
            ds.getRangeLabel(), // range axis label
            ds.getDataSet(0), // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // get a reference to the plot for further customization...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setDomainGridlinesVisible(true);

    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    GradientPaint gp3 = new GradientPaint(0.0f, 0.0f, Color.yellow, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
    renderer.setSeriesPaint(3, gp3);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    ValueRange vr = ds.getRangeValueRanges().get(0);
    if (vr != null) {
        Range range = new Range(vr.getMin() / vr.getScale(), vr.getMax() / vr.getScale());
        rangeAxis.setRange(range);
    }
    return chart;

}

From source file:com.seleniumtests.it.driver.TestBrowserSnapshot.java

/**
 * Test page contains fixed header (yellow) and footer (orange) of 5 pixels height. Detect how many
 * pixels of these colors are present in picture
 * Also count red pixels which is a line not to remove when cropping
 * @param picture//from  ww  w  .j  ava 2s.c  o  m
 * @return
 * @throws IOException 
 */
private int[] getHeaderAndFooterPixels(File picture) throws IOException {
    BufferedImage image = ImageIO.read(picture);

    int topPixels = 0;
    int bottomPixels = 0;
    int securityLine = 0;
    for (int height = 0; height < image.getHeight(); height++) {
        Color color = new Color(image.getRGB(0, height));
        if (color.equals(Color.YELLOW)) {
            topPixels++;
        } else if (color.equals(Color.ORANGE)) {
            bottomPixels++;
        } else if (color.equals(Color.RED) || color.equals(Color.GREEN)) {
            securityLine++;
        }
    }

    return new int[] { topPixels, bottomPixels, securityLine };
}

From source file:cimat.tesis.sna.visualization.ShowLayouts.java

private static JPanel getGraphPanel() {
    g_array = (Graph<? extends Object, ? extends Object>[]) new Graph<?, ?>[graph_names.length];

    Factory<Graph<Integer, Number>> graphFactory = new Factory<Graph<Integer, Number>>() {
        public Graph<Integer, Number> create() {
            return new SparseMultigraph<Integer, Number>();
        }/* w  w  w  .  j  a  v a  2  s .  c  o  m*/
    };

    Factory<Integer> vertexFactory = new Factory<Integer>() {
        int count;

        public Integer create() {
            return count++;
        }
    };
    Factory<Number> edgeFactory = new Factory<Number>() {
        int count;

        public Number create() {
            return count++;
        }
    };

    g_array[0] = TestGraphs.createTestGraph(false);
    g_array[1] = MixedRandomGraphGenerator.generateMixedRandomGraph(graphFactory, vertexFactory, edgeFactory,
            new HashMap<Number, Number>(), 20, true, new HashSet<Integer>());
    g_array[2] = TestGraphs.getDemoGraph();
    g_array[3] = TestGraphs.createDirectedAcyclicGraph(4, 4, 0.3);
    g_array[4] = TestGraphs.getOneComponentGraph();
    g_array[5] = TestGraphs.createChainPlusIsolates(18, 5);
    g_array[6] = TestGraphs.createChainPlusIsolates(0, 20);

    Graph<? extends Object, ? extends Object> g = g_array[4]; // initial graph

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

    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.red, Color.yellow));

    final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(graphMouse);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });
    JButton reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Layout<Integer, Number> layout = vv.getGraphLayout();
            layout.initialize();
            Relaxer relaxer = vv.getModel().getRelaxer();
            if (relaxer != null) {
                //            if(layout instanceof IterativeContext) {
                relaxer.stop();
                relaxer.prerelax();
                relaxer.relax();
            }
        }
    });

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv.getGraphMouse()).getModeListener());

    JPanel jp = new JPanel();
    jp.setBackground(Color.WHITE);
    jp.setLayout(new BorderLayout());
    jp.add(vv, BorderLayout.CENTER);
    Class[] combos = getCombos();
    final JComboBox jcb = new JComboBox(combos);
    // use a renderer to shorten the layout name presentation
    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);
    jp.add(control_panel, BorderLayout.NORTH);

    final JComboBox graph_chooser = new JComboBox(graph_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);
    return jp;
}

From source file:it.alus.GPSreceiver.instruments.Speedometer.java

public Speedometer(int Vs0, int Vfe, int Vs, int Vno, int Vne, int endScaleKmh) {
    super(null);//from   w  w  w .  j ava2 s .co  m
    currentGroundSpeedKmh = 0;
    if (!setArcs(Vs0, Vfe, Vs, Vno, Vne, endScaleKmh)) {
        this.Vx = 90;
        this.Vy = 100;
        this.Vs0 = 45;
        this.Vs = 55;
        this.Vfe = 86;
        this.Va = 135;
        this.Vno = 160;
        this.Vne = 180;
        this.endScale = 185;
    }
    groundSpeedDataset = new DefaultValueDataset(0);
    totalSpeedDataset = new DefaultValueDataset(0);
    DialPlot dialplot = new DialPlot();
    dialplot.setDataset(0, groundSpeedDataset);
    dialplot.setDataset(1, totalSpeedDataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialBackground db = new DialBackground(Color.black);
    dialplot.setBackground(db);
    dialplot.setDialFrame(dialFrame);

    DialTextAnnotation dialtextannotation = new DialTextAnnotation("Km/h");
    dialtextannotation.setFont(new Font("Arial", 1, 14));
    dialtextannotation.setRadius(0.4D);
    dialtextannotation.setPaint(Color.lightGray);
    dialplot.addLayer(dialtextannotation);

    //DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
    //dialplot.addLayer(dialvalueindicator);
    DialValueIndicator groundIndicator = new DialValueIndicator(0);
    groundIndicator.setFont(new Font("Dialog", 0, 10));
    groundIndicator.setOutlinePaint(Color.green);
    groundIndicator.setRadius(0.3);
    groundIndicator.setAngle(-110D);
    dialplot.addLayer(groundIndicator);
    DialValueIndicator realIndicator = new DialValueIndicator(1);
    realIndicator.setFont(new Font("Dialog", 0, 10));
    realIndicator.setOutlinePaint(Color.cyan);
    realIndicator.setRadius(0.3);
    realIndicator.setAngle(-70);
    dialplot.addLayer(realIndicator);
    StandardDialScale scale = new StandardDialScale(0, endScale, 90, -350, 10, 5);
    scale.setFirstTickLabelVisible(true);
    scale.setTickRadius(0.9D);
    scale.setTickLabelOffset(0.14999999999999999D);
    NumberFormat formatter = new DecimalFormat("#");
    scale.setTickLabelFormatter(formatter);
    scale.setTickLabelFont(new Font("Arial", Font.BOLD, 16));
    scale.setMajorTickPaint(Color.white);
    scale.setMinorTickPaint(Color.lightGray);
    scale.setTickLabelPaint(Color.white);
    dialplot.addScale(0, scale);
    dialplot.addPointer(new org.jfree.chart.plot.dial.DialPointer.Pin());
    DialCap dialcap = new DialCap();
    dialcap.setRadius(0.10);
    dialcap.setFillPaint(Color.lightGray);
    dialplot.setCap(dialcap);
    jChart = new JFreeChart(dialplot);
    StandardDialRange standarddialrange = new StandardDialRange(this.Vne, endScale, Color.red);
    standarddialrange.setInnerRadius(0.54D);
    standarddialrange.setOuterRadius(0.56D);
    dialplot.addLayer(standarddialrange);
    StandardDialRange standarddialrange1 = new StandardDialRange(this.Vno, this.Vne, Color.yellow);
    standarddialrange1.setInnerRadius(0.54D);
    standarddialrange1.setOuterRadius(0.56D);
    dialplot.addLayer(standarddialrange1);
    StandardDialRange standarddialrange2 = new StandardDialRange(this.Vs, this.Vno, Color.green);
    standarddialrange2.setInnerRadius(0.54D);
    standarddialrange2.setOuterRadius(0.56D);
    dialplot.addLayer(standarddialrange2);
    StandardDialRange standarddialrange3 = new StandardDialRange(this.Vs0, this.Vfe, Color.white);
    standarddialrange3.setInnerRadius(0.50D);
    standarddialrange3.setOuterRadius(0.52D);
    dialplot.addLayer(standarddialrange3);
    //dialplot.removePointer(0);
    Pointer realPointer = new Pointer(1);
    realPointer.setFillPaint(Color.cyan);
    dialplot.addPointer(realPointer);
    Pointer groundPointer = new Pointer(0);
    groundPointer.setFillPaint(Color.green);
    dialplot.addPointer(groundPointer);

    /* PER NASCONDERE GLI INDICATORI
    groundIndicator.setVisible(false);
    realIndicator.setVisible(false);
    groundPointer.setVisible(false);
    realPointer.setVisible(false);
    */

    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}

From source file:info.novatec.testit.livingdoc.confluence.macros.historic.AggregationExecutionChartBuilder.java

@SuppressWarnings("deprecation")
private void customizeChart(JFreeChart chart) throws IOException {
    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(settings.isBorder());

    TextTitle chartTitle = chart.getTitle();
    customizeTitle(chartTitle, DEFAULT_TITLE_FONT);

    addSubTitle(chart, settings.getSubTitle(), DEFAULT_SUBTITLE_FONT);
    addSubTitle(chart, settings.getSubTitle2(), DEFAULT_SUBTITLE2_FONT);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage(ldUtil.getText("livingdoc.historic.nodata"));

    StackedBarRenderer renderer = new StackedBarRenderer(true);
    plot.setRenderer(renderer);/*  ww  w . j a  v a2  s. c om*/

    int index = 0;
    renderer.setSeriesPaint(index++, GREEN_COLOR);
    if (settings.isShowIgnored()) {
        renderer.setSeriesPaint(index++, Color.yellow);
    }
    renderer.setSeriesPaint(index, Color.red);

    renderer.setToolTipGenerator(new DefaultTooltipGenerator());
    renderer.setItemURLGenerator(new CategoryURLGenerator() {

        @Override
        public String generateURL(CategoryDataset data, int series, int category) {
            Comparable<?> valueKey = data.getColumnKey(category);
            ChartLongValue value = (ChartLongValue) valueKey;
            return "javascript:" + settings.getExecutionUID() + "_showHistoricChart('" + value.getId() + "');";
        }
    });

    CategoryAxis domainAxis = plot.getDomainAxis();
    customizeAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setCategoryMargin(0.01);

    ValueAxis rangeAxis = plot.getRangeAxis();
    customizeAxis(rangeAxis);
    rangeAxis.setLowerBound(0);
    rangeAxis.setUpperBound(1.0);

    if (rangeAxis instanceof NumberAxis) {
        NumberAxis numberAxis = (NumberAxis) rangeAxis;
        numberAxis.setTickUnit(new NumberTickUnit(.10));
        numberAxis.setNumberFormatOverride(PERCENT_FORMATTER);
    }

    plot.setForegroundAlpha(0.8f);
}