Example usage for java.awt Color magenta

List of usage examples for java.awt Color magenta

Introduction

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

Prototype

Color magenta

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

Click Source Link

Document

The color magenta.

Usage

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

/**
 * Loads the skins from XML./*ww  w  .  j  ava  2s .  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:net.sf.jsfcomp.chartcreator.utils.ChartUtils.java

public static Color getColor(String color) {
    // HTML colors (#FFFFFF format)
    if (color.startsWith("#")) {
        return new Color(Integer.parseInt(color.substring(1), 16));
    } else {/*from   www . ja  v a 2 s .  c  o m*/
        // Colors by name
        if (color.equalsIgnoreCase("black"))
            return Color.black;
        if (color.equalsIgnoreCase("gray"))
            return Color.gray;
        if (color.equalsIgnoreCase("yellow"))
            return Color.yellow;
        if (color.equalsIgnoreCase("green"))
            return Color.green;
        if (color.equalsIgnoreCase("blue"))
            return Color.blue;
        if (color.equalsIgnoreCase("red"))
            return Color.red;
        if (color.equalsIgnoreCase("orange"))
            return Color.orange;
        if (color.equalsIgnoreCase("cyan"))
            return Color.cyan;
        if (color.equalsIgnoreCase("magenta"))
            return Color.magenta;
        if (color.equalsIgnoreCase("darkgray"))
            return Color.darkGray;
        if (color.equalsIgnoreCase("lightgray"))
            return Color.lightGray;
        if (color.equalsIgnoreCase("pink"))
            return Color.pink;
        if (color.equalsIgnoreCase("white"))
            return Color.white;

        throw new RuntimeException("Unsupported chart color:" + color);
    }
}

From source file:org.osjava.reportrunner_plugins.renderers.jfreechart.creators.TexturedBarRenderer.java

public java.awt.Paint getSeriesPaint(int row) {
    BufferedImage bufferedImage = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB);
    Graphics2D big = bufferedImage.createGraphics();
    TexturePaint texture = null;//ww w .  j  ava2 s  .c  o  m
    int rowNum = row + 1;
    int patNum = 13;
    int formula = rowNum - ((rowNum / patNum) * patNum);

    if (formula == 0) {
        big.setColor(Color.orange);
        big.fillRect(0, 0, 5, 5);
        big.fillRect(1, 0, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);

    } else if (formula == 1) {
        big.setColor(Color.red);
        big.fillRect(0, 0, 5, 5);
        big.fillRect(1, 0, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 2) {
        Color color = Color.blue;
        big.setColor(Color.white);
        big.fillRect(0, 0, 5, 5);
        big.setColor(color);
        big.fillRect(0, 1, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);

        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 3) {
        Color color = Color.yellow;
        big.setColor(Color.orange);
        big.fillRect(0, 0, 5, 5);
        big.setColor(color);
        big.fillRect(1, 1, 4, 4);
        Rectangle r = new Rectangle(0, 0, 5, 5);

        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 4) {
        big.setColor(Color.green);
        big.fillRect(0, 0, 5, 5);
        big.fillRect(1, 0, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 5) {
        big.setColor(Color.magenta);
        big.fillRect(0, 0, 5, 5);
        big.setColor(Color.pink);
        big.fillRect(0, 0, 4, 4);

        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 6) {
        float[] x = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f };
        float[] y = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f };
        GeneralPath path = new GeneralPath();
        path.moveTo(x[0], y[0]);
        for (int j = 1; j < x.length; j++) {
            path.lineTo(x[j], y[j]);
        }

        big.setColor(new Color(226, 199, 252));
        big.fillRect(0, 0, 5, 5);
        big.setColor(Color.blue);
        big.setStroke(new BasicStroke(1.0f));

        big.draw(path);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 7) {
        big.setColor(Color.lightGray);
        big.fillRect(0, 0, 5, 5);
        big.setColor(Color.red);
        big.fillRect(1, 0, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 8) {
        float[] x = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f };
        float[] y = { .5f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f };
        GeneralPath path = new GeneralPath();
        path.moveTo(x[0], y[0]);
        for (int j = 1; j < x.length; j++) {
            path.lineTo(x[j], y[j]);

        }
        big.setColor(Color.blue);
        big.fillRect(0, 0, 5, 5);
        big.setColor(Color.cyan);
        big.setStroke(new BasicStroke(2.0f));
        big.draw(path);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 9) {
        Color color = new Color(0xBBBBDD);
        big.setColor(color);
        big.fillRect(0, 0, 5, 5);
        big.setColor(new Color(199, 201, 230));
        big.fillRect(1, 0, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 10) {
        float[] x = { 1, 2, 3, 4, 5 };
        float[] y = { 1, 2, 3, 4, 5 };
        GeneralPath path = new GeneralPath();
        path.moveTo(x[0], y[1]);
        path.lineTo(x[1], y[0]);
        path.moveTo(x[0], y[2]);
        path.lineTo(x[2], y[0]);
        path.moveTo(x[0], y[3]);
        path.lineTo(x[3], y[0]);
        path.moveTo(x[0], y[4]);
        path.lineTo(x[4], y[0]);
        big.setColor(Color.red);
        big.fillRect(0, 0, 5, 5);
        big.setColor(new Color(242, 242, 193));
        big.setStroke(new BasicStroke(3.0f));
        big.draw(path);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 11) {
        big.setColor(new Color(252, 169, 171));
        big.fillOval(0, 0, 5, 6);
        big.setColor(new Color(252, 230, 230));
        big.fillOval(0, 0, 3, 3);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    } else if (formula == 12) {
        big.setColor(Color.green);
        big.fillRect(0, 0, 5, 5);
        big.setColor(new Color(20, 178, 38));
        big.fillRect(2, 2, 5, 5);
        Rectangle r = new Rectangle(0, 0, 5, 5);
        texture = new TexturePaint(bufferedImage, r);
    }
    return texture;

}

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

