Solved

Deiconify java frame.

Posted on 1997-12-03
8
311 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 150 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

737 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