options,
options[0]);
setContentPane(optionPane);
- setDefaultCloseOperation(EXIT_ON_CLOSE);
-/*
- textField.addActionListener(new ActionListener() {
+ setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+
+ ActionListener intValidator = new ActionListener() {
public void actionPerformed(ActionEvent e) {
- optionPane.setValue(btnString1);
+ if (e.getSource() instanceof JTextField){
+ JTextField s = (JTextField)e.getSource();
+ int num = Integer.parseInt(s.getText());
+ if (num < 0)
+ num = 0;
+ else if (num > 127 && s != length)
+ num = 127;
+ s.setText(new Integer(num).toString());
+ }
}
- });
-*/
+ };
+ pitch.addActionListener(intValidator);
+ velocity.addActionListener(intValidator);
+ length.addActionListener(intValidator);
+
optionPane.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();