Page 767 - Introduction to Programming with Java: A Problem Solving Approach
P. 767

                17.15 Job Application Example 733
 }
// end class JobApplication
//**************************************************************
// Read entered values and display an appropriate message.
private class ButtonListener implements ActionListener
{
{
public void actionPerformed(ActionEvent e)
if (
(java.isSelected() || helpDesk.isSelected()
|| coffee.isSelected()) &&
(goodCitizen.isSelected()) &&
(!salary.getSelectedItem().equals("above $100,000")))
JOptionPane.showMessageDialog(null,
"Thank you for your application submission.\n" +
"We'll contact you after we process your information.");
}
// end actionPerformed
     Apago PDF Enhancer
{
}
else
{
}
JOptionPane.showMessageDialog(null,
"Sorry, no jobs at this time.");
} // end class ButtonListener
//**************************************************************
public static void main(String[] args)
{
}
new JobApplication();
Figure 17.17c JobApplication program—part C
which is what you want. In calling the EmptyBorder constructor, you’ll need to pass in pixel values for the widths of the border’s top, left, bottom, and right sides. For example, this constructor call passes in 10-pixel values for all four of the border’s sides:
windowPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
Be aware that the EmptyBorder class is in the javax.swing.border package. So import that pack- age if you want to create an empty border.
You might think that the setBorder method works for all containers. Not so. It works for the JPanel
 container, but not the JFrame container. Therefore, you need to add a JPanel container to theJobApplication JFramewindowandcallsetBorderfromtheJPanel container.
Use a panel.
   What type of layout manager is appropriate for the new JPanel container? If you use a GridLayout manager, that works OK, but not great. With a GridLayout, all rows are the same height. In Figure 17.16,


























































   765   766   767   768   769