The modification of the setters finishes the evolution of the form class, producing the following complete definition:
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; RatingPanel (String x, String y, String z) { setLayout(new GridLayout (3, 4, 3, 3)); value1 = 0; value2 = 0; value3 = 0; field1 = new JTextField("0", 20); button1Plus = new JButton("+"); button1Minus = new JButton("-"); // Ditto for other text fields and buttons add(new JLabel (x)); add(field1); add(button1Minus); add(button1Plus); // Ditto for other labels, text fields, and buttons LocalActionListener listener = new LocalActionListener(); field1.addActionListener(listener); button1Plus.addActionListener(listener); button1Minus.addActionListener(listener); // Ditto for other text fields and buttons } public void setValue1(int v) { int oldValue = value1; value1 = v; field1.setText(String.valueOf(value1)); firePropertyChange("value1", oldValue, value1); } // Ditto for other setters public int getValue1() {return value1;} // Ditto for other getters class LocalActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (e.getSource() == field1) { setValue1(Integer.parseInt(field1.getText())); } else if (e.getSource() == button1Plus) { setValue1(value1 + 1); } else if (e.getSource() == button1Minus) { setValue1(value1 - 1); } // Ditto for other text fields and buttons } } public Dimension getMinimumSize() {return new Dimension(300, 75);} public Dimension getPreferredSize() {return new Dimension(300, 75);} }