I am basically trying to pass user input from a jtextfield (as an integer number) using a jbutton to my gameInit() function and it does NOT work.
Under the gameInit() function, it thinks that the variable 'input' is zero. I think its because it just executes the entire gameInit function and doesn't wait for the user input to happen.
Here is my code:
http://tinypaste.com/f0550d
I put the System.out.println functions in to see if the variables are passing into the methods and its not under gameInit().
please help guys, it's been like 5 hours and I've been stuck for quite some time.
Here are my variable declarations:
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JFrame jFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JPanel mainPanel;
private javax.swing.JMenuBar menuBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
// End of variables declaration
private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;
private boardManager game;
private cardManager card;
private JDialog notify;
private int input;
The issue is not exactly the while loop (even though the while loop is wrong, I changed it to IF) but the issue is, is that the variable 'input' is not being passed into gameInit(), its saying its 0. I think its because gameInit is instanciated first under the public class method so the int 'input' is not declared with a value yet...
How can I call my 'public void actionPerformed(ActionEvent e)' in gameInit function and WAIT for user input to complete and then get that integer value and compare it.
Under the gameInit() function, it thinks that the variable 'input' is zero. I think its because it just executes the entire gameInit function and doesn't wait for the user input to happen.
Here is my code:
http://tinypaste.com/f0550d
I put the System.out.println functions in to see if the variables are passing into the methods and its not under gameInit().
please help guys, it's been like 5 hours and I've been stuck for quite some time.
Here are my variable declarations:
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JFrame jFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JPanel mainPanel;
private javax.swing.JMenuBar menuBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
// End of variables declaration
private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;
private boardManager game;
private cardManager card;
private JDialog notify;
private int input;
The issue is not exactly the while loop (even though the while loop is wrong, I changed it to IF) but the issue is, is that the variable 'input' is not being passed into gameInit(), its saying its 0. I think its because gameInit is instanciated first under the public class method so the int 'input' is not declared with a value yet...
How can I call my 'public void actionPerformed(ActionEvent e)' in gameInit function and WAIT for user input to complete and then get that integer value and compare it.