Java Code Examples for java.awt.Graphics#translate()

The following examples show how to use java.awt.Graphics#translate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EtchedBorder.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Paints the border for the specified component with the
 * specified position and size.
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    int w = width;
    int h = height;

    g.translate(x, y);

    g.setColor(etchType == LOWERED? getShadowColor(c) : getHighlightColor(c));
    g.drawRect(0, 0, w-2, h-2);

    g.setColor(etchType == LOWERED? getHighlightColor(c) : getShadowColor(c));
    g.drawLine(1, h-3, 1, 1);
    g.drawLine(1, 1, w-3, 1);

    g.drawLine(0, h-1, w-1, h-1);
    g.drawLine(w-1, h-1, w-1, 0);

    g.translate(-x, -y);
}
 
Example 2
Source File: MotifIconFactory.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public void drawCheckBezelOut(Graphics g, int x, int y, int csize){
    Color controlShadow = UIManager.getColor("controlShadow");

    int w = csize;
    int h = csize;
    Color oldColor = g.getColor();

    g.translate(x,y);
    g.setColor(highlight);    // inner 3D border
    g.drawLine(0, 0, 0, h-1);
    g.drawLine(1, 0, w-1, 0);

    g.setColor(shadow);         // black drop shadow  __|
    g.drawLine(1, h-1, w-1, h-1);
    g.drawLine(w-1, h-1, w-1, 1);
    g.translate(-x,-y);
    g.setColor(oldColor);
}
 
Example 3
Source File: BasicGraphicsUtils.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void drawEtchedRect(Graphics g, int x, int y, int w, int h,
                                  Color shadow, Color darkShadow,
                                  Color highlight, Color lightHighlight)
{
    Color oldColor = g.getColor();  // Make no net change to g
    g.translate(x, y);

    g.setColor(shadow);
    g.drawLine(0, 0, w-1, 0);      // outer border, top
    g.drawLine(0, 1, 0, h-2);      // outer border, left

    g.setColor(darkShadow);
    g.drawLine(1, 1, w-3, 1);      // inner border, top
    g.drawLine(1, 2, 1, h-3);      // inner border, left

    g.setColor(lightHighlight);
    g.drawLine(w-1, 0, w-1, h-1);  // outer border, bottom
    g.drawLine(0, h-1, w-1, h-1);  // outer border, right

    g.setColor(highlight);
    g.drawLine(w-2, 1, w-2, h-3);  // inner border, right
    g.drawLine(1, h-2, w-2, h-2);  // inner border, bottom

    g.translate(-x, -y);
    g.setColor(oldColor);
}
 
Example 4
Source File: MotifScrollBarUI.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
    if (thumbBounds.isEmpty() || !scrollbar.isEnabled()) {
        return;
    }

    int w = thumbBounds.width;
    int h = thumbBounds.height;

    g.translate(thumbBounds.x, thumbBounds.y);
    g.setColor(thumbColor);
    g.fillRect(0, 0, w - 1, h - 1);

    g.setColor(thumbHighlightColor);
    drawVLine(g, 0, 0, h - 1);
    drawHLine(g, 1, w - 1, 0);

    g.setColor(thumbLightShadowColor);
    drawHLine(g, 1, w - 1, h - 1);
    drawVLine(g, w - 1, 1, h - 2);

    g.translate(-thumbBounds.x, -thumbBounds.y);
}
 
Example 5
Source File: WinClassicViewTabDisplayerUI.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected void paintTabBorder(Graphics g, int index, int x, int y,
                              int width, int height) {
                                  
    // subtract lower border
    height--;
    boolean isSelected = isSelected(index);

    g.translate(x, y);

    g.setColor(UIManager.getColor("InternalFrame.borderShadow")); //NOI18N
    g.drawLine(0, height - 1, width - 2, height - 1);
    g.drawLine(width - 1, height - 1, width - 1, 0);

    g.setColor(isSelected ? UIManager.getColor(
            "InternalFrame.borderHighlight") //NOI18N
               : UIManager.getColor("InternalFrame.borderLight")); //NOI18N
    g.drawLine(0, 0, 0, height - 1);
    g.drawLine(1, 0, width - 2, 0);

    g.translate(-x, -y);
}
 
