lib/browser/awtUtilities/Border.java
author wenzelm
Wed, 15 Apr 2009 11:14:48 +0200
changeset 30895 bad26d8f0adf
parent 6541 d3ac35b2bfbf
child 33686 8e33ca8832b1
permissions -rw-r--r--
updated for Isabelle2009;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3599
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     1
/***************************************************************************
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     2
  Title:      awtUtilities/Border.java
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     3
  ID:         $Id$
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     4
  Author:     Stefan Berghofer, TU Muenchen
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     5
  Copyright   1997  TU Muenchen
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     6
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     7
  This class defines a nice 3D border.
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     8
***************************************************************************/
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     9
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    10
package awtUtilities;
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    11
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    12
import java.awt.*;
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    13
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    14
public class Border extends Panel {
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    15
	int bs;
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    16
6541
d3ac35b2bfbf Updated to JDK 1.1.x
berghofe
parents: 3599
diff changeset
    17
	public Insets getInsets() {
3599
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    18
		return new Insets(bs*3/2,bs*3/2,bs*3/2,bs*3/2);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    19
	}
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    20
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    21
	public Border(Component comp,int s) {
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    22
		setLayout(new GridLayout(1,1));
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    23
		add(comp);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    24
		bs=s;
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    25
	}
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    26
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    27
	public void paint(Graphics g) {
6541
d3ac35b2bfbf Updated to JDK 1.1.x
berghofe
parents: 3599
diff changeset
    28
		int w = getSize().width;
d3ac35b2bfbf Updated to JDK 1.1.x
berghofe
parents: 3599
diff changeset
    29
		int h = getSize().height;
3599
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    30
		int x1[]={0,bs,w-bs,w}, y1[]={0,bs,bs,0};
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    31
		int x2[]={w,w-bs,w-bs,w}, y2[]={0,bs,h-bs,h};
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    32
		int y3[]={h,h-bs,h-bs,h};
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    33
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    34
		g.setColor(new Color(224,224,224));
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    35
		g.fillPolygon(y1,y2,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    36
		g.fillPolygon(x1,y1,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    37
		g.setColor(Color.gray);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    38
		g.fillPolygon(x2,y2,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    39
		g.fillPolygon(x1,y3,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    40
	}
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    41
}