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:com.github.errantlinguist.latticevisualiser.StatePaintTransformer.java

/**
 * /*from   ww w. j av  a 2 s  .  c om*/
 * @return A map of {@link StateType StateTypes} to {@link Color Colors} for
 *         deriving the colour used to draw the vertex representing a state.
 */
static final ImmutableMap<StateType, Color> makeColorMap() {
    final ImmutableMap.Builder<StateType, Color> builder = ImmutableMap.builder();

    builder.put(StateType.INITIAL, Color.CYAN);
    builder.put(StateType.FINAL, Color.MAGENTA);
    builder.put(StateType.GOAL, Color.RED);
    builder.put(StateType.INTERMEDIATE, Color.GREEN);

    return builder.build();

}

From source file:ihm.PaneTab.java

public PaneTab() {
    super();/*w  w  w. j a v a  2s.co m*/
    //super.setPreferredSize(new Dimension(600,600));
    //mainActivity.setPreferredSize(new Dimension(600,600));
    mainActivity.setBackground(Color.GREEN);
    tabPane1 = new JPanel();
    tabPane2 = new JPanel();
    tabPane3 = new JPanel();
    tabPane1.setBackground(Color.BLUE);
    tabPane2.setBackground(Color.CYAN);
    tabPane3.setBackground(Color.MAGENTA);
    mainActivity.add(tabPane1);
    mainActivity.setTitleAt(0, "Ram");
    mainActivity.add(tabPane2);
    mainActivity.setTitleAt(1, "Rem");
    mainActivity.add(tabPane3);
    mainActivity.setTitleAt(2, "Emilia");
    DataList test = new DataList();
    //mainActivity.add("Ram",tabPane1);
    //mainActivity.add("Rem",tabPane2);
    //mainActivity.add("Emilia",tabPane3);

    super.add(mainActivity);
    super.setVisible(true);
}

From source file:org.mabb.fontverter.opentype.DebugGlyphDrawer.java

public static void drawGlyph(TtfGlyph glyph) throws IOException {
    BufferedImage image = new BufferedImage(650, 650, BufferedImage.TYPE_INT_RGB);
    Graphics2D gfx = image.createGraphics();

    gfx.translate(0, 300);//from ww w  .  j  a va  2s . co m
    gfx.scale(1, -1);

    gfx.setColor(Color.white);
    gfx.fillRect(0, -1000, 2060, 2060);
    gfx.setColor(Color.lightGray);
    gfx.translate(100, 50);
    gfx.fillRect(0, 0, 1000, 1000);
    gfx.setColor(Color.BLACK);

    gfx.scale(.05, .05);

    //        gfx.rotate(Math.toRadians(180));
    //        gfx.translate(-2200, -2200);

    Color[] colors = new Color[] { Color.BLACK, Color.MAGENTA, Color.GREEN, Color.BLUE, Color.cyan };
    java.util.List<Path2D.Double> paths = glyph.getPaths();
    for (int i = 0; i < paths.size(); i++) {
        Path2D pathOn = paths.get(i);
        gfx.setColor(colors[i]);

        gfx.draw(pathOn);
    }

    gfx.dispose();

    //        ImageIO.write(image, "jpg", new File("test.jpg"));
}

