This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Given an ApplicationWindow that has two Components, X and Y:
I want to attach a listener to button_X that reacts to mouse clicks. I want to change the label of BOTH buttons, button_X and button_Y when button_X is clicked. To change the laben of button_X in reaction to the mouse click, it is clear that I need to do something like this:
button_X.addListener(SWT.MouseDown, new SimpleListener("Display mouse down Listener"));
addListener (int eventType, Listener handler)
But how can I modify properties on button_Y at the same time? I could work with static methods to get a reference to the button, but is this really the way people do this? I suppose there is a more elegant and API conforming solution.