From 2e7b253b902b1bb4af02c70d2aa73eb0eac84548 Mon Sep 17 00:00:00 2001 From: mdb Date: Fri, 22 Oct 2004 23:52:54 +0000 Subject: [PATCH] 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 --- .../src/java/com/samskivert/swing/util/ButtonUtil.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/swing/util/ButtonUtil.java b/projects/samskivert/src/java/com/samskivert/swing/util/ButtonUtil.java index 0c846bde..ca475c26 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/util/ButtonUtil.java +++ b/projects/samskivert/src/java/com/samskivert/swing/util/ButtonUtil.java @@ -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}. */