Note that there are some explanatory texts on larger screens.

plurals
  1. POIf-else condition within a JButton ActionEvent
    primarykey
    data
    text
    <p>I've just uploaded my progress into the program. Please have a look and see what is lacking in it. Also, please ignore the lame joke from the strings in it while you're at it. It can be downloaded from this link: <a href="http://www.mediafire.com/?n0sp8v22egfsx7t" rel="nofollow">http://www.mediafire.com/?n0sp8v22egfsx7t</a></p> <p>Note that I used NetBeans to easily make the program.</p> <p>Edited:</p> <p>How do I stop the ActionEvent method of a JButton from re-iterating the reading of the first layer of the nested if-else condition once the innermost line or last line of codes is read?</p> <p>Also, as an additional question, how do I prompt the system to choose between choices thus literally branch out from the other once a choice is given? Apparently what I'm doing was just connect these block of strings together and not branch them out thus appear iterated once a new block of codes is to be displayed in connection to the previous block of code displayed. . </p> <p>Snippet:</p> <pre><code>// Strings of text displayed on the JTextArea is shown here // prompting to choose between two options: example, left or right jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1actionPerformed(e); } }); private void jButton1actionPerformed(ActionEvent e) { if(jRadioButton1.isSelected()) { // Display strings of text as response to the choice left // Another options to choose from here:, example, up or down JTextArea.setText("You've chosen: " ); JTextArea.append("Now choose between: "); if (jRadioButton1.isSelected()) { JTextArea.append("From first choice, choose between: "); // stop from here } else if (jRadioButton2.isSelected()) { //same as above } } if (jRadioButton2.isSelected()) { // Same as above } } </code></pre>
    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.
 

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