import javax.swing.*; import java.awt.event.*; public class CommandAdjust implements ActionListener { private String command; private JTextField f; private DHJoint j; public CommandAdjust(String command, JTextField f, DHJoint j) { this.command = command; this.f = f; this.j = j; } public void actionPerformed(ActionEvent e) { String text = this.f.getText(); double adj = Double.parseDouble(text); if (this.command.equals("+")) { adj += .10; } else if (this.command.equals("++")) { adj += 1.0; } else if (this.command.equals("--")) { adj -= 1.0; } else if (this.command.equals("-")) { adj -= .10; } adj = this.j.constrain(adj); this.j.adjust(adj); this.f.setText(String.valueOf(adj)); } }