public void populate(XYPlot plot, AROTraceData analysis) {

    if (analysis != null) {
        burstDataCollection.removeAllSeries();
        Map<BurstCategory, XYIntervalSeries> seriesMap = new EnumMap<BurstCategory, XYIntervalSeries>(
                BurstCategory.class);
        final Map<BurstCategory, List<Burst>> burstMap = new HashMap<BurstCategory, List<Burst>>();
        for (BurstCategory eventType : BurstCategory.values()) {
            XYIntervalSeries series = new XYIntervalSeries(eventType);
            seriesMap.put(eventType, series);
            burstDataCollection.addSeries(series);
            burstMap.put(eventType, new ArrayList<Burst>());
        }//from   w ww  .jav a  2  s. c om
        final List<Burst> burstStates = analysis.getAnalyzerResult().getBurstcollectionAnalysisData()
                .getBurstCollection();
        Iterator<Burst> iter = burstStates.iterator();
        while (iter.hasNext()) {
            Burst currEvent = iter.next();
            if (currEvent != null) {
                BurstCategory burstState = currEvent.getBurstCategory();
                if (burstState != null) {
                    seriesMap.get(burstState).add(currEvent.getBeginTime(), currEvent.getBeginTime(),
                            currEvent.getEndTime(), 0.5, 0, 1);
                    burstMap.get(burstState).add(currEvent);
                }
            }
        }

        Color myGreen = new Color(34, 177, 76);
        Color lightGreen = new Color(134, 232, 162);

        XYItemRenderer renderer = plot.getRenderer();
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.TCP_PROTOCOL), Color.blue);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.TCP_LOSS_OR_DUP), Color.black);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.USER_INPUT), myGreen);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.SCREEN_ROTATION), lightGreen);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.CLIENT_APP), Color.red);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.SERVER_NET_DELAY), Color.yellow);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.LONG), Color.gray);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.PERIODICAL), Color.magenta);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.CPU), Color.cyan);
        renderer.setSeriesPaint(burstDataCollection.indexOf(BurstCategory.UNKNOWN), Color.darkGray);

        // Assign ToolTip to renderer
        renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                BurstCategory eventType = (BurstCategory) burstDataCollection.getSeries(series).getKey();
                Burst b;
                int size = burstMap.get(eventType).size();
                if (size > item) {
                    b = burstMap.get(eventType).get(item);
                } else {
                    b = burstMap.get(eventType).get(size);
                }
                final String PREFIX = "BurstCategory.";
                return MessageFormat.format(ResourceBundleHelper.getMessageString(PREFIX + eventType.ordinal()),
                        b.getPackets().size(), b.getBurstBytes(), b.getBurstThroughPut());
            }
        });

    }

    plot.setDataset(burstDataCollection);

    //      return plot;

}

From source file:com.github.cric.app.ui.SettingPanel.java

private void initUI() {

    setLayout(new BorderLayout(GAP, GAP));
    setBorder(new EmptyBorder(MARGIN, MARGIN, MARGIN, MARGIN));

    add(getFormPanel(), BorderLayout.NORTH);
    add(getSubmitPanel(), BorderLayout.CENTER);

    msgLabel.setForeground(Color.MAGENTA);
    msgLabel.setHorizontalAlignment(JLabel.CENTER);
    add(msgLabel, BorderLayout.SOUTH);

    populateMatchList();//from   www. ja  va 2s  .  co m
    if (CollectionUtils.isEmpty(matchList)) {
        setAllEnabled(false);
    }
}

From source file:SumUp.java

