I'm trying to get information entered in a gui to be available from the parent class used to show the gui.
I've made up a bare bones example. I have one parent class and one child gui class. The gui has one textbox and one button.
I want the line System.out.println(gc.getTextValue()); to be executed in SomeClass when the button on the gui is pressed. package test; public class SomeClass{
public static void main(String[] args) { GuiClass1 gc = new GuiClass1(); gc.setVisible(true); System.out.println(gc.getTextValue()); } }
Here's the code for the gui package test; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JButton;