Return the action listener added in case the caller later wants to remove it.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1513 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2004-10-22 23:52:54 +00:00
parent 33d50bd4e5
commit 2e7b253b90
@@ -64,11 +64,11 @@ public class ButtonUtil
* property to cycle through the specified values whenever the button is
* pressed.
*/
public static void cycleToProperty (
public static ActionListener cycleToProperty (
final String property, final Config config, AbstractButton button,
final int[] values)
{
button.addActionListener(new ActionListener() {
ActionListener al = new ActionListener() {
public void actionPerformed (ActionEvent event)
{
// get the current value and find out where it is in the list
@@ -77,7 +77,9 @@ public class ButtonUtil
% values.length;
config.setValue(property, values[newidx]);
}
});
};
button.addActionListener(al);
return al;
}
/** Used for {@link #bindToProperty}. */