01: package test;
02:
03: import java.awt.FlowLayout;
04:
05: import javax.swing.*;
06:
07: import org.jvnet.substance.SubstanceLookAndFeel;
08:
09: import test.check.SubstanceLafChanger;
10:
11: public class ComponentAlignment extends JFrame {
12: public ComponentAlignment() {
13: super ("Component alignment");
14: this .setLayout(new FlowLayout());
15: this .add(new JTextField("text field", 8));
16: this .add(new JComboBox(new Object[] { "combo box" }));
17: this .add(new JFormattedTextField("formatted field"));
18: this .add(new JPasswordField("password"));
19: this .add(new JSpinner(new SpinnerDateModel()));
20:
21: JMenu lafMenu = new JMenu("Look & feel");
22: lafMenu.add(SubstanceLafChanger.getMenuItem(this , "Substance",
23: "org.jvnet.substance.SubstanceLookAndFeel"));
24: lafMenu.add(SubstanceLafChanger.getMenuItem(this , "Metal",
25: "javax.swing.plaf.metal.MetalLookAndFeel"));
26: lafMenu.add(SubstanceLafChanger.getMenuItem(this , "Windows",
27: "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"));
28: lafMenu
29: .add(SubstanceLafChanger
30: .getMenuItem(this , "Windows Classic",
31: "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"));
32: lafMenu.add(SubstanceLafChanger.getMenuItem(this , "Motif",
33: "com.sun.java.swing.plaf.motif.MotifLookAndFeel"));
34: JMenuBar jmb = new JMenuBar();
35: jmb.add(lafMenu);
36: this .setJMenuBar(jmb);
37:
38: this .setSize(450, 120);
39: this .setLocationRelativeTo(null);
40: this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
41: }
42:
43: public static void main(String[] args) {
44: // JFrame.setDefaultLookAndFeelDecorated(true);
45: SwingUtilities.invokeLater(new Runnable() {
46: public void run() {
47: // try {
48: // UIManager.setLookAndFeel(new SubstanceLookAndFeel());
49: // } catch (Exception exc) {
50: // }
51: new ComponentAlignment().setVisible(true);
52: }
53: });
54: }
55: }
|