Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable can't dispose?  RSS feed

 
Alex AC
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recently, I experienced my JTable never got disposed after the actionPerformed, "mi1", below is part of the code. Moreover, if calling DisplayIt from MainMenu, it doesn't seem to popup. What would be the possible causes?

// Code for DisplayIt class
public static void makeGUI()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame Qframe = new JFrame("JTable");
Qframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Qframe.setJMenuBar(mb);
Qframe.setBackground(Color.white);
DisplayIt newContentPane = new DisplayIt();
newContentPane.setOpaque(true);

Qframe.setContentPane(newContentPane);
Qframe.pack();
Qframe.setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource() == mi1)
{
new MainMenu();
this.setVisible(false);
Qframe.dispose();
}
}
public void windowClosing(WindowEvent we)
{
Qframe.dispose();
System.exit(0);
}
public static void main(String Args[])
{
makeGUI();
}

// Code for MainMenu class
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == addp)
{
new AddIt();
this.dispose();
}
else if (e.getSource() == updatep)
{
new UpdateIt();
this.dispose();
}
else if (e.getSource() == displayp)
{
new DisplayIt();
this.dispose();
}
else if (e.getSource() == searchp)
{
new SearchPIt();
this.dispose();
}
else if (e.getSource() == exitp)
{
System.exit(0);
}
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!