My application runs fine on eclipse IDE, but after exporting it, the fame won't repaint. i am trying to rebuild the lay out of JFrame by removing two JPanels and add them again with more panels & here is my code:
the app first calls buildGUI()
private void buildGUI(){
setTitle("MyApp");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(new BackGroundImagePanel());
setResizable(false);
getContentPane().setLayout(new GridBagLayout());
c = new GridBagConstraints();
/*
*set up GridBagConstraints and add the two panels
*/
pack();
setSize(700, 700);
revalidate();
setLocationRelativeTo(null);
}
Upon user input do some calculations & call reBuildGUI():
private void reBuildGUI(){
//Clean the frame.
remove(firstPanel);
remove(secondPanel);
//removeAll() doesn't work for me;
validate();
repaint();
/*
*set up GridBagConstraints and more panels
*/
pack();
setSize(700, 700);
repaint();
validate();
}
again, the application work perfict on the IDE but not as stand alone jar, upon calling reBuildGUI() nothing happen ! Tried to use validate(), revalidate() & pack() in different orders with no gain ?