| 
3599
 | 
     1  | 
/***************************************************************************
  | 
| 
 | 
     2  | 
  Title:      awtUtilities/Border.java
  | 
| 
 | 
     3  | 
  ID:         $Id$
  | 
| 
 | 
     4  | 
  Author:     Stefan Berghofer, TU Muenchen
  | 
| 
 | 
     5  | 
  Copyright   1997  TU Muenchen
  | 
| 
 | 
     6  | 
  | 
| 
 | 
     7  | 
  This class defines a nice 3D border.
  | 
| 
 | 
     8  | 
***************************************************************************/
  | 
| 
 | 
     9  | 
  | 
| 
 | 
    10  | 
package awtUtilities;
  | 
| 
 | 
    11  | 
  | 
| 
 | 
    12  | 
import java.awt.*;
  | 
| 
 | 
    13  | 
  | 
| 
 | 
    14  | 
public class Border extends Panel {
 | 
| 
 | 
    15  | 
	int bs;
  | 
| 
 | 
    16  | 
  | 
| 
6541
 | 
    17  | 
	public Insets getInsets() {
 | 
| 
3599
 | 
    18  | 
		return new Insets(bs*3/2,bs*3/2,bs*3/2,bs*3/2);
  | 
| 
 | 
    19  | 
	}
  | 
| 
 | 
    20  | 
  | 
| 
 | 
    21  | 
	public Border(Component comp,int s) {
 | 
| 
 | 
    22  | 
		setLayout(new GridLayout(1,1));
  | 
| 
 | 
    23  | 
		add(comp);
  | 
| 
 | 
    24  | 
		bs=s;
  | 
| 
 | 
    25  | 
	}
  | 
| 
 | 
    26  | 
  | 
| 
 | 
    27  | 
	public void paint(Graphics g) {
 | 
| 
6541
 | 
    28  | 
		int w = getSize().width;
  | 
| 
 | 
    29  | 
		int h = getSize().height;
  | 
| 
3599
 | 
    30  | 
		int x1[]={0,bs,w-bs,w}, y1[]={0,bs,bs,0};
 | 
| 
 | 
    31  | 
		int x2[]={w,w-bs,w-bs,w}, y2[]={0,bs,h-bs,h};
 | 
| 
 | 
    32  | 
		int y3[]={h,h-bs,h-bs,h};
 | 
| 
 | 
    33  | 
  | 
| 
 | 
    34  | 
		g.setColor(new Color(224,224,224));
  | 
| 
 | 
    35  | 
		g.fillPolygon(y1,y2,4);
  | 
| 
 | 
    36  | 
		g.fillPolygon(x1,y1,4);
  | 
| 
 | 
    37  | 
		g.setColor(Color.gray);
  | 
| 
 | 
    38  | 
		g.fillPolygon(x2,y2,4);
  | 
| 
 | 
    39  | 
		g.fillPolygon(x1,y3,4);
  | 
| 
 | 
    40  | 
	}
  | 
| 
 | 
    41  | 
}
  |