From source file:MyCanvas.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);

    // draw entire component white
    g.setColor(Color.white);//w ww.j av a  2 s  .  co m
    g.fillRect(0, 0, getWidth(), getHeight());

    // yellow circle
    g.setColor(Color.yellow);
    g.fillOval(0, 0, 240, 240);

    // magenta circle
    g.setColor(Color.magenta);
    g.fillOval(160, 160, 240, 240);

    // paint the icon below blue sqaure
    int w = java2sLogo.getIconWidth();
    int h = java2sLogo.getIconHeight();
    java2sLogo.paintIcon(this, g, 280 - (w / 2), 120 - (h / 2));

    // paint the icon below red sqaure
    java2sLogo.paintIcon(this, g, 120 - (w / 2), 280 - (h / 2));

    // transparent red square
    g.setColor(m_tRed);
    g.fillRect(60, 220, 120, 120);

    // transparent green circle
    g.setColor(m_tGreen);
    g.fillOval(140, 140, 120, 120);

    // transparent blue square
    g.setColor(m_tBlue);
    g.fillRect(220, 60, 120, 120);

    g.setColor(Color.black);

    g.setFont(monoFont);
    FontMetrics fm = g.getFontMetrics();
    w = fm.stringWidth("Java Source");
    h = fm.getAscent();
    g.drawString("Java Source", 120 - (w / 2), 120 + (h / 4));

    g.setFont(sanSerifFont);
    fm = g.getFontMetrics();
    w = fm.stringWidth("and");
    h = fm.getAscent();
    g.drawString("and", 200 - (w / 2), 200 + (h / 4));

    g.setFont(serifFont);
    fm = g.getFontMetrics();
    w = fm.stringWidth("Support.");
    h = fm.getAscent();
    g.drawString("Support.", 280 - (w / 2), 280 + (h / 4));
}

From source file:ClipDemo.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    // get damaged region
    Rectangle clipRect = g.getClipBounds();
    int clipx = clipRect.x;
    int clipy = clipRect.y;
    int clipw = clipRect.width;
    int cliph = clipRect.height;

    // fill damaged region only
    g.setColor(Color.white);// ww  w.j  a v a2  s.  com
    g.fillRect(clipx, clipy, clipw, cliph);

    if (clipx <= 240 && clipy <= 240) {
        g.setColor(Color.yellow);
        g.fillOval(0, 0, 240, 240);
        System.out.println(" yellow Oval repainted.");
    }

    if (clipx + clipw >= 160 && clipx <= 400 && clipy + cliph >= 160 && clipy <= 400) {
        g.setColor(Color.magenta);
        g.fillOval(160, 160, 240, 240);
        System.out.println(" magenta Oval repainted.");
    }

    int iconWidth = java2sLogo.getIconWidth();
    int iconHeight = java2sLogo.getIconHeight();

    if (clipx + clipw >= 280 - (iconWidth / 2) && clipx <= (280 + (iconWidth / 2))
            && clipy + cliph >= 120 - (iconHeight / 2) && clipy <= (120 + (iconHeight / 2))) {
        java2sLogo.paintIcon(this, g, 280 - (iconWidth / 2), 120 - (iconHeight / 2));
        System.out.println(" logo below blue Rect repainted.");
    }

    if (clipx + clipw >= 120 - (iconWidth / 2) && clipx <= (120 + (iconWidth / 2))
            && clipy + cliph >= 280 - (iconHeight / 2) && clipy <= (280 + (iconHeight / 2))) {
        java2sLogo.paintIcon(this, g, 120 - (iconWidth / 2), 280 - (iconHeight / 2));
        System.out.println(" logo below red Rect repainted.");
    }

    if (clipx + clipw >= 60 && clipx <= 180 && clipy + cliph >= 220 && clipy <= 340) {
        g.setColor(red);
        g.fillRect(60, 220, 120, 120);
        System.out.println(" red Rect repainted.");

    }

    if (clipx + clipw > 140 && clipx < 260 && clipy + cliph > 140 && clipy < 260) {
        g.setColor(green);
        g.fillOval(140, 140, 120, 120);
        System.out.println(" green Oval repainted.");

    }

    if (clipx + clipw > 220 && clipx < 380 && clipy + cliph > 60 && clipy < 180) {
        g.setColor(blue);
        g.fillRect(220, 60, 120, 120);
        System.out.println(" blue Rect repainted.");
    }

    g.setColor(Color.black);

    g.setFont(monoFont);
    FontMetrics fm = g.getFontMetrics();
    iconWidth = fm.stringWidth("Java Source");
    iconHeight = fm.getAscent();
    int d = fm.getDescent();
    if (clipx + clipw > 120 - (iconWidth / 2) && clipx < (120 + (iconWidth / 2))
            && clipy + cliph > (120 + (iconHeight / 4)) - iconHeight && clipy < (120 + (iconHeight / 4)) + d) {
        g.drawString("Java Source", 120 - (iconWidth / 2), 120 + (iconHeight / 4));
        System.out.println(" Java Source repainted.");
    }

    g.setFont(sanFont);
    fm = g.getFontMetrics();
    iconWidth = fm.stringWidth("and");
    iconHeight = fm.getAscent();
    d = fm.getDescent();
    if (clipx + clipw > 200 - (iconWidth / 2) && clipx < (200 + (iconWidth / 2))
            && clipy + cliph > (200 + (iconHeight / 4)) - iconHeight && clipy < (200 + (iconHeight / 4)) + d) {
        g.drawString("and", 200 - (iconWidth / 2), 200 + (iconHeight / 4));
        System.out.println(" and repainted.");
    }

    g.setFont(serifFont);
    fm = g.getFontMetrics();
    iconWidth = fm.stringWidth("Support.");
    iconHeight = fm.getAscent();
    d = fm.getDescent();

    if (clipx + clipw > 280 - (iconWidth / 2) && clipx < (280 + (iconWidth / 2))
            && clipy + cliph > (280 + (iconHeight / 4)) - iconHeight && clipy < (280 + (iconHeight / 4)) + d) {
        g.drawString("Support.", 280 - (iconWidth / 2), 280 + (iconHeight / 4));
        System.out.println(" Support. repainted.");
    }
}

