| 1 |
|
package net.wotonomy.test; |
| 2 |
|
|
| 3 |
|
import java.awt.BorderLayout; |
| 4 |
|
import java.awt.FlowLayout; |
| 5 |
|
|
| 6 |
|
import javax.swing.JList; |
| 7 |
|
import javax.swing.JPanel; |
| 8 |
|
import javax.swing.JScrollPane; |
| 9 |
|
import javax.swing.JTextField; |
| 10 |
|
import javax.swing.border.EmptyBorder; |
| 11 |
|
import javax.swing.text.JTextComponent; |
| 12 |
|
|
| 13 |
|
import net.wotonomy.ui.swing.components.ButtonPanel; |
| 14 |
|
import net.wotonomy.ui.swing.components.InfoPanel; |
| 15 |
|
import net.wotonomy.ui.swing.components.RadioButtonPanel; |
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
public class EditPanel extends JPanel |
| 21 |
|
{ |
| 22 |
|
public JTextComponent firstNameField; |
| 23 |
|
public JTextField middleNameField, lastNameField; |
| 24 |
|
public RadioButtonPanel yearRadioPanel; |
| 25 |
|
public InfoPanel infoPanel; |
| 26 |
|
public JList list; |
| 27 |
|
public ButtonPanel addPanel; |
| 28 |
|
|
| 29 |
|
|
| 30 |
0 |
public EditPanel() |
| 31 |
0 |
{ |
| 32 |
0 |
this.setLayout( new BorderLayout() ); |
| 33 |
0 |
this.setBorder( new EmptyBorder( 10, 10, 10, 10 ) ); |
| 34 |
|
|
| 35 |
0 |
infoPanel = new InfoPanel(); |
| 36 |
|
|
| 37 |
|
|
| 38 |
0 |
firstNameField = new JTextField(); |
| 39 |
0 |
infoPanel.addPair( "First Name", firstNameField ); |
| 40 |
0 |
middleNameField = new JTextField(); |
| 41 |
0 |
infoPanel.addPair( "Middle Name", middleNameField ); |
| 42 |
0 |
lastNameField = new JTextField(); |
| 43 |
0 |
infoPanel.addPair( "Last Name", lastNameField ); |
| 44 |
0 |
yearRadioPanel = new RadioButtonPanel(); |
| 45 |
0 |
infoPanel.addPair( "Year", yearRadioPanel ); |
| 46 |
|
|
| 47 |
0 |
list = new JList(); |
| 48 |
0 |
JPanel containerPanel = new JPanel(); |
| 49 |
0 |
containerPanel.setLayout( new BorderLayout( 0, 5 ) ); |
| 50 |
0 |
JScrollPane scrollPane = new JScrollPane( list ); |
| 51 |
0 |
scrollPane.setPreferredSize( new java.awt.Dimension( 100, 100 ) ); |
| 52 |
0 |
addPanel = new ButtonPanel( new String[] { "Add", "Remove" } ); |
| 53 |
0 |
addPanel.setAlignment( FlowLayout.CENTER ); |
| 54 |
0 |
containerPanel.add( scrollPane, BorderLayout.CENTER ); |
| 55 |
0 |
containerPanel.add( addPanel, BorderLayout.SOUTH ); |
| 56 |
0 |
infoPanel.addRow( "Children", containerPanel ); |
| 57 |
|
|
| 58 |
0 |
this.add( infoPanel, BorderLayout.CENTER ); |
| 59 |
0 |
} |
| 60 |
|
|
| 61 |
|
} |