Aus einem JFrame anderes JFrame starten

maddos

Mitglied
Hallo erstmal.

Ich starte ein JFrame, dann drücke ich in diesem Frame ein "Start" Button. In ActionPerformed Methode von diesem Button steht dann z.B. "new AnotherFrame();"
ich will, dass aktuelles Frame geschlossen wird und neues Frame "AnotherFrame" geöffnet wird. Ist das möglich? Wenn ja, wie?
 
Wo liegt das Problem?
Code:
this.setVisible(false);
new AnotherFrame();
Im Konstruktur vom AnotherFrame muss dieses natürlich sichtbar gemacht werden.
 
Hallo,

dann versuch es doch mal so

Code:
new AnotherFrame().setVisible(true);

thommyslaw meinte ja, dass du setVisible im Konstruktor von AnotherFrame aufrufen sollst.
Im Konstruktur vom AnotherFrame muss dieses natürlich sichtbar gemacht werden.

MFG

zEriX
 

Neue Beiträge

Zurück