diff options
Diffstat (limited to 'projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestPanel.java')
| -rw-r--r-- | projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestPanel.java | 119 |
1 files changed, 57 insertions, 62 deletions
diff --git a/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestPanel.java b/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestPanel.java index 7e868d0..78eedb6 100644 --- a/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestPanel.java +++ b/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestPanel.java @@ -20,14 +20,12 @@ import net.wotonomy.ui.swing.components.ButtonPanel; import net.wotonomy.ui.swing.components.InfoPanel; /** -* A master-detail panel with a list, some -* textfields and some buttons. -*/ -public class TestPanel extends JPanel -{ + * A master-detail panel with a list, some textfields and some buttons. + */ +public class TestPanel extends JPanel { // public JList list; public JTable table; - public InfoPanel infoPanel; + public InfoPanel infoPanel; public ButtonPanel savePanel; public ButtonPanel buttonPanel; public JTextComponent firstNameField; @@ -35,76 +33,73 @@ public class TestPanel extends JPanel public JComboBox dateBox, monthBox, yearBox; public JSlider slider; public JCheckBox checkbox; - - public TestPanel() - { - this.setLayout( new BorderLayout( 10, 10 ) ); - this.setBorder( new EmptyBorder( 10, 10, 10, 10 ) ); - - JPanel overviewPanel = new JPanel(); - overviewPanel.setLayout( new BorderLayout() ); - - //list = new JList(); - //JScrollPane scrollPane = new JScrollPane( list ); + + public TestPanel() { + this.setLayout(new BorderLayout(10, 10)); + this.setBorder(new EmptyBorder(10, 10, 10, 10)); + + JPanel overviewPanel = new JPanel(); + overviewPanel.setLayout(new BorderLayout()); + + // list = new JList(); + // JScrollPane scrollPane = new JScrollPane( list ); table = new JTable(); - JScrollPane scrollPane = new JScrollPane( table ); - - overviewPanel.add( scrollPane, BorderLayout.CENTER ); - - this.add( overviewPanel, BorderLayout.CENTER ); - - infoPanel = new InfoPanel(); - infoPanel.setColumns( 1 ); + JScrollPane scrollPane = new JScrollPane(table); + + overviewPanel.add(scrollPane, BorderLayout.CENTER); + + this.add(overviewPanel, BorderLayout.CENTER); + + infoPanel = new InfoPanel(); + infoPanel.setColumns(1); // name fields - firstNameField = new JTextField(); + firstNameField = new JTextField(); // infoPanel.addPair( "First Name", firstNameField ); middleNameField = new JTextField(); // infoPanel.addPair( "Middle Name", middleNameField ); lastNameField = new JTextField(); // infoPanel.addPair( "Last Name", lastNameField ); - checkbox = new JCheckBox(); + checkbox = new JCheckBox(); + + infoPanel.addRow("Name", new Component[] { firstNameField, middleNameField, lastNameField, checkbox }); - infoPanel.addRow( "Name", new Component[] { - firstNameField, middleNameField, lastNameField, checkbox } ); - // date comboboxen Vector datesList = new Vector(); - for ( int i = 1; i < 32; i++ ) datesList.add( new Integer( i ) ); - dateBox = new JComboBox( datesList ); - dateBox.setEditable( true ); + for (int i = 1; i < 32; i++) + datesList.add(new Integer(i)); + dateBox = new JComboBox(datesList); + dateBox.setEditable(true); monthBox = new JComboBox(); yearBox = new JComboBox(); - infoPanel.addRow( "Create Date", - dateBox, monthBox, yearBox ); - + infoPanel.addRow("Create Date", dateBox, monthBox, yearBox); + // year slider - infoPanel.addRow( "Day of Month", slider = new JSlider( - JSlider.HORIZONTAL, 1, 31, 1 ) ); - + infoPanel.addRow("Day of Month", slider = new JSlider(JSlider.HORIZONTAL, 1, 31, 1)); + // navigation buttons - - JPanel navigationPanel = new JPanel(); - navigationPanel.setLayout( new BorderLayout() ); - - buttonPanel = new ButtonPanel( new String[] { "Tree View", "Add", "Remove" } ); - buttonPanel.setAlignment( BetterFlowLayout.LEFT ); - buttonPanel.setInsets( new Insets( 0, 0, 0, 0 ) ); - navigationPanel.add( buttonPanel, BorderLayout.WEST ); - - savePanel = new ButtonPanel( new String[] { "Refresh All", "Commit" } ); - savePanel.setAlignment( BetterFlowLayout.RIGHT ); - navigationPanel.add( savePanel, BorderLayout.EAST ); - - // bottom panel layout - - JPanel bottomPanel = new JPanel(); - bottomPanel.setLayout( new BorderLayout() ); - bottomPanel.add( infoPanel, BorderLayout.NORTH ); - bottomPanel.add( navigationPanel, BorderLayout.SOUTH ); - - this.add( bottomPanel, BorderLayout.SOUTH ); - } - + + JPanel navigationPanel = new JPanel(); + navigationPanel.setLayout(new BorderLayout()); + + buttonPanel = new ButtonPanel(new String[] { "Tree View", "Add", "Remove" }); + buttonPanel.setAlignment(BetterFlowLayout.LEFT); + buttonPanel.setInsets(new Insets(0, 0, 0, 0)); + navigationPanel.add(buttonPanel, BorderLayout.WEST); + + savePanel = new ButtonPanel(new String[] { "Refresh All", "Commit" }); + savePanel.setAlignment(BetterFlowLayout.RIGHT); + navigationPanel.add(savePanel, BorderLayout.EAST); + + // bottom panel layout + + JPanel bottomPanel = new JPanel(); + bottomPanel.setLayout(new BorderLayout()); + bottomPanel.add(infoPanel, BorderLayout.NORTH); + bottomPanel.add(navigationPanel, BorderLayout.SOUTH); + + this.add(bottomPanel, BorderLayout.SOUTH); + } + } |
