• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Frames  RSS feed

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a main screen (Main.java) which opens up Frame1.java when you click the OK button. The code I am using in the actionListener is
if(e.getSource() == OK)
{
new Frame1();
}

However, when I close Frame1, I would want to go back to the Main screen (Main.java). At the moment it closes both Frames when I close Frame1.java.
 
author and iconoclast
Posts: 24203
43
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to be a little more specific. "When you close Frame1" how? Does Frame1 have a WindowEvent handler, or have you called setDefaultCloseOperation on it?
 
Patrick Mugabe
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am calling Exit class which has the following code:
import java.awt.*;
import java.awt.event.*;
public class Exit extends WindowAdapter
{
public void windowClosing(WindowEvent event)
{
//event.getWindow().setVisible(false);
System.exit(0);
}
}
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!