Reputation: 633
I have a simple JFrame
that implements a KeyListener
. I want to add a label when the user type the letter A. When I do so The label doesn't appear directly. When I resize the frame it appear. But it is not the purpose to resize the frame. I want it to appear directly.
How to add a JLabel
on key press?
Upvotes: 0
Views: 211
Reputation: 413
How about calling validate()? http://docs.oracle.com/javase/7/docs/api/java/awt/Container.html#validate()
Upvotes: 1
Reputation: 1433
Sounds like you need to call the repaint() function to make it appear directly.
Upvotes: 0