?
Solved

Deiconify java frame.

Posted on 1997-12-03
8
Medium Priority
?
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:fontaine
ID: 1231372
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
ID: 1231373
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
ID: 1231374
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!

 
LVL 4

Expert Comment

by:russgold
ID: 1231375
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
 

Author Comment

by:kogang
ID: 1231376
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 300 total points
ID: 1231377
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
ID: 1231378
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
ID: 1231379
I thinck I had answered to the original question, no? If everybody agrees I am right, why rejecting my answer?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

800 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