Example 6
Source File: MotifIconFactory.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void drawCheckBezelOut(Graphics g, int x, int y, int csize){
    Color controlShadow = UIManager.getColor("controlShadow");

    int w = csize;
    int h = csize;
    Color oldColor = g.getColor();

    g.translate(x,y);
    g.setColor(highlight);    // inner 3D border
    g.drawLine(0, 0, 0, h-1);
    g.drawLine(1, 0, w-1, 0);

    g.setColor(shadow);         // black drop shadow  __|
    g.drawLine(1, h-1, w-1, h-1);
    g.drawLine(w-1, h-1, w-1, 1);
    g.translate(-x,-y);
    g.setColor(oldColor);
}
 
Example 7
Source File: MetalBorders.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h )
{
    if (!(c instanceof JToolBar)) {
        return;
    }
    g.translate( x, y );

    if ( ((JToolBar) c).isFloatable() )
    {
        if ( ((JToolBar) c).getOrientation() == HORIZONTAL )
        {
            int shift = MetalLookAndFeel.usingOcean() ? -1 : 0;
            bumps.setBumpArea( 10, h - 4 );
            if( MetalUtils.isLeftToRight(c) ) {
                bumps.paintIcon( c, g, 2, 2 + shift );
            } else {
                bumps.paintIcon( c, g, w-12,
                                 2 + shift );
            }
        }
        else // vertical
        {
            bumps.setBumpArea( w - 4, 10 );
            bumps.paintIcon( c, g, 2, 2 );
        }

    }

    if (((JToolBar) c).getOrientation() == HORIZONTAL &&
                       MetalLookAndFeel.usingOcean()) {
        g.setColor(MetalLookAndFeel.getControl());
        g.drawLine(0, h - 2, w, h - 2);
        g.setColor(UIManager.getColor("ToolBar.borderColor"));
        g.drawLine(0, h - 1, w, h - 1);
    }

    g.translate( -x, -y );
}
 
Example 8
Source File: BevelBorder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void paintRaisedBevel(Component c, Graphics g, int x, int y,
                                int width, int height)  {
    Color oldColor = g.getColor();
    int h = height;
    int w = width;

    g.translate(x, y);

    g.setColor(getHighlightOuterColor(c));
    g.drawLine(0, 0, 0, h-2);
    g.drawLine(1, 0, w-2, 0);

    g.setColor(getHighlightInnerColor(c));
    g.drawLine(1, 1, 1, h-3);
    g.drawLine(2, 1, w-3, 1);

    g.setColor(getShadowOuterColor(c));
    g.drawLine(0, h-1, w-1, h-1);
    g.drawLine(w-1, 0, w-1, h-2);

    g.setColor(getShadowInnerColor(c));
    g.drawLine(1, h-2, w-2, h-2);
    g.drawLine(w-2, 1, w-2, h-3);

    g.translate(-x, -y);
    g.setColor(oldColor);

}
 
Example 9
Source File: BasicBorders.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Color oldColor = g.getColor();
    g.translate(x, y);
    g.setColor(shadow);
    SwingUtilities2.drawHLine(g, 0, width - 1, height - 2);
    g.setColor(highlight);
    SwingUtilities2.drawHLine(g, 0, width - 1, height - 1);
    g.translate(-x, -y);
    g.setColor(oldColor);
}
 
