JTextField player1Text = new JTextField();
player1Text.setSize(400, 400);
inputWindow.add(player1Text);
System.out.println(player1Text.getText());
This will print zero, even though I enter some text in the textbox that appears in the window. However,
JTextField player1Text = new JTextField("input");
player1Text.setSize(400, 400);
inputWindow.add(player1Text);
System.out.println(player1Text.getText());
This will print 5 because thats the length of "input". What can I do to get the actual input text?
Aucun commentaire:
Enregistrer un commentaire