I'm making one application which keep running as a Tray Icon when close, then I have this method.
public void ResetFrame(){
this.dispose()
new CreateTabs().setVisible(true);
}
It's pretty simple, CLOSE the frame then instance a new one, I need to instance a new one instead of just set visible because stuff. Then I'm calling this method multiple times inside the same class, the problem is when I try to call it from another class.
if(!createTabs.isVisible()){
createTabs.ResetFrame();
//createTabs.setVisible(true);
}
I call that method everytime I click a button, I expect it to CLOSE the previous frame, destroy that instance of the object so I can call a new one with new properties.
The problem is: everytime I click the button it opens a new frame without closing the old one.
I have tried dispose(), finalize() and simple methods like that without any positive result.
Thanks beforehand for the help.
EDIT :
I'm sorry for my ignorance! The error is in ANOTHER class, the class where I call it.
Aparently the problem is while I instance the class:
private final CreateTabs createTabs = new CreateTabs();
I don't need a new CreateTabs(), what I need is to reference the already existing one.