Java tutorial
//package com.java2s; /* * %W% %E% * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.awt.Color; import java.awt.Graphics; public class Main { public static void drawGroove(Graphics g, int x, int y, int w, int h, Color shadow, Color highlight) { Color oldColor = g.getColor(); // Make no net change to g g.translate(x, y); g.setColor(shadow); g.drawRect(0, 0, w - 2, h - 2); g.setColor(highlight); 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); g.setColor(oldColor); } }