Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
494
Chapter 18 JDBC and Database Connection Pooling
Listing 18.14 QueryViewer.java (continued)
passwordField = new JPasswordField(10);
panel.add(new JLabel("Username: "));
panel.add(usernameField);
panel.add(new JLabel(" Password:"));
panel.add(passwordField);
return(panel);
}
// The panel that has textfield for entering queries.
// Placed in control panel.
private JPanel makeQueryPanel() {
JPanel panel = new JPanel();
queryField = new JTextField(40);
queryField.addActionListener(this);
panel.add(new JLabel("Query:"));
panel.add(queryField);
return(panel);
}
// The panel that has the "Show Results" button.
// Placed in control panel.
private JPanel makeButtonPanel() {
JPanel panel = new JPanel();
showResultsButton = new JButton("Show Results");
showResultsButton.addActionListener(this);
panel.add(showResultsButton);
return(panel);
}
// Shows warning when bad query sent.
private JLabel makeErrorLabel() {
JLabel label = new JLabel("No Results", JLabel.CENTER);
label.setFont(new Font("Serif", Font.BOLD, 36));
return(label);
}
}
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved