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:edu.uci.ics.jung.samples.UnicodeLabelDemo.java

@SuppressWarnings("unchecked")
public UnicodeLabelDemo() {

    // create a simple graph for the demo
    graph = new DirectedSparseGraph<Integer, Number>();
    Integer[] v = createVertices(10);
    createEdges(v);//from  w  w  w.  j a  v  a  2 s.  co m

    vv = new VisualizationViewer<Integer, Number>(new FRLayout<Integer, Number>(graph));
    vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v));
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));
    VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>(
            new EllipseVertexShapeTransformer<Integer>());
    DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>();
    vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    loadImages(v, vertexIconFunction.getIconMap());
    vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap());
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.white, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.lightGray));

    vv.setBackground(Color.white);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

    // create a frome to hold the graph
    final JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

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

    JCheckBox lo = new JCheckBox("Show Labels");
    lo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            showLabels = e.getStateChange() == ItemEvent.SELECTED;
            vv.repaint();
        }
    });
    lo.setSelected(true);

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(lo);
    controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox());
    content.add(controls, BorderLayout.SOUTH);

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

From source file:org.fhaes.jsea.JSEABarChart.java

/**
 * Creates a demo chart./*from   w ww.j  av  a2 s.c om*/
 * 
 * @return A chart.
 */
@SuppressWarnings("deprecation")
public static JFreeChart createChart(String title, double[] meanByWindow, int lengthOfWindow,
        int yearsPriorOfEvent, int yearsAfterEvent, double[][] leftEndPointSim, double[][] rightEndPointSim,
        String outputFilePrefix, int alphaLevel, int segmentIndex) {

    JSEABarChart.meanByWindow = meanByWindow;
    JSEABarChart.lengthOfWindow = lengthOfWindow;
    JSEABarChart.yearsPriorOfEvent = yearsPriorOfEvent;
    JSEABarChart.leftEndPointSim = leftEndPointSim;
    JSEABarChart.rightEndPointSim = rightEndPointSim;
    JSEABarChart.alphaLevel = alphaLevel;

    CategoryPlot plot = new CategoryPlot();
    plot.setDataset(0, createDataset());
    plot.setOrientation(PlotOrientation.VERTICAL);

    CustomBarRenderer renderer = new CustomBarRenderer(createPaint(lengthOfWindow, Color.gray));
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setDrawBarOutline(false);
    renderer.setOutlinePaint(Color.yellow);
    renderer.setOutlineStroke(new BasicStroke(1.1f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL));
    renderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    plot.setRenderer(0, renderer);
    Color allcolors[] = { Color.red, Color.green, Color.blue };

    System.out.println("here is the alphlevel " + alphaLevel);
    // for (int k = 0; k <= 5; k++) {
    // if (k <= 2) {
    // / plot.setDataset(k + 1, createEndDataset(k, true));
    // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k], k));
    // } else {
    // plot.setDataset(k + 1, createEndDataset(k - 3, false));
    // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k - 3], k - 3));
    // }
    // }
    // for (int k = 0; k <1; k++) {
    // if (k <= 2) {
    plot.setDataset(1, createEndDataset(alphaLevel, true));
    plot.setRenderer(1, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel));
    // } else {
    plot.setDataset(4, createEndDataset(alphaLevel, false));
    plot.setRenderer(4, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel));
    // }
    // }
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    // plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainAxis(new CategoryAxis("LAG"));

    plot.addRangeMarker(new ValueMarker(0));

    plot.setRangeAxis(new NumberAxis(outputFilePrefix));
    plot.setRangeGridlinesVisible(true);

    JFreeChart chart = new JFreeChart(plot);
    chart.setTitle(title);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.WHITE);

    return chart;
}

From source file:events.MouseMotionEventDemo.java

