Solved

Deiconify java frame.

Posted on 1997-12-03
8
273 Views
Last Modified: 2011-10-03
I nead to restore window from minimize from java Application with JDK 1.02 API. It's possible?
0
Comment
Question by:kogang
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:fontaine
Comment Utility
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
 
LVL 4

Expert Comment

by:russgold
Comment Utility
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
 
LVL 5

Expert Comment

by:fontaine
Comment Utility
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
 
LVL 4

Expert Comment

by:russgold
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:kogang
Comment Utility
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
 
LVL 4

Accepted Solution

by:
russgold earned 150 total points
Comment Utility
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
 
LVL 4

Expert Comment

by:russgold
Comment Utility
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
 
LVL 5

Expert Comment

by:fontaine
Comment Utility
I thinck I had answered to the original question, no? If everybody agrees I am right, why rejecting my answer?
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now