Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure what array you want to fill but get the text with <code>getText()</code></p> <pre><code>if(buttonPressed.equals(addButton) &amp;&amp; rButton1.isSelected()) { String s1 = iJTextField.getText(); String s2 = nJTextField.getText(); String s3 = swTextField.getText(); String s4 = hwTextField.getText(); // something with these strings } </code></pre> <p>If any of the inputs are numbers and you want the numerical value, you need to parse.</p> <p>Also, these need to be declared as class memebers. You have them declared in the constructor</p> <pre><code>JRadioButton rButton1 = new JRadioButton("SW Version",false); JRadioButton rButton2 = new JRadioButton("HW Type",false); JRadioButton rButton3 = new JRadioButton("General",true); </code></pre> <p>Declared in the constructor, they are not within the scope of the listener class</p> <pre><code>public class MyFrameMain extends JFrame{ private final JLabel iLabel; private final JLabel nLabel; private final JTextField iJTextField; private final JTextField nJTextField; private final JTextField swTextField; private final JTextField hwTextField; private final JLabel jItemCounter; private final JTextArea reSoulte; private final JButton addButton; private final JButton showButton; private final JButton copyButton; private final JButton exitButton; JRadioButton rButton1 = new JRadioButton("SW Version",false); JRadioButton rButton2 = new JRadioButton("HW Type",false); JRadioButton rButton3 = new JRadioButton("General",true); public MyFrameMain(String title){ </code></pre> <p>Also, doesn't really look like you need a listener for the radio button, since an event is not necessary. The JButton listens for an event, and in the actionPerformed, it checks if the radio button is selected. Therefore no need for the radio button to listen for any event, the JButton does that.</p>
    singulars
    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.
 

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