Example usage for java.awt Color gray

List of usage examples for java.awt Color gray

Introduction

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

Prototype

Color gray

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

Click Source Link

Document

The color gray.

Usage

From source file:ArcDemo2D.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setPaint(Color.gray);
    int x = 5;/*from w  w w  .  ja  va2  s .com*/
    int y = 7;

    g2.setStroke(wideStroke);
    g2.draw(new Arc2D.Double(x, y, 200, 200, 90, 135, Arc2D.OPEN));
    g2.drawString("Arc2D", x, 250);
}

From source file:EllipseDemo2D.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setPaint(Color.gray);
    int x = 5;//from w w w . ja v  a  2 s.c o  m
    int y = 7;

    g2.setStroke(stroke);
    g2.draw(new Ellipse2D.Double(x, y, 200, 200));
    g2.drawString("Ellipse2D", x, 250);

}

From source file:RectangleDemo2D.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setPaint(Color.gray);
    int x = 5;//w ww .j a v  a2 s. c o  m
    int y = 7;

    g2.setStroke(stroke);
    g2.draw(new Rectangle2D.Double(x, y, 200, 200));
    g2.drawString("Rectangle2D", x, 250);

}

From source file:MainClass.java

public JPanel createNested(boolean opaque) {
    JPanel outer = new JPanel(new FlowLayout());
    JPanel inner = new JPanel(new FlowLayout());
    outer.setBackground(Color.white);
    inner.setBackground(Color.black);

    inner.setOpaque(opaque);/*from  www. j  a  va 2 s . c o  m*/
    inner.setBorder(BorderFactory.createLineBorder(Color.gray));

    inner.add(new JButton("Button"));
    outer.add(inner);

    return outer;
}

From source file:Main.java

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    GradientPaint p = new GradientPaint(0, 0, Color.white, getWidth(), getHeight(), Color.gray);
    g2d.setPaint(p);//from   ww  w  . j av  a  2  s. co  m
    g2d.fillRect(0, 0, getWidth(), getHeight());
}

From source file:Main.java

public MyPanel() {
    this.setLayout(new GridLayout());
    this.setPreferredSize(new Dimension(W, H));
    int w = W / 2;
    int h = H / 2;
    int r = w / 5;
    BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bi.createGraphics();
    g.setColor(Color.gray);
    g.fillRect(0, 0, w, h);//from   w ww  .j  a v a  2s.  c  o  m
    g.setColor(Color.blue);
    g.fillRect(w / 2 - r, h / 2 - r / 2, 2 * r, r);
    g.dispose();
    this.add(new JLabel(new ImageIcon(bi), JLabel.CENTER));
}

From source file:DashedRectangleDemo2D.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setPaint(Color.gray);
    int x = 5;/*from w w  w .  j a v a2s.co  m*/
    int y = 7;

    g2.setStroke(dashed);
    g2.draw(new RoundRectangle2D.Double(x, y, 200, 200, 10, 10));
    g2.drawString("RoundRectangle2D", x, 250);

}

From source file:Main.java

@Override
public void updateUI() {
    super.updateUI();
    setUI(new BasicComboBoxUI() {
        @Override/*from  w ww .  j av  a 2 s  .c om*/
        protected JButton createArrowButton() {
            return new JButton() {
                @Override
                public int getWidth() {
                    return 0;
                }
            };
        }
    });
    setBorder(BorderFactory.createLineBorder(Color.GRAY));
}

From source file:Main.java

@Override
public void updateUI() {
    super.updateUI();
    UIManager.put("ComboBox.squareButton", Boolean.FALSE);
    setUI(new BasicComboBoxUI() {
        @Override//ww  w. ja v a 2  s. co m
        protected JButton createArrowButton() {
            JButton b = new JButton();
            b.setBorder(BorderFactory.createEmptyBorder());
            b.setVisible(false);
            return b;
        }
    });
    setBorder(BorderFactory.createLineBorder(Color.GRAY));
}

From source file:Arrow.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    Color color = c == null ? Color.GRAY : c.getBackground();

    int dx = (int) (size / 2);
    int dy = descending ? dx : -dx;

    // Align icon (roughly) with font baseline.
    y = y + 5 * size / 6 + (descending ? -dy : 0);

    g.translate(x, y);/*from w ww  .  j  a va 2 s  . c  o  m*/
    g.setColor(Color.GRAY);
    g.fillPolygon(new int[] { dx / 2, dx, 0 }, new int[] { dy, 0, 0 }, 3);
    g.translate(-x, -y);
    g.setColor(color);
}