Search code examples
javajframejlabeljtextfield

Java GUI - Display JTextField Value


Link to code pastiebin

I have a JTextField on my first GUI window. Later in the program I open another GUI and go to display the value of the JTextField but in the program I get an error of invalid layout. I'm not sure what I need to change to get it to display the correct value.

Picture for reference

enter image description here


Solution

  • JLabel supfirst = new JLabel("Supervisors First Name :" + firstvalue.getText());
    

    .getText() is probably what you're missing.

    This is what displays the content from the input field.

    enter image description here