Beginning of the constructor

The constructor for the class named Prob12Runner begins in Listing 5.

The code in Listing 5 performs the physical construction of the GUI control panel at the bottom of Figure 1.

The position of the GUI control panel

Listing 5. Beginning of the constructor.
    controlPanel.setLayout(new GridLayout(2,1));
    controlPanel.add(colorPanel);
    controlPanel.add(buttonPanel);

    colorPanel.setBackground(Color.RED);
    colorPanel.add(new JLabel(
                         "Red pixel Color at Cursor: "));
    colorPanel.add(redField);

    buttonPanel.setBackground(Color.BLUE);
    buttonPanel.add(getDataButton);

    getContentPane().add(controlPanel);
    setTitle("Dick Baldwin");

    setVisible(true);
File: aq.htm [Next] [Prev]