34 import javax.swing.event.*;
35 import javax.swing.text.*;
36 import javax.swing.border.*;
37 import javax.swing.colorchooser.*;
38 import javax.swing.filechooser.*;
39 import javax.accessibility.*;
40
41 import java.awt.*;
42 import java.awt.event.*;
43 import java.beans.*;
44 import java.util.*;
45 import java.io.*;
46 import java.applet.*;
47 import java.net.*;
48
49 /**
50 * A generic SwingSet2 demo module
51 *
52 * @author Jeff Dinkins
53 */
54 public class DemoModule extends JApplet {
55
56 // The preferred size of the demo
57 private int PREFERRED_WIDTH = 680;
58 private int PREFERRED_HEIGHT = 600;
59
60 Border loweredBorder = new CompoundBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED),
61 new EmptyBorder(5,5,5,5));
62
63 // Premade convenience dimensions, for use wherever you need 'em.
64 public static Dimension HGAP2 = new Dimension(2,1);
65 public static Dimension VGAP2 = new Dimension(1,2);
66
67 public static Dimension HGAP5 = new Dimension(5,1);
68 public static Dimension VGAP5 = new Dimension(1,5);
69
70 public static Dimension HGAP10 = new Dimension(10,1);
71 public static Dimension VGAP10 = new Dimension(1,10);
72
73 public static Dimension HGAP15 = new Dimension(15,1);
74 public static Dimension VGAP15 = new Dimension(1,15);
173 }
174
175 public String getName() {
176 return getString(getResourceName() + ".name");
177 };
178
179 public Icon getIcon() {
180 return createImageIcon(iconPath, getResourceName() + ".name");
181 };
182
183 public String getToolTip() {
184 return getString(getResourceName() + ".tooltip");
185 };
186
187 public void mainImpl() {
188 JFrame frame = new JFrame(getName());
189 frame.getContentPane().setLayout(new BorderLayout());
190 frame.getContentPane().add(getDemoPanel(), BorderLayout.CENTER);
191 getDemoPanel().setPreferredSize(new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT));
192 frame.pack();
193 frame.show();
194 }
195
196 public JPanel createHorizontalPanel(boolean threeD) {
197 JPanel p = new JPanel();
198 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
199 p.setAlignmentY(TOP_ALIGNMENT);
200 p.setAlignmentX(LEFT_ALIGNMENT);
201 if(threeD) {
202 p.setBorder(loweredBorder);
203 }
204 return p;
205 }
206
207 public JPanel createVerticalPanel(boolean threeD) {
208 JPanel p = new JPanel();
209 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
210 p.setAlignmentY(TOP_ALIGNMENT);
211 p.setAlignmentX(LEFT_ALIGNMENT);
212 if(threeD) {
213 p.setBorder(loweredBorder);
|
34 import javax.swing.event.*;
35 import javax.swing.text.*;
36 import javax.swing.border.*;
37 import javax.swing.colorchooser.*;
38 import javax.swing.filechooser.*;
39 import javax.accessibility.*;
40
41 import java.awt.*;
42 import java.awt.event.*;
43 import java.beans.*;
44 import java.util.*;
45 import java.io.*;
46 import java.applet.*;
47 import java.net.*;
48
49 /**
50 * A generic SwingSet2 demo module
51 *
52 * @author Jeff Dinkins
53 */
54 public class DemoModule extends JFrame {
55
56 // The preferred size of the demo
57 private int PREFERRED_WIDTH = 680;
58 private int PREFERRED_HEIGHT = 600;
59
60 Border loweredBorder = new CompoundBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED),
61 new EmptyBorder(5,5,5,5));
62
63 // Premade convenience dimensions, for use wherever you need 'em.
64 public static Dimension HGAP2 = new Dimension(2,1);
65 public static Dimension VGAP2 = new Dimension(1,2);
66
67 public static Dimension HGAP5 = new Dimension(5,1);
68 public static Dimension VGAP5 = new Dimension(1,5);
69
70 public static Dimension HGAP10 = new Dimension(10,1);
71 public static Dimension VGAP10 = new Dimension(1,10);
72
73 public static Dimension HGAP15 = new Dimension(15,1);
74 public static Dimension VGAP15 = new Dimension(1,15);
173 }
174
175 public String getName() {
176 return getString(getResourceName() + ".name");
177 };
178
179 public Icon getIcon() {
180 return createImageIcon(iconPath, getResourceName() + ".name");
181 };
182
183 public String getToolTip() {
184 return getString(getResourceName() + ".tooltip");
185 };
186
187 public void mainImpl() {
188 JFrame frame = new JFrame(getName());
189 frame.getContentPane().setLayout(new BorderLayout());
190 frame.getContentPane().add(getDemoPanel(), BorderLayout.CENTER);
191 getDemoPanel().setPreferredSize(new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT));
192 frame.pack();
193 frame.setVisible(true);
194 }
195
196 public JPanel createHorizontalPanel(boolean threeD) {
197 JPanel p = new JPanel();
198 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
199 p.setAlignmentY(TOP_ALIGNMENT);
200 p.setAlignmentX(LEFT_ALIGNMENT);
201 if(threeD) {
202 p.setBorder(loweredBorder);
203 }
204 return p;
205 }
206
207 public JPanel createVerticalPanel(boolean threeD) {
208 JPanel p = new JPanel();
209 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
210 p.setAlignmentY(TOP_ALIGNMENT);
211 p.setAlignmentX(LEFT_ALIGNMENT);
212 if(threeD) {
213 p.setBorder(loweredBorder);
|