-1

i'm trying to reload my frame using a button. i have tried this code. but my frame just disappear and won't appearing again. then i have google it and tried revalidate() validate() and repaint() too. but noting happend. what should i do?
I want to do that, because in this frame i have some function to disable some combo box, rename some label, and clear some text field. and i want to "reset" them to default value as first. and if i use setText label or re enable combo box, i think it will take a lot code. i'm using netbeans by the way.
And i have tried to write a method which can reset the individual values back to there default states
But i want to find another more eficient code to do that.

private void btRestartActionPerformed(java.awt.event.ActionEvent evt) {
    setVisible(false);
    setVisible(true);
}

this is my action performed button. thank you

1 Answers1

0

Create a fresh instance of the frame and dispose the previous one... if you feel too lazy. Otherwise, the best thing is to set everything to initial values. Actually, the previous method do not take much of additional coding but the amount of code your machine executes is a lot lot more.

Nickal
  • 669
  • 2
  • 11
  • 25