I have a relatively small class called "LoadingWindow", this class has a constructor that calls the Initialize function to set the frame. I did not test some things to try to decide why it will not be updated. During testing, I added "this.removeAll ();" to the chapter on the initialization method. Turns out I can't add anything after that. Everything that I add, just will not show.
Here is a slightly stripped down version of the class:
public class LoadingWindow extends JFrame{ public JPanel panel; public JProgressBar bar; private JLabel label; public LoadingWindow() { this.Initialize(); } public void Initialize() { this.removeAll(); this.setSize(300, 150); panel = new JPanel(new BorderLayout()); bar = new JProgressBar(0,100); label = new JLabel("Please remain calm, we're just loading..."); panel.add(bar,BorderLayout.CENTER); panel.add(label,BorderLayout.SOUTH); this.add(panel); this.validate(); this.repaint(); this.setVisible(true); } }
The window itself pops up correctly, with a title. However, the window itself is completely empty.
I implement this class statically so that four other objects can access it in the EditorPanel class. It is defined as:
public static LoadingWindow loadingWindow;
and initialized in the constructor with:
loadingWindow = new LoadingWindow();
Then a double check is performed inside the functions that use it to show it if it is hidden.
if(!EditorPanel.loadingWindow.isVisible()){EditorPanel.loadingWindow.Initialize();}
In general, I'm a little confused why the content is shown, and I am very interested in any questions, and I am ready to provide any necessary information. Google did not provide much, and each answer that I found, I have already implemented "for example, redrawing and checking."
I look forward to your reply!
~ Travis