| 1 |
|
package net.wotonomy.test; |
| 2 |
|
|
| 3 |
|
import java.awt.BorderLayout; |
| 4 |
|
import java.awt.Component; |
| 5 |
|
import java.awt.Insets; |
| 6 |
|
import java.util.Vector; |
| 7 |
|
|
| 8 |
|
import javax.swing.JCheckBox; |
| 9 |
|
import javax.swing.JComboBox; |
| 10 |
|
import javax.swing.JPanel; |
| 11 |
|
import javax.swing.JScrollPane; |
| 12 |
|
import javax.swing.JSlider; |
| 13 |
|
import javax.swing.JTable; |
| 14 |
|
import javax.swing.JTextField; |
| 15 |
|
import javax.swing.border.EmptyBorder; |
| 16 |
|
import javax.swing.text.JTextComponent; |
| 17 |
|
|
| 18 |
|
import net.wotonomy.ui.swing.components.BetterFlowLayout; |
| 19 |
|
import net.wotonomy.ui.swing.components.ButtonPanel; |
| 20 |
|
import net.wotonomy.ui.swing.components.InfoPanel; |
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
public class TestPanel extends JPanel |
| 27 |
|
{ |
| 28 |
|
|
| 29 |
|
public JTable table; |
| 30 |
|
public InfoPanel infoPanel; |
| 31 |
|
public ButtonPanel savePanel; |
| 32 |
|
public ButtonPanel buttonPanel; |
| 33 |
|
public JTextComponent firstNameField; |
| 34 |
|
public JTextComponent middleNameField, lastNameField; |
| 35 |
|
public JComboBox dateBox, monthBox, yearBox; |
| 36 |
|
public JSlider slider; |
| 37 |
|
public JCheckBox checkbox; |
| 38 |
|
|
| 39 |
0 |
public TestPanel() |
| 40 |
0 |
{ |
| 41 |
0 |
this.setLayout( new BorderLayout( 10, 10 ) ); |
| 42 |
0 |
this.setBorder( new EmptyBorder( 10, 10, 10, 10 ) ); |
| 43 |
|
|
| 44 |
0 |
JPanel overviewPanel = new JPanel(); |
| 45 |
0 |
overviewPanel.setLayout( new BorderLayout() ); |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
0 |
table = new JTable(); |
| 51 |
0 |
JScrollPane scrollPane = new JScrollPane( table ); |
| 52 |
|
|
| 53 |
0 |
overviewPanel.add( scrollPane, BorderLayout.CENTER ); |
| 54 |
|
|
| 55 |
0 |
this.add( overviewPanel, BorderLayout.CENTER ); |
| 56 |
|
|
| 57 |
0 |
infoPanel = new InfoPanel(); |
| 58 |
0 |
infoPanel.setColumns( 1 ); |
| 59 |
|
|
| 60 |
|
|
| 61 |
0 |
firstNameField = new JTextField(); |
| 62 |
|
|
| 63 |
0 |
middleNameField = new JTextField(); |
| 64 |
|
|
| 65 |
0 |
lastNameField = new JTextField(); |
| 66 |
|
|
| 67 |
0 |
checkbox = new JCheckBox(); |
| 68 |
|
|
| 69 |
0 |
infoPanel.addRow( "Name", new Component[] { |
| 70 |
0 |
firstNameField, middleNameField, lastNameField, checkbox } ); |
| 71 |
|
|
| 72 |
|
|
| 73 |
0 |
Vector datesList = new Vector(); |
| 74 |
0 |
for ( int i = 1; i < 32; i++ ) datesList.add( new Integer( i ) ); |
| 75 |
0 |
dateBox = new JComboBox( datesList ); |
| 76 |
0 |
dateBox.setEditable( true ); |
| 77 |
0 |
monthBox = new JComboBox(); |
| 78 |
0 |
yearBox = new JComboBox(); |
| 79 |
0 |
infoPanel.addRow( "Create Date", |
| 80 |
0 |
dateBox, monthBox, yearBox ); |
| 81 |
|
|
| 82 |
|
|
| 83 |
0 |
infoPanel.addRow( "Day of Month", slider = new JSlider( |
| 84 |
0 |
JSlider.HORIZONTAL, 1, 31, 1 ) ); |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 88 |
0 |
JPanel navigationPanel = new JPanel(); |
| 89 |
0 |
navigationPanel.setLayout( new BorderLayout() ); |
| 90 |
|
|
| 91 |
0 |
buttonPanel = new ButtonPanel( new String[] { "Tree View", "Add", "Remove" } ); |
| 92 |
0 |
buttonPanel.setAlignment( BetterFlowLayout.LEFT ); |
| 93 |
0 |
buttonPanel.setInsets( new Insets( 0, 0, 0, 0 ) ); |
| 94 |
0 |
navigationPanel.add( buttonPanel, BorderLayout.WEST ); |
| 95 |
|
|
| 96 |
0 |
savePanel = new ButtonPanel( new String[] { "Refresh All", "Commit" } ); |
| 97 |
0 |
savePanel.setAlignment( BetterFlowLayout.RIGHT ); |
| 98 |
0 |
navigationPanel.add( savePanel, BorderLayout.EAST ); |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
0 |
JPanel bottomPanel = new JPanel(); |
| 103 |
0 |
bottomPanel.setLayout( new BorderLayout() ); |
| 104 |
0 |
bottomPanel.add( infoPanel, BorderLayout.NORTH ); |
| 105 |
0 |
bottomPanel.add( navigationPanel, BorderLayout.SOUTH ); |
| 106 |
|
|
| 107 |
0 |
this.add( bottomPanel, BorderLayout.SOUTH ); |
| 108 |
0 |
} |
| 109 |
|
|
| 110 |
|
} |