From source file:GeneralPathDemo.java

public void paintComponent(Graphics g) {
    // super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    if (firstTime) {
        Dimension dim = getSize();
        int w = dim.width;
        int h = dim.height;
        oddShape = createPath();/* w w  w .  ja  v  a 2  s.c  o m*/
        area = new Rectangle(w, h);
        bi = (BufferedImage) createImage(w, h);
        big = bi.createGraphics();
        big.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        firstTime = false;
    }

    // Clears the shape that was previously drawn.
    big.setColor(Color.white);
    big.fillRect(0, 0, area.width, area.height);

    big.setColor(Color.magenta);
    big.setStroke(new BasicStroke(3.0f));
    big.draw(oddShape);
    // Draws the buffered image to the screen.
    g2.drawImage(bi, 0, 0, this);

}

From source file:TextureWithBufferedImage.java

public void paint(Graphics g) {
    Graphics2D g2D = (Graphics2D) g;
    Rectangle2D rec1, rec2, rec3, rec4, rec5;
    rec1 = new Rectangle2D.Float(25, 25, 75, 150);
    rec2 = new Rectangle2D.Float(125, 25, 10, 75);
    rec3 = new Rectangle2D.Float(75, 125, 125, 75);
    rec4 = new Rectangle2D.Float(25, 15, 12, 75);
    rec5 = new Rectangle2D.Float(15, 50, 15, 15);

    AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1);
    g2D.setComposite(ac);/*from  w  w w  . j a v a  2s. co m*/

    g2D.setStroke(new BasicStroke(5.0f));
    g2D.draw(rec1);
    GradientPaint gp = new GradientPaint(125f, 25f, Color.yellow, 225f, 100f, Color.blue);
    g2D.setPaint(gp);
    g2D.fill(rec2);
    BufferedImage bi = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB);
    Graphics2D big = bi.createGraphics();
    big.setColor(Color.magenta);
    big.fillRect(0, 0, 5, 5);
    big.setColor(Color.black);
    big.drawLine(0, 0, 5, 5);
    Rectangle r = new Rectangle(0, 0, 5, 5);
    TexturePaint tp = new TexturePaint(bi, r);

    g2D.setPaint(tp);
    g2D.fill(rec3);
    g2D.setColor(Color.green);
    g2D.fill(rec4);
    g2D.setColor(Color.red);
    g2D.fill(rec5);
}

From source file:view.FuzzySetView.java