Example 10
Source File: RenderTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    RenderTests.Context rctx = (RenderTests.Context) ctx;
    int size = rctx.size;
    int x = rctx.initX;
    int y = rctx.initY;
    int hexaX[] = new int[6];
    int hexaY[] = new int[6];
    Graphics g = rctx.graphics;
    g.translate(rctx.orgX, rctx.orgY);
    Color rCArray[] = rctx.colorlist;
    int ci = rctx.colorindex;
    do {
        hexaX[0] = x;
        hexaX[1] = hexaX[5] = x+size/4;
        hexaX[2] = hexaX[4] = x+size-size/4;
        hexaX[3] = x+size;
        hexaY[1] = hexaY[2] = y;
        hexaY[0] = hexaY[3] = y+size/2;
        hexaY[4] = hexaY[5] = y+size;

        if (rCArray != null) {
            g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
        }
        g.fillPolygon(hexaX, hexaY, 6);
        if ((x -= 3) < 0) x += rctx.maxX;
        if ((y -= 1) < 0) y += rctx.maxY;
    } while (--numReps > 0);
    rctx.colorindex = ci;
    g.translate(-rctx.orgX, -rctx.orgY);
}
 
Example 11
Source File: MyCursor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override public void paint(Graphics gr) {
    gr.setColor(Color.GREEN);
    ((Graphics2D)gr).setStroke(new BasicStroke(3));

    gr.translate(width/2, height/2);
    int R = width/4;
    gr.drawOval(-R, -R, 2*R, 2*R);
    gr.drawLine(-R, R, R, -R);
}
 
Example 12
Source File: MetalBorders.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
    if (!(c instanceof JMenuItem)) {
        return;
    }
    JMenuItem b = (JMenuItem) c;
    ButtonModel model = b.getModel();

    g.translate( x, y );

    if ( c.getParent() instanceof JMenuBar ) {
        if ( model.isArmed() || model.isSelected() ) {
            g.setColor( MetalLookAndFeel.getControlDarkShadow() );
            g.drawLine( 0, 0, w - 2, 0 );
            g.drawLine( 0, 0, 0, h - 1 );
            g.drawLine( w - 2, 2, w - 2, h - 1 );

            g.setColor( MetalLookAndFeel.getPrimaryControlHighlight() );
            g.drawLine( w - 1, 1, w - 1, h - 1 );

            g.setColor( MetalLookAndFeel.getMenuBackground() );
            g.drawLine( w - 1, 0, w - 1, 0 );
        }
    } else {
        if (  model.isArmed() || ( c instanceof JMenu && model.isSelected() ) ) {
            g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );
            g.drawLine( 0, 0, w - 1, 0 );

            g.setColor( MetalLookAndFeel.getPrimaryControlHighlight() );
            g.drawLine( 0, h - 1, w - 1, h - 1 );
        } else {
            g.setColor( MetalLookAndFeel.getPrimaryControlHighlight() );
            g.drawLine( 0, 0, 0, h - 1 );
        }
    }

    g.translate( -x, -y );
}
 
Example 13
Source File: Utils.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(LINE);
    g.drawLine(0, 0, getWidth() - 1, getHeight() - 1);
    g.drawLine(0, getHeight() - 1, getWidth() - 1, 0);
    
    Point p = label.getLocation();
    g.translate(p.x, p.y);
    label.paint(g);
    g.translate(-p.x, -p.y);
}
 
Example 14
Source File: MyCursor.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override public void paint(Graphics gr) {
    gr.setColor(Color.GREEN);
    ((Graphics2D)gr).setStroke(new BasicStroke(3));

    gr.translate(width/2, height/2);
    int R = width/4;
    gr.drawOval(-R, -R, 2*R, 2*R);
    gr.drawLine(-R, R, R, -R);
}
 