public MouseMotionEventDemo() {
    super(new GridLayout(0, 1));
    blankArea = new BlankArea(Color.YELLOW);
    add(blankArea);/*from  w  w  w .  j a v  a  2 s .  c o m*/

    textArea = new JTextArea();
    textArea.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setPreferredSize(new Dimension(200, 75));

    add(scrollPane);

    //Register for mouse events on blankArea and panel.
    blankArea.addMouseMotionListener(this);
    addMouseMotionListener(this);

    setPreferredSize(new Dimension(450, 450));
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:UserInterface.PublisherRole.ViewUserHabitsJPanel.java

private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("User Habits", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );/*  ww w .j  a  v  a2 s  .  c om*/

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle(" ", new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:com.jaeksoft.searchlib.util.ImageUtils.java

public static final void yellowHighlight(Image image, Collection<Rectangle> boxes, float outsetFactor) {
    if (CollectionUtils.isEmpty(boxes))
        return;/*from   w w  w  .  j ava  2 s . c om*/
    Graphics2D g2d = (Graphics2D) image.getGraphics();
    g2d.setPaint(Color.YELLOW);
    Composite originalComposite = g2d.getComposite();
    AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
    g2d.setComposite(ac);
    for (Rectangle box : boxes) {
        if (outsetFactor != 1.0F) {
            box = new Rectangle(box);
            box.grow((int) (box.getHeight() * outsetFactor), (int) (box.getWidth() * outsetFactor));
        }
        g2d.fill(box);
    }
    g2d.setComposite(originalComposite);
}

From source file:org.nekorp.workflow.desktop.view.ServicioDatosGeneralesView.java

public void bindComponents() {
    //bindings con el servicio
    bindingManager.registerBind(viewServicioModel, "id", (Bindable) this.numeroServicio);
    bindingManager.registerBind(viewServicioModel.getAuto(), "placas", (Bindable) this.placas);
    //bindings con el cliente
    bindingManager.registerBind(viewServicioModel.getCliente(), "nombre", (Bindable) this.nombreCliente);
    //bindings con el metadata de la bitacora
    bindingManager.registerBind(bitacoraMetaData, "fechaInicioServicio", (Bindable) this.inicioServicio);
    bindingManager.registerBind(bitacoraMetaData, "fechaFinServicio", (Bindable) this.finServicio);
    bindingManager.registerBind(bitacoraMetaData, "tiempoServicio", (Bindable) this.duracionServicio);

    bindingManager.registerBind(bitacoraMetaData, "fechaEntrada", (Bindable) this.ingreso);
    bindingManager.registerBind(bitacoraMetaData, "fechaSalidaAuto", (Bindable) this.salida);
    bindingManager.registerBind(bitacoraMetaData, "tiempoEstadia", (Bindable) this.tiempo);

    //bindings al metadata de cobranza cobranzaMetadata
    bindingManager.registerBind(cobranzaMetadata, "saldo", (Bindable) this.saldo);
    Bindable saldoDecoratorBind = new ReadOnlyBinding() {
        @Override/*from w w  w . j a  v a 2  s . c o  m*/
        public void notifyUpdate(Object origen, String property, Object value) {
            CobranzaWarningLevel warningLevel = (CobranzaWarningLevel) value;
            switch (warningLevel) {
            case info:
                saldo.setBackground(Color.GREEN);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.GREEN, 4));
                break;

            case warn:
                saldo.setBackground(Color.YELLOW);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.YELLOW, 4));
                break;

            case urgent:
                saldo.setBackground(Color.RED);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.RED, 4));
                break;

            default:
                saldo.setBackground(Color.GREEN);
                saldo.setBorder(javax.swing.BorderFactory.createLineBorder(Color.GREEN, 4));
                break;
            }
        }
    };
    bindingManager.registerBind(cobranzaMetadata, "warningLevel", saldoDecoratorBind);
}

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

/**
 * create an instance of a simple graph with basic controls
 *//*from  ww w  . j a  v  a  2s.  com*/
