lib/browser/awtUtilities/Border.java
author blanchet
Tue, 21 Dec 2010 01:12:17 +0100
changeset 41334 3cb52cbf0eed
parent 33686 8e33ca8832b1
permissions -rw-r--r--
enable E weight generation with unofficial latest version of E (tentatively called E 1.2B) -- backed by Judgment Day
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
  Author:     Stefan Berghofer, TU Muenchen
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     4
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     5
  This class defines a nice 3D border.
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
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     8
package awtUtilities;
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
import java.awt.*;
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
public class Border extends Panel {
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    13
	int bs;
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    14
6541
d3ac35b2bfbf Updated to JDK 1.1.x
berghofe
parents: 3599
diff changeset
    15
	public Insets getInsets() {
3599
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    16
		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
    17
	}
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    18
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    19
	public Border(Component comp,int s) {
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    20
		setLayout(new GridLayout(1,1));
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    21
		add(comp);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    22
		bs=s;
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    23
	}
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    24
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    25
	public void paint(Graphics g) {
6541
d3ac35b2bfbf Updated to JDK 1.1.x
berghofe
parents: 3599
diff changeset
    26
		int w = getSize().width;
d3ac35b2bfbf Updated to JDK 1.1.x
berghofe
parents: 3599
diff changeset
    27
		int h = getSize().height;
3599
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    28
		int x1[]={0,bs,w-bs,w}, y1[]={0,bs,bs,0};
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    29
		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
    30
		int y3[]={h,h-bs,h-bs,h};
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    31
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    32
		g.setColor(new Color(224,224,224));
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    33
		g.fillPolygon(y1,y2,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    34
		g.fillPolygon(x1,y1,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    35
		g.setColor(Color.gray);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    36
		g.fillPolygon(x2,y2,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    37
		g.fillPolygon(x1,y3,4);
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    38
	}
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
    39
}