Example 15
Source File: MotifSliderUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void paintThumb(Graphics g)  {
    Rectangle knobBounds = thumbRect;

    int x = knobBounds.x;
    int y = knobBounds.y;
    int w = knobBounds.width;
    int h = knobBounds.height;

    if ( slider.isEnabled() ) {
        g.setColor(slider.getForeground());
    }
    else {
        // PENDING(jeff) - the thumb should be dithered when disabled
        g.setColor(slider.getForeground().darker());
    }

    if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
        g.translate(x, knobBounds.y-1);

        // fill
        g.fillRect(0, 1, w, h - 1);

        // highlight
        g.setColor(getHighlightColor());
        drawHLine(g, 0, w - 1, 1);      // top
        drawVLine(g, 0, 1, h);          // left
        drawVLine(g, w / 2, 2, h - 1);  // center

        // shadow
        g.setColor(getShadowColor());
        drawHLine(g, 0, w - 1, h);      // bottom
        drawVLine(g, w - 1, 1, h);      // right
        drawVLine(g, w / 2 - 1, 2, h);  // center

        g.translate(-x, -(knobBounds.y-1));
    }
    else {
        g.translate(knobBounds.x-1, 0);

        // fill
        g.fillRect(1, y, w - 1, h);

        // highlight
        g.setColor(getHighlightColor());
        drawHLine(g, 1, w, y);             // top
        drawVLine(g, 1, y + 1, y + h - 1); // left
        drawHLine(g, 2, w - 1, y + h / 2); // center

        // shadow
        g.setColor(getShadowColor());
        drawHLine(g, 2, w, y + h - 1);        // bottom
        drawVLine(g, w, y + h - 1, y);        // right
        drawHLine(g, 2, w - 1, y + h / 2 - 1);// center

        g.translate(-(knobBounds.x-1), 0);
    }
}
 
Example 16
Source File: BasicGraphicsUtils.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void drawBezel(Graphics g, int x, int y, int w, int h,
                             boolean isPressed, boolean isDefault,
                             Color shadow, Color darkShadow,
                             Color highlight, Color lightHighlight)
{
    Color oldColor = g.getColor();  // Make no net change to g
    g.translate(x, y);

    if (isPressed && isDefault) {
        g.setColor(darkShadow);
        g.drawRect(0, 0, w - 1, h - 1);
        g.setColor(shadow);
        g.drawRect(1, 1, w - 3, h - 3);
    } else if (isPressed) {
        drawLoweredBezel(g, x, y, w, h,
                         shadow, darkShadow, highlight, lightHighlight);
    } else if (isDefault) {
        g.setColor(darkShadow);
        g.drawRect(0, 0, w-1, h-1);

        g.setColor(lightHighlight);
        g.drawLine(1, 1, 1, h-3);
        g.drawLine(2, 1, w-3, 1);

        g.setColor(highlight);
        g.drawLine(2, 2, 2, h-4);
        g.drawLine(3, 2, w-4, 2);

        g.setColor(shadow);
        g.drawLine(2, h-3, w-3, h-3);
        g.drawLine(w-3, 2, w-3, h-4);

        g.setColor(darkShadow);
        g.drawLine(1, h-2, w-2, h-2);
        g.drawLine(w-2, h-2, w-2, 1);
    } else {
        g.setColor(lightHighlight);
        g.drawLine(0, 0, 0, h-1);
        g.drawLine(1, 0, w-2, 0);

        g.setColor(highlight);
        g.drawLine(1, 1, 1, h-3);
        g.drawLine(2, 1, w-3, 1);

        g.setColor(shadow);
        g.drawLine(1, h-2, w-2, h-2);
        g.drawLine(w-2, 1, w-2, h-3);

        g.setColor(darkShadow);
        g.drawLine(0, h-1, w-1, h-1);
        g.drawLine(w-1, h-1, w-1, 0);
    }
    g.translate(-x, -y);
    g.setColor(oldColor);
}
 
