- You’re mixing a GUI- with a Console-Application. Is this really what you want?
nullingthe Layout of your
JFrame. Why do you do this? You basically always need layouting. Have a look at this guide.
JLabel is indeed showing. Try to resize your
JFrame after you typed in your name, you should see your
JLabel then. The
JLabel will always appear, if you call
setVisible(true) at the end of your program. This is because your
JFrame gets painted when you call
setVisible(true). If you add another component to it, the
JFrame is not repainted. If you resize it, it will be repainted.
However, you should have a look at basic Java Swing tutorials.
CLICK HERE to find out more related problems solutions.