private void initColors() {
    colors = new Color[] { Color.BLUE, Color.RED, Color.GREEN, Color.ORANGE, Color.MAGENTA };
}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    int cx = getSize().width / 2;
    int cy = getSize().height / 2;

    g2.translate(cx, cy);/*from  w  w  w  . j av  a 2 s.  c  om*/
    g2.rotate(theta * Math.PI / 180);

    Shape oldClip = g2.getClip();
    Shape e = new Ellipse2D.Float(-cx, -cy, cx * 2, cy * 2);
    g2.clip(e);

    Shape c = new Ellipse2D.Float(-cx, -cy, cx * 3 / 4, cy * 2);
    g2.setPaint(new GradientPaint(40, 40, Color.blue, 60, 50, Color.white, true));
    g2.fill(c);

    g2.setPaint(Color.yellow);
    g2.fillOval(cx / 4, 0, cx, cy);

    g2.setClip(oldClip);

    g2.setFont(new Font("Times New Roman", Font.PLAIN, 64));
    g2.setPaint(new GradientPaint(-cx, 0, Color.red, cx, 0, Color.black, false));
    g2.drawString("Hello, 2D!", -cx * 3 / 4, cy / 4);

    AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) .75);
    g2.setComposite(ac);

    Shape r = new RoundRectangle2D.Float(0, -cy * 3 / 4, cx * 3 / 4, cy * 3 / 4, 20, 20);
    g2.setStroke(new BasicStroke(4));
    g2.setPaint(Color.magenta);
    g2.fill(r);
    g2.setPaint(Color.green);
    g2.draw(r);

    g2.drawImage(image, -cx / 2, -cy / 2, this);
}

From source file:uk.ac.babraham.SeqMonk.Filters.GeneSetFilter.GeneSetScatterPlotPanel.java

public void paint(Graphics g) {
    super.paint(g);

    if (customRegressionValues != null & readyToDraw) {
        g.setColor(Color.magenta);
        for (int i = 0; i < customRegressionValues[0].length; i++) {

            // some of the points fall off the plotting area
            if ((getX(customRegressionValues[0][i]) > X_AXIS_SPACE)
                    && (getY(customRegressionValues[1][i]) < getHeight() - Y_AXIS_SPACE)) {
                g.fillOval(getX(customRegressionValues[0][i]), getY(customRegressionValues[1][i]), 3, 3);

            }/*from   ww w.j  av  a  2  s .  c o m*/
        }
    }

    //System.err.println("x for 5.377 = " + getX(5.377) + ", y for 4.761 = " + getY(4.761));

    //if(calculateLinearRegression && (simpleRegression != null)){
    /*      if(simpleRegression != null){
                  
             int x1;
             int x2;
             int y1;
             int y2;
                     
             // at intersect of x axis
             y1 = getY((simpleRegression.getSlope() * (double)(getValueFromX(X_AXIS_SPACE))) + simpleRegression.getIntercept());
                     
             if(y1 < (getHeight()-Y_AXIS_SPACE)){               
    x1 = X_AXIS_SPACE;
             }
                     
             // if y1 is off the screen
             else{
    y1 = getHeight()-Y_AXIS_SPACE;
            
    x1 = getX(((double)(getValueFromY(y1) - simpleRegression.getIntercept()))/simpleRegression.getSlope());
             }
                     
             y2 = getY((simpleRegression.getSlope() * (double)(getValueFromX((getWidth()-10)))) + simpleRegression.getIntercept());  
                     
             if(y2 <= 10){
    y2 = 10;
    x2 = getX(((double)(getValueFromY(y2) - simpleRegression.getIntercept()))/simpleRegression.getSlope());
             }
                     
             else{
    x2 = (getWidth()-10);
             }
                     
             g.setColor(Color.BLACK);
             g.drawLine(x1,y1,x2,y2);
    */

    /*   System.err.println("y intercept = " + simpleRegression.getIntercept() + ", slope = " + simpleRegression.getSlope() + 
       ", x intercept = " + (-(simpleRegression.getIntercept()/simpleRegression.getSlope())));
    */
}