source: trunk/gli/src/org/greenstone/gatherer/gui/BorderFactory.java@ 4675

Last change on this file since 4675 was 4675, checked in by jmt12, 21 years ago

Sunday's work

  • Property svn:keywords set to Author Date Id Revision
File size: 7.8 KB
Line 
1package org.greenstone.gatherer.gui;
2
3import java.awt.*;
4import javax.swing.*;
5import javax.swing.border.*;
6import org.greenstone.gatherer.gui.border.TitledBorder;
7/** Gatherers own version of the javax.swing.BorderFactory which has two major differences: firstly the titled borders returned are org.greenstone.gatherer.gui.border.TitledBorders which are aware who their parents are and are -not- ever shared. The second difference is that I haven't been so much of a biarch as to use a private contructor so as prevent any other programmer in the world from extending my class. Jaded? Me? Nah.
8 * @author John Thompson, Digital Library, University of Waikato.
9 * @version 2.3
10 */
11public class BorderFactory {
12 /** Creates a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. */
13 static public Border createBevelBorder(int type) {
14 return javax.swing.BorderFactory.createBevelBorder(type);
15 }
16 /** Creates a beveled border of the specified type, using the specified highlighting and shadowing. */
17 static public Border createBevelBorder(int type, Color highlight, Color shadow) {
18 return javax.swing.BorderFactory.createBevelBorder(type, highlight, shadow);
19 }
20 /** Creates a beveled border of the specified type, using the specified colors for the inner and outer highlight and shadow areas. */
21 static public Border createBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) {
22 return javax.swing.BorderFactory.createBevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner);
23 }
24 /** Creates a compound border with a null inside edge and a null outside edge. */
25 static public CompoundBorder createCompoundBorder() {
26 return javax.swing.BorderFactory.createCompoundBorder();
27 }
28 /** Creates a compound border specifying the border objects to use for the outside and inside edges. */
29 static public CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder) {
30 return javax.swing.BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
31 }
32 /** Creates an empty border that takes up no space. */
33 static public Border createEmptyBorder() {
34 return javax.swing.BorderFactory.createEmptyBorder();
35 }
36 /** Creates an empty border that takes up space but which does no drawing, specifying the width of the top, left, bottom, and right sides. */
37 static public Border createEmptyBorder(int top, int left, int bottom, int right) {
38 return javax.swing.BorderFactory.createEmptyBorder(top, left, bottom, right);
39 }
40 /** Creates a border with an "etched" look using the component's current background color for highlighting and shading. */
41 static public Border createEtchedBorder() {
42 return javax.swing.BorderFactory.createEtchedBorder();
43 }
44 /** Creates a border with an "etched" look using the specified highlighting and shading colors. */
45 static public Border createEtchedBorder(Color highlight, Color shadow) {
46 return javax.swing.BorderFactory.createEtchedBorder(highlight, shadow);
47 }
48 /** Creates a border with an "etched" look using the component's current background color for highlighting and shading. */
49 static public Border createEtchedBorder(int type) {
50 return javax.swing.BorderFactory.createEtchedBorder(type);
51 }
52 /** Creates a border with an "etched" look using the specified highlighting and shading colors. */
53 static public Border createEtchedBorder(int type, Color highlight, Color shadow) {
54 return javax.swing.BorderFactory.createEtchedBorder(type, highlight, shadow);
55 }
56 /** Creates a line border withe the specified color. */
57 static public Border createLineBorder(Color color) {
58 return javax.swing.BorderFactory.createLineBorder(color);
59 }
60 /** Creates a line border with the specified color and width. */
61 static public Border createLineBorder(Color color, int thickness) {
62 return javax.swing.BorderFactory.createLineBorder(color, thickness);
63 }
64 /** Creates a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. */
65 static public Border createLoweredBevelBorder() {
66 return javax.swing.BorderFactory.createLoweredBevelBorder();
67 }
68 /** Creates a matte-look border using a solid color. */
69 static public MatteBorder createMatteBorder(int top, int left, int bottom, int right, Color color) {
70 return javax.swing.BorderFactory.createMatteBorder(top, left, bottom, right, color);
71 }
72 /** Creates a matte-look border that consists of multiple tiles of a specified icon. */
73 static public MatteBorder createMatteBorder(int top, int left, int bottom, int right, Icon tileIcon) {
74 return javax.swing.BorderFactory.createMatteBorder(top, left, bottom, right, tileIcon);
75 }
76 /** Creates a border with a raised beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. */
77 static public Border createRaisedBevelBorder() {
78 return javax.swing.BorderFactory.createRaisedBevelBorder();
79 }
80 /** Creates a new title border with an empty title specifying the border object, using the default text position (sitting on the top line) and default justification (leading) and using the default font, and text color. */
81 static public org.greenstone.gatherer.gui.border.TitledBorder createTitledBorder(Border border) {
82 return new org.greenstone.gatherer.gui.border.TitledBorder(border);
83 }
84 /** Adds a title to an existing border, specifying the text of the title, using the default positioning (sitting on the top line) and default justification (leading) and using the default font and text color determined by the current look and feel. */
85 static public org.greenstone.gatherer.gui.border.TitledBorder createTitledBorder(Border border, String title) {
86 return new org.greenstone.gatherer.gui.border.TitledBorder(border, title);
87 }
88 /** Adds a title to an existing border, specifying the text of the title along with its positioning, using the default font and text color determined by the current look and feel. */
89 static public org.greenstone.gatherer.gui.border.TitledBorder createTitledBorder(Border border, String title, int justification, int position) {
90 return new org.greenstone.gatherer.gui.border.TitledBorder(border, title, justification, position);
91 }
92 /** Adds a title to an existing border, specifying the text of the title along with its positioning and font, using the default text color determined by the current look and feel. */
93 static public org.greenstone.gatherer.gui.border.TitledBorder createTitledBorder(Border border, String title, int justification, int position, Font font) {
94 return new org.greenstone.gatherer.gui.border.TitledBorder(border, title, justification, position, font);
95 }
96 /** Adds a title to an existing border, specifying the text of the title along with its positioning, font, and color. */
97 static public org.greenstone.gatherer.gui.border.TitledBorder createTitledBorder(Border border, String title, int justification, int position, Font font, Color color) {
98 return new org.greenstone.gatherer.gui.border.TitledBorder(border, title, justification, position, font, color);
99 }
100 /** Creates a new title border specifying the text of the title, using the default border (etched), using the default text position (sitting on the top line) and default justification (leading) and using the default font and text color determined by the current look and feel. */
101 static public org.greenstone.gatherer.gui.border.TitledBorder createTitledBorder(String title) {
102 return new org.greenstone.gatherer.gui.border.TitledBorder(title);
103 }
104}
Note: See TracBrowser for help on using the repository browser.