• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WindowListener not working JDialog

 
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing prints out after clicking on the X in the upper right hand corner of my JDialog. I am using the Nimbus look and feel, Java 6 update 22, under Windows 7 duo processor.

 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your SSCCE demonstrating the problem.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not a SSCCE...there's no main method, and it won't compile because we don't have MusiqueFrame and DocumentScrollPane. The link Rob gave explains what's needed.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question is about adding a WindowListener to a dialog and listening for the windowClosed event.

What do the following have to do with this requirement?

a) all the custom UIManager properties.
b) the custom Font
c) the File and Locale
d) the custom JDialog. Is this the problem? Does it work with a plain dialog?
e) etc.

The SSCCE should be about 10-15 lines of code.

The point of a SSCCE is to use the default functionality of Java to see if it works. Then if it works you see what is different between the "default" and your "custom" behavour. There you know where to look for a difference to see what is wrong. If it doesn't work then you have something simple to post and we can help if you are doing something wrong.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did a test with a simple JDialog and got the same results: nothing printed with println(). Keep in mind we are talking about closing the window by clicking on the red button upper right hand corner of JDialog. My program needs to know this so it can choose which JTree to keep, because I am using a JSplitpane with the possibility of removal and replacement by JS crollPane for JTree (s). Thanks. Any help appreciated.

 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I did a test with a simple JDialog and got the same results



So where is your test code (the SSCCE)? How many times do you have to be asked?

Where are the import statements? What is the point of the JOptionPane? How is it related to the problem? There is no main() method. There is no code to create and show your dialog. Yes, it is simple to add but but you have already done this because you created a test so why should we waste time trying to duplicated something that has already been done?. You want some help, so don't make use do extra work.

I'm finished with this posting. Good luck. Maybe next time you will post a proper SSCCE.

 
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

Rob Camick wrote:What is the point of the JOptionPane?
There is no code to create and show your dialog.


I think you hit the nail on the head. The extended dialog's never shown and the OP's expecting the WindowListener to be triggered by closing the JOptionPane's dialog.
 
Every time you till, you lose 30% of your organic matter. But this tiny ad is durable:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic