I have been using java for some time, and can code back end stuff with ease. GUI's on the other hand I Find hard to deal with.
So anyway, I'm making a game (text based), and would like to implement a console type GUI. I have already made a jframe that has a jtextfield and jtextarea. I can update the text area easily and have an action listener on the jtextfield so that I can pass through the text that I type.
The issue I am having is with the 'player' class not waiting for the input when I attempt to give the player a name. I currently have the program set up so that the main class creates the GUI, and then creates the player object. I have the scanner object inside the player set to get the text from the jtextfield on the GUI. When I do the assignment statement:
name=input.next();
The program automatically assigns what is in the jtextfield, nothing, and makes the name null. I want to make it act like if I were getting input through System.in, and make it wait till I have input in the jtextfield.
Any suggestions?