Friday, 15 March 2013

java - How to set the properties for JRadioButtons and apply to them all? -


Hi, I have more than 10 JRDO buttons and there are some properties that are common in all, so instead of writing, these properties are once used on every radio button, once what is the method of setting everyone at once?

I want to set all the radio buttons for:

  radiButtonName.setOpaque (wrong); RadiButtonName.setContentAreaFilled (wrong); RadiButtonName.setBorderPainted (wrong); RadiButtonName.setBorder (zero);  

I tried to use the UINNager but it is doing strange work and it does not support all of my properties.

I would like to avoid creating additional squares and expand the radio button because I would like to apply this technique to other techniques to reduce code written, this will reduce the code very much in advance Thank you :)

If you want to do the same thing an N number of time a method Try writing that will move for you :)

Then problem 10 to install JRadioButton Land? You can create a list of JRDO buttons (or annare archive / maps / ...) return method like the following method:

  Private list & lt; JRDObutton & gt; Make list for SetUpButtons () {// (int i = 0; i & lt; NB_BUTTONS; i ++) {// wanted to set properties} myList return; }  

Note that NB_BUTTONS is a variable that:

  private finals NIB_BUTTONS = 10;  

It's easy to modify the value once it's modified in all its code. With the same logic you can write a way to prepare a JRDO button. It depends on how you want to do things you want to do.


No comments:

Post a Comment