I have two classes. One creates the GUI in JApplet
, and the other class takes user input from the applet and does calculations with it.
The applet class creates GUI and tells the calculation class to start. Then the calculation class calls on a method from the applet class to ask for user input. This method then listens for action from a JTextField
to return to the calculation class.
But the problem is that when you run the program, it doesn't actually wait for the user to enter something in the text field. As a result the calculation class receives a null input.
How can I fix this?
I've tried using a JOptionPane.showInputDialog
instead of an ActionListener
in the method, and this works. But I don't want to use this; mainly since it's like a pop-up and I want the user to input data directly in the applet.