I do not know why my code is not working properly. When I am trying to open window(BazaDanych) only window2(ZmienBaze) appears and I dont know why. Window(BazaDanych) does not open at all. Maybe could you help me.
class GlowneMenu extends JFrame implements ActionListener
{
public GlowneMenu()
{
setTitle("Menu");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
...<not important just Menu stuff>
JMenu info = new JMenu("Info");
...<not important just JMenu and label stuff>
}
public void actionPerformed(ActionEvent e){
new BazaDanych().setVisible(true);
this.dispose();
new ZmienBaza().setVisible(true);
this.dispose();
}
public static void main( String[] args){new GlowneMenu().setVisible(true);}
}
class BazaDanych extends JFrame{
public BazaDanych()
{
setTitle("Baza danych");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocation(400,100);
...<not importent just this window stuff>
}
}
class ZmienBaza extends JFrame{
public ZmienBaza()
{
setTitle("Zmiana Bazy");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocation(400,100);
...<not importent just this window stuff>
}
}
I figured out that when I delete this :* my code will work properly but only to one window. How can I add more windows in these way??
*new ZmienBaza().setVisible(true);
this.dispose();