[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

Deiconify java frame.

I nead to restore window from minimize from java Application with JDK 1.02 API. It's possible?
0
kogang
Asked:
kogang
  • 4
  • 3
1 Solution
 
fontaineCommented:
You will not be able to restore a minimized window programmatically because you catch the event in your handleEvent when it has already occured. It is simply too late. You have access to the state of a window but can not influence it, although explicitely allowed. One example for which it is allowed is the possibility to show or hide a window on screen. I suggest you to use these methods:

hide() when you do not want the window to be on screen
show() when you want it to be restored

I thinck this is the effect you are searching for.
0
 
russgoldCommented:
I don't think this is what kogang asked for.  User's can minimize  the window without using the Java calls.  As I interpret the question, it is: how can the program restore the window after a user minimizes it by pressing the minimize button?
0
 
fontaineCommented:
I interpret the question the same way. I give an example to clarify my explanation.

This will not work:

myFrame.handleEvent(new Event(myFrame,Event.WINDOW_DEICONIFY,null));

Why? Because you simply dispatch an event. You can make the program believe that the Frame has been de-iconified but you are not de-iconifying it!

Other proof about what I am saying. Take a look at the implementation of show(). You will see at the end:

// If first time shown, generate WindowOpened event
if ((state & OPENED) == 0) {
            postWindowEvent(WindowEvent.WINDOW_OPENED);
            state |= OPENED; }

When the VM calls show(), it shows the Frame by invoking the peer implementation of the Frame for the specific machine, and, AFTER THAT it creates an event to inform the program about the state of the window. That's not the postWindowEvent that builds up the Frame!

De-iconifying from a program would be possible if a deiconify() method was implemented. Similarly to show(), it would invoke the peer implementation for de-iconifying and then would dispatch an event to inform your program about the state of the window.
As such method doesn't exist, it is simply not possible to do.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
russgoldCommented:
Exactly.  The correct answer is that what kogang wants to do is simply not possible.
In fact, I had asked this question on this forum several months ago and didn't get a good answer, then, either.

This is a known problem in the JDK. (See http://developer.javasoft.com/developer/bugParade/bugs/4037811.html)

If you want it fixed, go to this address, join the Java Developer Connection, and vote for this as an important bug.
0
 
kogangAuthor Commented:
If i can't restore a minimized window , may be it's possible to make frame without
minimize and zoom button in JDK 1.02 .I know i can use Dialog
frame,but I want to use frame.
0
 
russgoldCommented:
Unfortunately, that is not possible either.  There is no way to remove the max/min buttons. There should be: calling setResizable( false ) probably ought to do it, but it doesn't. This has also been reported to Javasoft as a bug.  See <http://developer.javasoft.com/developer/bugParade/bugs/4080710.html> to add your own comments or vote to make it a priority.
0
 
russgoldCommented:
Some good news. I was just at the Javasoft bug site. Apparently, there are plans to create a new API to permit minimize/maximize. No indication on when it will be available.
0
 
fontaineCommented:
I thinck I had answered to the original question, no? If everybody agrees I am right, why rejecting my answer?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now