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:
@@ -64,11 +64,11 @@ public class ButtonUtil
|
|||||||
* property to cycle through the specified values whenever the button is
|
* property to cycle through the specified values whenever the button is
|
||||||
* pressed.
|
* pressed.
|
||||||
*/
|
*/
|
||||||
public static void cycleToProperty (
|
public static ActionListener cycleToProperty (
|
||||||
final String property, final Config config, AbstractButton button,
|
final String property, final Config config, AbstractButton button,
|
||||||
final int[] values)
|
final int[] values)
|
||||||
{
|
{
|
||||||
button.addActionListener(new ActionListener() {
|
ActionListener al = new ActionListener() {
|
||||||
public void actionPerformed (ActionEvent event)
|
public void actionPerformed (ActionEvent event)
|
||||||
{
|
{
|
||||||
// get the current value and find out where it is in the list
|
// get the current value and find out where it is in the list
|
||||||
@@ -77,7 +77,9 @@ public class ButtonUtil
|
|||||||
% values.length;
|
% values.length;
|
||||||
config.setValue(property, values[newidx]);
|
config.setValue(property, values[newidx]);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
button.addActionListener(al);
|
||||||
|
return al;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used for {@link #bindToProperty}. */
|
/** Used for {@link #bindToProperty}. */
|
||||||
|
|||||||
Reference in New Issue
Block a user