X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=MooNoteProp.java;h=e1826e304bf59d86f2170c3be9199c1536e4d21b;hb=357944d9255bb7cb1ad5ed4f5c960b22a8c64b8f;hp=cc3c192855c5a7a7aa42e3039c6bc6900bbeb1b7;hpb=f47cf964559cb57a0affcb1ef1ec9ecec18a4386;p=moosique.git diff --git a/MooNoteProp.java b/MooNoteProp.java index cc3c192..e1826e3 100644 --- a/MooNoteProp.java +++ b/MooNoteProp.java @@ -59,14 +59,25 @@ public class MooNoteProp extends JDialog{ 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();