Hi Thank you for reading my post. sorry if my post title is not good enough , i am not english. In one of my frames i need to have some buttons , for example there are 4 buttons like : stop , start, next , prev . I wan to be able to do the following , but i do not know whether there are standard component for this kind of common requirement in swing or not.
when user press Start , all buttons should become disable and start should stay down. start will be down until user press stop (stop is like ordinary Jbutton and do not stay down) after user press stop , start button will come up and all other buttons will become enable.
if you want to inactive or active a button call the following after pressing a button
public void buttonsAfterPressingStartButton(){ northButton.setEnabled(true); // or false eastButton.setEnabled(true); southButton.setEnabled(true); westButton.setEnabled(true);
this method should be called via an actionListner on your startButton.
Hi So there is no feature in the swing component like : component index, ... that determine some butons are in same group and if one of them goes down all other in the group come up ?
There might be, you could experiment with putting buttons in
// public class ButtonGroup extends Object implements Serializable
This class is used to create a multiple-exclusion scope for a set of buttons. Creating a set of buttons with the same ButtonGroup object means that turning "on" one of those buttons turns off all other buttons in the group. //
but I think you could do all you wanted by a series of methods called at the appropriate time, for example in my own implementation
public void buttonsAfterSecondCrop(){ northButton.setEnabled(true); eastButton.setEnabled(true); eastButton10.setEnabled(true); southButton.setEnabled(true); westButton.setEnabled(true); westButton10.setEnabled(true); OKButton.setEnabled(true); if(isTwoSplit){ copyButton.setEnabled(false); } //leave blank for now else if(isThreeSplit){ //prevents copybutton being pressed until OKbutton pressed //this is so the user can align his second Roi copyButton.setEnabled(false); } }