• Post Reply Bookmark Topic Watch Topic
  • New Topic

Deiconifying a Frame  RSS feed

 
Shin Lim
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how you can programmatically deiconify a Frame? Basically, I have a window that needs to be deiconified after being notified of the completion of a task. I have written a program in IBM Visual Age 3.0, which uses JDK1.1.7A, JFC1.0.3. Calling setVisible(true) after either:
setBounds(with the old), or setLocation() causes the window to be restored to its old bounds. However, the work around doesn't work when I test it under Sun's JDK1.1.7 or 1.2; the frame appears to be activated and isShowing() evaluates to true, but it is not visible. I've tried a combination of:
setBounds()
setLocation()
repaint(), etc...
It seems like a straightforward thing to do, am I missing something obvious??
Thanks in advance.

 
Sumit Dhamija
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Shin,
De-Iconifying a window /Frame has been made simple with the concept of Listeners and Adapter classes in Java 2. Shin make use of the Window Adapter class and use a method WindowClosing which should read System.exit(0).
 
Shin Lim
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sumit.
I want to deiconify the frame when the application is notified by some event. I have used an adapter but implementing windowClosing() with System.exit() will produce the wrong behaviour of exiting the application whereas I want to restore/ deiconify a window that is currently minimised. The solution written in Visual Age where setBounds(oldBounds) is called after receiving notification will restore the frame to its original bounds, but behaves differently on the Sun JRE or JDKs. I wonder if I am missing something or if this is an AWT bug. Any ideas anyone?
Regards
shin
 
Shin Lim
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I mean is, yes, you are right, Closing a window should exit the application but how does one restore a window that has been minimised? The same program written and tested in IBM Visual Age 3 behaves differently in the JRE or Sun JDKs. i.e. the window is no longer restored when the application is notified.
Try it out by writing a small program that starts a thread which sleeps for n seconds when its window is minimised, which then attempts to restore the frame to its original bounds when the thread stops. Depending on which JDK you are using ( I tested on 1.1.7 and 1.2), the result will be different. 1.1.7 will show that the window is activated (isShowing() evaluates to true) whereas 1.2 will evaluate isShowing() to true but the minimised/iconified window doesn't appear to be active. In both JDKs , the window is not restored to its original bounds. But run the same program in Visual Age, and it will.
Weird or what?
shin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!