ChangeListener ActionListener ButtonListener MyMuthaListener


#1

i would like to know why there are a lot of these different Listener. why there is the ChangeListener, the ActionListener and also the ButtonListener ! i have a component that have 2 Sliders, 8 Buttons and 4 ComboBoxes… i have to implement 3 callbacks methods ! (actually a button and a slider are so related, speaking of their functionality, but i have their implementation in 2 different functions cause the two components are different type of broadcaster… but imho the components broadcast only their changes) ! is to avoid a single bigger switch, casting from a Component pointer ?


#2

I think ActionListener is for commands like say “open file” that could come from several places but the buttonlistener has somewhat confused this issue. It was added by Jules after popular request. changelistener is for what it says and implies a closer relationship tween caller and listener.


#3

mmmh ok. a bit confusing tho… i’ll have to reorder here a bit…


#4

i disagree in the most ridiculously inflamed way. I think the button listener is a fantastic addition to the framework, and makes code far more legible. a button and a slider are both different beasts, and it is right that they are treated as such; change listeners recieve appropriately thinned callback counts, and button listeners respond to clicks and state changes.

the only negative side i can see from this would come from laziness :wink: :stuck_out_tongue: it makes far more sense to keep your button responses together (all the buttons) and changes to sliders/other control similar controls in a ‘stuff has changed’ callback.

i can’t see any reason for your complaint! :slight_smile:


#5

i’m not complaining. just gets confusing with spaghetti code. :lol:


#6

pah! spaghetti code is the fault of the programmer :wink:

btw in case i sound like a sod, i’m not being mean just messing around


#7