Witam
W klasie
public class ButtonPanel2 extends JPanel implements ActionListener {
tworzę nowe okno
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if(source == appleButton)
new AppleFrame();
klasy AppleFrame.
Chcę by po utworzeniu tego okna, zamknęło się okno innej klasy SecondFrame
ublic class SecondFrame extends JFrame {
public SecondFrame() {
super("Katalog - przegladaj");
JPanel buttonPanel2 = new ButtonPanel2();
add(buttonPanel2);
Pomysł miałem taki aby po
if(source == appleButton)
new AppleFrame();
dać coś w stylu SecondFrame.dispose(); ale nie działa.
Głownie problem w tym żeby jakoś z tej klAasy ButtonPanel2 odwołać się do SecondFrame i zamknąć to okno.
Może ktoś już miał podobny problem ?
Z góry dzięki.