Having defined the interface in Segment 910, you can begin to
implement the RatingPanel
class, by declaring the instance variables whose
assignments will be instances of the int
, JTextField
, and
JButton
classes:
import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class RatingPanel extends JPanel implements RatingPanelInterface { private int value1, value2, value3; private JTextField field1, field2, field3; private JButton button1Plus, button2Plus, button3Plus; private JButton button1Minus, button2Minus, button3Minus; // Constructor defined here // Setters and getters defined here // Local listener defined here } public Dimension getMinimumSize() {return new Dimension(300, 75);} public Dimension getPreferredSize() {return new Dimension(300, 75);} }