/** init() is an Applet method called by the browser to initialize */
public void init() {
    setBackground(Color.magenta);
    // The layout of the Applet is a Grid; always add things in pairs!
    setLayout(new GridLayout(0, 2));
    Choice c;/*from w w w. jav  a2  s.  c  o m*/
    add(new Label("Option 1"));
    add(c = new Choice());
    c.addItem("0");
    c.addItem("100");
    c.addItem("200");
    c.addItem("400");
    cs[numChoices++] = c;

    add(new Label("Option 2"));
    add(c = new Choice());
    c.addItem("0");
    c.addItem("100");
    c.addItem("200");
    c.addItem("400");
    cs[numChoices++] = c;

    Panel p = new Panel();
    p.setBackground(Color.pink);
    p.add(new Label("Total:"));
    p.add(resultField = new Label("000000"));
    add(p);

    sendButton = new Button("Send it");
    add(sendButton); // connect Button into Applet
    sendButton.addActionListener(this); // connect it back to Applet
}

From source file:net.sf.dynamicreports.test.jasper.chart.MeterChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);// w w  w  .  j a  v a  2  s  .  c  om

    JFreeChart chart = getChart("summary.chart1", 0);
    Plot plot = chart.getPlot();
    Assert.assertEquals("renderer", MeterPlot.class, plot.getClass());
    MeterPlot meterPlot = (MeterPlot) plot;
    Assert.assertEquals("value", 15, meterPlot.getDataset().getValue());
    Assert.assertEquals("data range low", 3d, meterPlot.getRange().getLowerBound());
    Assert.assertEquals("data range high", 30d, meterPlot.getRange().getUpperBound());
    Assert.assertEquals("value color", Color.BLUE, meterPlot.getValuePaint());
    Assert.assertEquals("value mask", "15.0", meterPlot.getTickLabelFormat().format(15));
    Assert.assertEquals("value font", new Font("Arial", Font.PLAIN, 10), meterPlot.getValueFont());
    Assert.assertEquals("shape", DialShape.CIRCLE, meterPlot.getDialShape());
    Assert.assertEquals("meter angle", 270, meterPlot.getMeterAngle());
    Assert.assertEquals("units", "units", meterPlot.getUnits());
    Assert.assertEquals("tick interval", 3d, meterPlot.getTickSize());
    Assert.assertEquals("background color", Color.LIGHT_GRAY, meterPlot.getDialBackgroundPaint());
    Assert.assertEquals("needle color", Color.CYAN, meterPlot.getNeedlePaint());
    Assert.assertEquals("tick color", Color.MAGENTA, meterPlot.getTickPaint());
    Assert.assertEquals("tick label font", new Font("Courier New", Font.PLAIN, 10),
            meterPlot.getTickLabelFont());
    Assert.assertEquals("intervals size", 2, meterPlot.getIntervals().size());
    intervalTest((MeterInterval) meterPlot.getIntervals().get(0), "red", new Color(1f, 0f, 0f, 0.8f), 25d, 30d);
    intervalTest((MeterInterval) meterPlot.getIntervals().get(1), "yellow", new Color(1f, 1f, 0f, 0.5f), 20d,
            25d);
}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createAgeHistoChart() {
    JFreeChart chart = ChartFactory.createHistogram("Age Distribution", "Age", "Count", model.age_hist_dataset,
            PlotOrientation.VERTICAL, true, true, false);
    model.age_histo_chart = chart;//from ww  w . java  2s  .  c  o m

    //CategoryDataset dataset1 = createDataset1();
    NumberAxis rangeAxis1 = new NumberAxis("Age");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins");
    XYPlot plot = chart.getXYPlot();
    ValueAxis xAxis = plot.getDomainAxis();
    xAxis.setRange(0, 100);
    XYItemRenderer renderer1 = plot.getRenderer();
    renderer1.setSeriesPaint(0, Color.MAGENTA);
    return chart;
}

From source file:org.owasp.benchmark.score.report.ScatterTools.java

private void makeDataLabels(OverallResults or, XYPlot xyplot) {
    HashMap<Point2D, String> map = makePointList(or);
    for (Entry<Point2D, String> e : map.entrySet()) {
        if (e.getValue() != null) {
            Point2D p = e.getKey();
            String label = sort(e.getValue());
            XYTextAnnotation annotation = new XYTextAnnotation(label, p.getX(), p.getY());
            annotation.setTextAnchor(p.getX() < 3 ? TextAnchor.TOP_LEFT : TextAnchor.TOP_CENTER);
            annotation.setBackgroundPaint(Color.white);
            // set color of average to black and everything else to blue
            if (averageLabel == label.toCharArray()[0]) {
                annotation.setPaint(Color.magenta);
            } else {
                annotation.setPaint(Color.blue);
            }//w ww.  j  a va 2 s  .c  o  m
            annotation.setFont(theme.getRegularFont());
            xyplot.addAnnotation(annotation);
        }
    }
}

From source file:cl.apr.pdf.chart.BarChartAviso.java

public CustomRenderer() {
    this.colors = new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan,
            Color.magenta, Color.blue };
}