Example 17
Source File: WindowsBorders.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y,
                        int width, int height) {
    if (!(c instanceof JToolBar)) {
        return;
    }
    g.translate(x, y);

    XPStyle xp = XPStyle.getXP();
    if (xp != null) {
        Border xpBorder = xp.getBorder(c, Part.TP_TOOLBAR);
        if (xpBorder != null) {
            xpBorder.paintBorder(c, g, 0, 0, width, height);
        }
    }
    if (((JToolBar)c).isFloatable()) {
        boolean vertical = ((JToolBar)c).getOrientation() == VERTICAL;

        if (xp != null) {
            Part part = vertical ? Part.RP_GRIPPERVERT : Part.RP_GRIPPER;
            Skin skin = xp.getSkin(c, part);
            int dx, dy, dw, dh;
            if (vertical) {
                dx = 0;
                dy = 2;
                dw = width - 1;
                dh = skin.getHeight();
            } else {
                dw = skin.getWidth();
                dh = height - 1;
                dx = c.getComponentOrientation().isLeftToRight() ? 2 : (width-dw-2);
                dy = 0;
            }
            skin.paintSkin(g, dx, dy, dw, dh, State.NORMAL);

        } else {

            if (!vertical) {
                if (c.getComponentOrientation().isLeftToRight()) {
                    g.setColor(shadow);
                    g.drawLine(4, 3, 4, height - 4);
                    g.drawLine(4, height - 4, 2, height - 4);

                    g.setColor(highlight);
                    g.drawLine(2, 3, 3, 3);
                    g.drawLine(2, 3, 2, height - 5);
                } else {
                    g.setColor(shadow);
                    g.drawLine(width - 3, 3, width - 3, height - 4);
                    g.drawLine(width - 4, height - 4, width - 4, height - 4);

                    g.setColor(highlight);
                    g.drawLine(width - 5, 3, width - 4, 3);
                    g.drawLine(width - 5, 3, width - 5, height - 5);
                }
            } else { // Vertical
                g.setColor(shadow);
                g.drawLine(3, 4, width - 4, 4);
                g.drawLine(width - 4, 2, width - 4, 4);

                g.setColor(highlight);
                g.drawLine(3, 2, width - 4, 2);
                g.drawLine(3, 2, 3, 3);
            }
        }
    }

    g.translate(-x, -y);
}
 
Example 18
Source File: MetalScrollBarUI.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void paintThumb( Graphics g, JComponent c, Rectangle thumbBounds )
{
    if (!c.isEnabled()) {
        return;
    }

    if (MetalLookAndFeel.usingOcean()) {
        oceanPaintThumb(g, c, thumbBounds);
        return;
    }

    boolean leftToRight = MetalUtils.isLeftToRight(c);

    g.translate( thumbBounds.x, thumbBounds.y );

    if ( scrollbar.getOrientation() == JScrollBar.VERTICAL )
    {
        if ( !isFreeStanding ) {
            thumbBounds.width += 2;
            if ( !leftToRight ) {
                g.translate( -1, 0 );
            }
        }

        g.setColor( thumbColor );
        g.fillRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );

        g.setColor( thumbShadow );
        g.drawRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );

        g.setColor( thumbHighlightColor );
        g.drawLine( 1, 1, thumbBounds.width - 3, 1 );
        g.drawLine( 1, 1, 1, thumbBounds.height - 2 );

        bumps.setBumpArea( thumbBounds.width - 6, thumbBounds.height - 7 );
        bumps.paintIcon( c, g, 3, 4 );

        if ( !isFreeStanding ) {
            thumbBounds.width -= 2;
            if ( !leftToRight ) {
                g.translate( 1, 0 );
            }
        }
    }
    else  // HORIZONTAL
    {
        if ( !isFreeStanding ) {
            thumbBounds.height += 2;
        }

        g.setColor( thumbColor );
        g.fillRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );

        g.setColor( thumbShadow );
        g.drawRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );

        g.setColor( thumbHighlightColor );
        g.drawLine( 1, 1, thumbBounds.width - 3, 1 );
        g.drawLine( 1, 1, 1, thumbBounds.height - 3 );

        bumps.setBumpArea( thumbBounds.width - 7, thumbBounds.height - 6 );
        bumps.paintIcon( c, g, 4, 3 );

        if ( !isFreeStanding ) {
            thumbBounds.height -= 2;
        }
    }

    g.translate( -thumbBounds.x, -thumbBounds.y );
}
 
