Java Reference
In-Depth Information
47
private
JPanel queryPanel;
48
private
JPanel navigatePanel;
49
private
JPanel displayPanel;
50
private
JTextField queryTextField;
51
private
JButton insertButton;
52
53
// constructor
54
public
AddressBookDisplay()
55
{
56
super
("Address Book");
57
58
// establish database connection and set up PreparedStatements
personQueries =
new
PersonQueries();
59
60
61
// create GUI
62
navigatePanel =
new
JPanel();
63
previousButton =
new
JButton();
64
indexTextField =
new
JTextField(
2
);
65
ofLabel =
new
JLabel();
66
maxTextField =
new
JTextField(
2
);
67
nextButton =
new
JButton();
68
displayPanel =
new
JPanel();
69
idLabel =
new
JLabel();
70
idTextField =
new
JTextField(
10
);
71
firstNameLabel =
new
JLabel();
72
firstNameTextField =
new
JTextField(
10
);
73
lastNameLabel =
new
JLabel();
74
lastNameTextField =
new
JTextField(
10
);
75
emailLabel =
new
JLabel();
76
emailTextField =
new
JTextField(
10
);
77
phoneLabel =
new
JLabel();
78
phoneTextField =
new
JTextField(
10
);
79
queryPanel =
new
JPanel();
80
queryLabel =
new
JLabel();
81
queryTextField =
new
JTextField(
10
);
82
queryButton =
new
JButton();
83
browseButton =
new
JButton();
84
insertButton =
new
JButton();
85
86
setLayout(
new
FlowLayout(
FlowLayout.CENTER
,
10
,
10
));
87
setSize(
400
,
300
);
88
setResizable(
false
);
89
90
navigatePanel.setLayout(
91
new
BoxLayout(navigatePanel,
BoxLayout.X_AXIS
));
92
93
previousButton.setText(
"Previous"
);
94
previousButton.setEnabled(
false
);
95
previousButton.addActionListener(
96
new
ActionListener()
97
{
98
public void
actionPerformed(ActionEvent evt)
99
{
Fig. 24.32
|
A simple address book. (Part 2 of 8.)