src/Tools/GraphBrowser/awt/Border.java
author wenzelm
Wed, 22 Jan 2025 22:22:19 +0100
changeset 81954 6f2bcdfa9a19
parent 74015 12b1f4649ab1
permissions -rw-r--r--
misc tuning: more concise operations on prems (without change of exceptions); discontinue odd clone Drule.cprems_of (see also 991a3feaf270);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3599
89cbba12863d Source files for Isabelle theory graph browser.
berghofe
parents:
diff changeset
     1
/***************************************************************************
74015
12b1f4649ab1 clarified names;
wenzelm
parents: 74011
diff changeset
     2
  Title:      awt/Border.java
3599
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
74015
12b1f4649ab1 clarified names;
wenzelm
parents: 74011
diff changeset
     8
package isabelle.awt;
3599
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
}