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

                {
}
// end class ComboBoxExample
private JComboBox daysBox;
private JComboBox monthsBox;
private String[] days =
{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
private String[] months =
{"January", "February", "March", "April", "May", "June",
      Apago PDF Enhancer
"December"};
public ComboBoxExample()
{
"July", "August", "September", "October", "November",
setTitle("Combo Box Example");
setSize(400, 100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
createContents();
setVisible(true);
// end ComboBoxExample constructor
<The createContents method goes here.>
public static void main(String[] args)
}
{
}
new ComboBoxExample();
Review Question Solutions
1. True.
2. Layout managers are in the java.awt package.
3. The FlowLayout manager places components left-to-right in a row until it runs out of space, and then it goes to the next row and does the same thing, and so on.
Review Question Solutions 743
 Your createContents method must work in conjunction with this program skeleton: import javax.swing.*;
import java.awt.*;
public class ComboBoxExample extends JFrame
 
































































   775   776   777   778   779