• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

do something when other frame close

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello, i need help in java about swing...

i have 2 class which have frame in it, let say classA and classB
is there any way so that when frame in classB closed i do something in classA
for example when classB closed a textArea in classA will write a text.

i've done this in classA

but there is nothing happen....please help me...
 
Marshal
Posts: 80653
476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Why have you got two frames? Why not use a dialog for the second window?
You can add a WindowListener which fires when a frame closes.
[edit]I see you already have such a listener[/edit]
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but there is nothing happen....please help me...


Impossible to help without seeing all the relevant code. To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

And I second Campbell's advice: most applications are best designed with only one JFrame, and other UIs as JDialogs, commonly modal.

edit Your initComponents() call implies that you are using a visual designer -- definitely not a beginners' tool. Is that guess correct?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic