Java Reference
In-Depth Information
{
private JPanel displayPanel, buttonPanel;
private JLabel surnameLabel, fi rstNamesLabel,
markLabel;
private JTextField surnameBox, fi rstNamesBox,
markBox;
private JButton openButton, nextButton;
private Scanner input;
public static void main(String[] args)
{
UseFileChooser frame = new UseFileChooser();
frame.setSize(350,150);
frame.setVisible(true);
}
public UseFileChooser()
{
setTitle("FileChooser Demo");
setLayout(new BorderLayout());
displayPanel = new JPanel();
displayPanel.setLayout(new GridLayout(3,2));
surnameLabel = new JLabel("Surname");
fi rstNamesLabel = new JLabel("First names");
markLabel = new JLabel("Mark");
surnameBox= new JTextField();
fi rstNamesBox = new JTextField();
markBox = new JTextField();
//For this application, user should not be able
//to change any records…
surnameBox.setEditable(false);
fi rstNamesBox.setEditable(false);
markBox.setEditable(false);
displayPanel.add(surnameLabel);
displayPanel.add(surnameBox);
displayPanel.add(fi rstNamesLabel);
displayPanel.add(fi rstNamesBox);
displayPanel.add(markLabel);
displayPanel.add(markBox);
add(displayPanel, BorderLayout.NORTH);
buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());
openButton = new JButton("Open File");
Search WWH ::




Custom Search