public VertexLabelAsShapeDemo() {

    // create a simple graph for the demo
    graph = TestGraphs.getOneComponentGraph();

    layout = new FRLayout<String, Number>(graph);

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

    // this class will provide both label drawing and vertex shapes
    VertexLabelAsShapeRenderer<String, Number> vlasr = new VertexLabelAsShapeRenderer<String, Number>(
            vv.getRenderContext());

    // customize the render context
    vv.getRenderContext().setVertexLabelTransformer(
            // this chains together Transformers so that the html tags
            // are prepended to the toString method output
            new ChainedTransformer<String, String>(
                    new Transformer[] { new ToStringLabeller<String>(), new Transformer<String, String>() {
                        public String transform(String input) {
                            return "<html><center>Vertex<p>" + input;
                        }
                    } }));
    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.red));
    vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.yellow));
    vv.getRenderContext().setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(2.5f)));

    // customize the renderer
    vv.getRenderer()
            .setVertexRenderer(new GradientVertexRenderer<String, Number>(Color.gray, Color.white, true));
    vv.getRenderer().setVertexLabelRenderer(vlasr);

    vv.setBackground(Color.black);

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

    final DefaultModalGraphMouse<String, Number> graphMouse = new DefaultModalGraphMouse<String, Number>();

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

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

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

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

    JPanel controls = new JPanel();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    zoomControls.add(plus);
    zoomControls.add(minus);
    controls.add(zoomControls);
    controls.add(modeBox);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:edu.ku.brc.ui.skin.SkinsMgr.java

/**
 * Loads the skins from XML.//from  www  .  j av a2 s .  c  o  m
 */
