Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>Use <code>ButtonGroup</code> with the <code>JRadioButton</code> of your context. </li> <li>Use <code>jRadioButton.setActionCommand(String)</code> to set their corresponding action name: for your context <code>"SW Version"</code> and anything such.</li> <li>Make use of an <code>ArrayList</code> to add the item of your context. Try mapping each such array list using a <code>HashMap&lt;Key, Val&gt; i.e., HashMap&lt;String, ArrayList&lt;Equipment&gt;&gt;</code> where the <code>"SW Version"</code> or anything such name will be the key</li> <li>Try adding listeners to each action button in-line using the means of anonymous class.</li> </ul> <p>So a sample coding for add action would become depicting the usage(<em>usefulness</em>) of <code>ButtonGroup</code>:</p> <pre><code>addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String actionCommand = buttonGroup1.getSelection() .getActionCommand(); // actionCommand = "SW Version" map.get(actionCmmand).add(equipment); } }); </code></pre> <p><strong>Tutorial and reference:</strong></p> <ol> <li><a href="http://docs.oracle.com/javase/tutorial/uiswing/components/button.html#radiobutton" rel="nofollow">How to use Radio Button</a>, check the demo for <code>ButtonGroup</code></li> <li><a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/ButtonGroup.html" rel="nofollow">ButtonGroup class</a></li> <li><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" rel="nofollow">HashMap</a></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload