The constructor begins in Listing 3.
The last two statements in Listing 3 may be new to you.
The JPanel referred to by colorIndicatorPanel is the color swatch shown in Figure 3.
The last two statements in Listing 3 control
Listing 3. Beginning of constructor for Prob13Runner |
---|
public Prob13Runner(){//constructor setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE); controlPanel.setLayout(new GridLayout(2,1)); controlPanel.add(colorPanel); controlPanel.add(buttonPanel); colorPanel.setBackground(Color.GREEN); colorPanel.add(new JLabel("Red = ")); colorPanel.add(redField); colorPanel.add(new JLabel(" Green = ")); colorPanel.add(greenField); colorPanel.add(new JLabel(" Blue = ")); colorPanel.add(blueField); colorPanel.add(colorIndicatorPanel); colorIndicatorPanel.setBorder( new LineBorder(Color.black,1)); colorIndicatorPanel.setPreferredSize( new Dimension(20,20)); |
File: ap.htm | [Next] | [Prev] |