@SuppressWarnings("unchecked")
protected static Hashtable<String, Skin> load() {
    XStream xstream = new XStream();
    config(xstream);

    if (false) {
        Hashtable<String, Skin> skinsHash = new Hashtable<String, Skin>();

        /*
         giraffe_tile.png
        giraffe_tile1.png
        metal.jpg
        reptile_tiled.jpg
        reptile_tiled.png
         */
        String p = "/Users/rods/workspace/Specify6/";
        Skin skin1 = new Skin("metal", "metal desc");
        skin1.getItems().put("item1", new SkinItem("n1", "fn", 10, "plain", Color.BLACK, Color.MAGENTA,
                p + "giraffe_tile.png", "desc"));
        skin1.getItems().put("item2", new SkinItem("n2", "fn", 10, "bold", Color.BLACK, Color.ORANGE,
                p + "giraffe_tile.png", "desc"));

        Skin skin2 = new Skin("giraffe", "metal desc");
        skin2.getItems().put("item1",
                new SkinItem("n1", "fn", 10, "bolditalic", Color.GREEN, Color.YELLOW, p + "metal.jpg", "desc"));
        skin2.getItems().put("item2",
                new SkinItem("n2", "fn", 10, "italic", Color.BLUE, Color.RED, p + "metal.jpg", "desc"));

        skinsHash.put(skin1.getName(), skin1);
        skinsHash.put(skin2.getName(), skin2);

        File skinsFile = new File(XMLHelper.getConfigDirPath("skins.xml"));
        try {
            FileUtils.writeStringToFile(skinsFile, xstream.toXML(skinsHash));
        } catch (IOException ex) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SkinsMgr.class, ex);
            ex.printStackTrace();
        }
    }

    File skinsFile = new File(XMLHelper.getConfigDirPath("skins.xml"));
    if (skinsFile.exists()) {
        return (Hashtable<String, Skin>) xstream.fromXML(XMLHelper.getContents(skinsFile));
    }
    return null;
}

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

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis != null) {
        bluetoothData.removeAllSeries();
        XYIntervalSeries bluetoothConnected = new XYIntervalSeries(BluetoothState.BLUETOOTH_CONNECTED);
        XYIntervalSeries bluetoothDisconnected = new XYIntervalSeries(BluetoothState.BLUETOOTH_DISCONNECTED);
        XYIntervalSeries bluetoothOff = new XYIntervalSeries(BluetoothState.BLUETOOTH_TURNED_OFF);
        XYIntervalSeries bluetoothOn = new XYIntervalSeries(BluetoothState.BLUETOOTH_TURNED_ON);
        XYIntervalSeries bluetoothUnknown = new XYIntervalSeries(BluetoothState.BLUETOOTH_UNKNOWN);

        bluetoothData.addSeries(bluetoothConnected);
        bluetoothData.addSeries(bluetoothDisconnected);
        bluetoothData.addSeries(bluetoothOff);
        bluetoothData.addSeries(bluetoothOn);
        bluetoothData.addSeries(bluetoothUnknown);

        // Populate the data set
        Iterator<BluetoothInfo> iter = analysis.getAnalyzerResult().getTraceresult().getBluetoothInfos()
                .iterator();//w ww .j a v  a 2s.  c  o  m
        XYIntervalSeries series;
        if (iter.hasNext()) {
            while (iter.hasNext()) {
                BluetoothInfo btEvent = iter.next();
                if (btEvent.getBluetoothState() == null) {
                    series = bluetoothUnknown;
                } else {
                    switch (btEvent.getBluetoothState()) {
                    case BLUETOOTH_CONNECTED:
                        series = bluetoothConnected;
                        break;
                    case BLUETOOTH_DISCONNECTED:
                        series = bluetoothDisconnected;
                        break;
                    case BLUETOOTH_TURNED_ON:
                        series = bluetoothOn;
                        break;
                    case BLUETOOTH_TURNED_OFF:
                        series = bluetoothOff;
                        break;
                    default:
                        series = bluetoothUnknown;
                        break;
                    }
                }
                series.add(btEvent.getBeginTimeStamp(), btEvent.getBeginTimeStamp(), btEvent.getEndTimeStamp(),
                        0.5, 0, 1);
            }

        }

        XYItemRenderer renderer = plot.getRenderer();
        renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_CONNECTED),
                new Color(34, 177, 76));
        renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_DISCONNECTED), Color.YELLOW);
        renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_TURNED_OFF),
                new Color(216, 132, 138));
        renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_TURNED_ON),
                new Color(162, 226, 98));
        renderer.setSeriesPaint(bluetoothData.indexOf(BluetoothState.BLUETOOTH_UNKNOWN),
                new Color(154, 154, 154));

        // Assign ToolTip to renderer
        renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                BluetoothState eventType = (BluetoothState) bluetoothData.getSeries(series).getKey();
                return MessageFormat.format(ResourceBundleHelper.getMessageString("bluetooth.tooltip"),
                        dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType));
            }
        });

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

From source file:cs.ucy.ac.cy.osslicense.model.editor.visualizer.LicenseVisualizer.java

public VisualizationViewer<String, Edge> generateGraphView() {

    Transformer<String, Paint> vertexColor = new Transformer<String, Paint>() {
        public Paint transform(String licenseTerm) {
            if (licenseTerm.contains("May"))
                return Color.GREEN;
            if (licenseTerm.contains("Must"))
                return Color.ORANGE;
            if (licenseTerm.equals("LimitedLiability") || licenseTerm.equals("ProvideWithoutWarranty"))
                return Color.CYAN;
            return Color.YELLOW;
        }//from   w  w w. j av  a  2 s . com
    };

    Layout<String, Edge> layout = new CircleLayout<String, Edge>(this.licenseGraph);
    layout.setSize(new Dimension(1024, 768));
    VisualizationViewer<String, Edge> vv = new VisualizationViewer<String, Edge>(layout);
    vv.setPreferredSize(new Dimension(1024, 768));

    vv.getRenderContext().setVertexFillPaintTransformer(vertexColor);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<Edge>());

    AbstractModalGraphMouse gm = new DefaultModalGraphMouse<String, Edge>();
    vv.setGraphMouse(gm);

    popupMenu = new LicenseTermPopupMenu<>(licenseModel);
    gm.add(popupMenu);

    return vv;
}