How to add components to JFrame once it's visible without having to resize it?
问题 I have a program where I have a JFrame with a JButton in it. When the user clicks the JButton , all Components of the JFrame are removed, and a JPanel with red background is added to it. When I click the JButton , that red JPanel does not become visible unless I resize the JFrame (I am using Windows 7). Is there a way to achieve what I want without having to manually resize the JFrame ? Here is a part of the code I am using: public class Demo implements ActionListener{ public static void main