Example 19
Source File: MetalScrollBarUI.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void paintThumb( Graphics g, JComponent c, Rectangle thumbBounds )
{
    if (!c.isEnabled()) {
        return;
    }

    if (MetalLookAndFeel.usingOcean()) {
        oceanPaintThumb(g, c, thumbBounds);
        return;
    }

    boolean leftToRight = MetalUtils.isLeftToRight(c);

    g.translate( thumbBounds.x, thumbBounds.y );

    if ( scrollbar.getOrientation() == JScrollBar.VERTICAL )
    {
        if ( !isFreeStanding ) {
            thumbBounds.width += 2;
            if ( !leftToRight ) {
                g.translate( -1, 0 );
            }
        }

        g.setColor( thumbColor );
        g.fillRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );

        g.setColor( thumbShadow );
        drawRect(g, 0, 0, thumbBounds.width - 2, thumbBounds.height - 1);

        g.setColor( thumbHighlightColor );
        drawHLine(g, 1, thumbBounds.width - 3, 1);
        drawVLine(g, 1, 1, thumbBounds.height - 2);

        bumps.setBumpArea( thumbBounds.width - 6, thumbBounds.height - 7 );
        bumps.paintIcon( c, g, 3, 4 );

        if ( !isFreeStanding ) {
            thumbBounds.width -= 2;
            if ( !leftToRight ) {
                g.translate( 1, 0 );
            }
        }
    }
    else  // HORIZONTAL
    {
        if ( !isFreeStanding ) {
            thumbBounds.height += 2;
        }

        g.setColor( thumbColor );
        g.fillRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );

        g.setColor( thumbShadow );
        drawRect(g, 0, 0, thumbBounds.width - 1, thumbBounds.height - 2);

        g.setColor( thumbHighlightColor );
        drawHLine(g, 1, thumbBounds.width - 3, 1);
        drawVLine(g, 1, 1, thumbBounds.height - 3);

        bumps.setBumpArea( thumbBounds.width - 7, thumbBounds.height - 6 );
        bumps.paintIcon( c, g, 4, 3 );

        if ( !isFreeStanding ) {
            thumbBounds.height -= 2;
        }
    }

    g.translate( -thumbBounds.x, -thumbBounds.y );
}
 
Example 20
Source File: SoftBevelBorder.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Paints the border for the specified component with the specified
 * position and size.
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Color oldColor = g.getColor();
    g.translate(x, y);

    if (bevelType == RAISED) {
        g.setColor(getHighlightOuterColor(c));
        g.drawLine(0, 0, width-2, 0);
        g.drawLine(0, 0, 0, height-2);
        g.drawLine(1, 1, 1, 1);

        g.setColor(getHighlightInnerColor(c));
        g.drawLine(2, 1, width-2, 1);
        g.drawLine(1, 2, 1, height-2);
        g.drawLine(2, 2, 2, 2);
        g.drawLine(0, height-1, 0, height-2);
        g.drawLine(width-1, 0, width-1, 0);

        g.setColor(getShadowOuterColor(c));
        g.drawLine(2, height-1, width-1, height-1);
        g.drawLine(width-1, 2, width-1, height-1);

        g.setColor(getShadowInnerColor(c));
        g.drawLine(width-2, height-2, width-2, height-2);


    } else if (bevelType == LOWERED) {
        g.setColor(getShadowOuterColor(c));
        g.drawLine(0, 0, width-2, 0);
        g.drawLine(0, 0, 0, height-2);
        g.drawLine(1, 1, 1, 1);

        g.setColor(getShadowInnerColor(c));
        g.drawLine(2, 1, width-2, 1);
        g.drawLine(1, 2, 1, height-2);
        g.drawLine(2, 2, 2, 2);
        g.drawLine(0, height-1, 0, height-2);
        g.drawLine(width-1, 0, width-1, 0);

        g.setColor(getHighlightOuterColor(c));
        g.drawLine(2, height-1, width-1, height-1);
        g.drawLine(width-1, 2, width-1, height-1);

        g.setColor(getHighlightInnerColor(c));
        g.drawLine(width-2, height-2, width-2, height-2);
    }
    g.translate(-x, -y);
    g.setColor(oldColor);
}