Example usage for java.awt Graphics draw3DRect

List of usage examples for java.awt Graphics draw3DRect

Introduction

In this page you can find the example usage for java.awt Graphics draw3DRect.

Prototype

public void draw3DRect(int x, int y, int width, int height, boolean raised) 

Source Link

Document

Draws a 3-D highlighted outline of the specified rectangle.

Usage

From source file:MainClass.java

public void paint(Graphics g) {
    g.setColor(Color.yellow);
    g.draw3DRect(5, 15, 50, 75, false);
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.setColor(Color.gray);//from  w  w  w .j  a va 2 s . c  o  m
    g.draw3DRect(25, 10, 50, 75, true);
    g.draw3DRect(25, 110, 50, 75, false);
    g.fill3DRect(100, 10, 50, 75, true);
    g.fill3DRect(100, 110, 50, 75, false);
}

From source file:DrawRectPanel.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(Color.blue);//  w  w w  . j av  a  2  s .  c o  m
    g.drawRect(10, 10, 80, 30);
    g.drawRoundRect(100, 10, 80, 30, 15, 15);

    int thickness = 4;

    for (int i = 0; i <= thickness; i++)
        g.draw3DRect(200 - i, 10 - i, 80 + 2 * i, 30 + 2 * i, true);
    for (int i = 0; i < thickness; i++)
        g.draw3DRect(200 - i, 50 - i, 80 + 2 * i, 30 + 2 * i, false);

    g.drawOval(10, 100, 80, 30);
}

From source file:FillRectPanel.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawRect(10, 10, 80, 30);/*from ww  w . ja  v a  2s  .c  o  m*/
    g.drawRoundRect(100, 10, 80, 30, 15, 15);
    g.drawOval(10, 100, 80, 30);
    g.setColor(Color.red);
    g.fillRect(10, 10, 80, 30);
    g.fillRoundRect(100, 10, 80, 30, 15, 15);

    int thickness = 4;

    g.fill3DRect(200, 10, 80, 30, true);
    for (int i = 1; i <= thickness; i++)
        g.draw3DRect(200 - i, 10 - i, 80 + 2 * i - 1, 30 + 2 * i - 1, true);

    g.fill3DRect(200, 50, 80, 30, false);
    for (int i = 1; i <= thickness; i++)
        g.draw3DRect(200 - i, 50 - i, 80 + 2 * i - 1, 30 + 2 * i - 1, true);

    g.fillOval(10, 100, 80, 30);
}

From source file:CalIcon.java

/** paintIcon: draw the calendar page. */
public void paintIcon(Component c, Graphics g, int x, int y) {

    // Allow clock to get painted (voodoo magic)
    if (showTime)
        super.paint(g);

    // Outline it.
    g.setColor(Color.black);/*from   w w  w  . ja  va2 s  .c om*/
    g.draw3DRect(x, y, d.width - 2, d.height - 2, true);

    // Show the date: First, a white page with a drop shadow.
    g.setColor(Color.gray);
    g.fillRect(x + RBX + 3, y + RBY + 3, RBW, RBH);
    g.setColor(Color.white);
    g.fillRect(x + RBX, y + RBY, RBW, RBH);

    // g.setColor(getForeground());
    g.setColor(Color.black);

    String s = days[myCal.get(Calendar.DAY_OF_WEEK) - 1];
    g.setFont(dayNameFont);
    int w = dayNameFM.stringWidth(s);
    g.drawString(s, x + RBX + ((RBW - w) / 2), y + RBY + 10);

    s = Integer.toString(myCal.get(Calendar.DAY_OF_MONTH));
    g.setFont(dayNumbFont);
    w = dayNumbFM.stringWidth(s);
    g.drawString(s, x + RBX + ((RBW - w) / 2), y + RBY + 25);

    s = mons[myCal.get(Calendar.MONTH)];
    g.setFont(monNameFont);
    w = monNameFM.stringWidth(s);
    g.drawString(s, x + RBX + ((RBW - w) / 2), y + RBY + 35);
}

From source file:TalkServerThread.java

public void paint(Graphics g) {
        Dimension d = getSize();//from  ww w  .  j ava  2  s.co  m
        Color bg = getBackground();

        g.setColor(bg);
        g.draw3DRect(0, 0, d.width - 1, d.height - 1, true);
        g.draw3DRect(3, 3, d.width - 7, d.height - 7, false);
    }