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
Solved

Deiconify java frame.

Posted on 1997-12-03
8
300 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
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
couple of eclipse 5 45
how to add new optional parameter to JSP 1 49
JAVA API design with micro service cloud in mind 1 41
ejb entity bean example 2 7
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

792 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