?
Solved

How to modify JInternalFrame's iconfying behaviour?

Posted on 2004-09-10
7
Medium Priority
?
350 Views
Last Modified: 2012-08-13
Hi there!
I have a JInternalFrame which I'd like to basically shrink in size when you click on the iconify icon, but not to become an icon. I have set up a listener for iconified, in which I basically first de-iconify, then set the size:

                public void internalFrameIconified(InternalFrameEvent e) {
                    try {
                        vt.setIcon(false);
                    }
                    catch (Exception exc) {}
                    if (oldHeight == 0) {
                          oldHeight = vt.getHeight();
                          vt.setSize(vt.getWidth(),26);
                      }
                    else {
                        vt.setSize(vt.getWidth(),oldHeight);
                        oldHeight = 0;
                    }

                }

This works rather nicely - the problem is just that the iconify icon stays the same - so even when it's "minimized", the iconify button is still there as "minimize".

Is there either a way to change that iconify icon without actually iconifying the window? My problem is that I'm connecting the various windows with lines, so if I iconify one, I get problems if I do more than just set its size.

Thanks ahead of time for any help...
0
Comment
Question by:epaga
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 92

Accepted Solution

by:
objects earned 375 total points
ID: 12024479
think you'll need to provide a custom UI implementation and handle painting the title bar yourself.
positive side to that is you can implement your own behaviour for the iconify button, removing the need for your listener.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12024503
>> the iconify icon stays the same - so even when it's "minimized"
yeah, because the internal frame IS NOT minimized: it's made very small (<> minimized)

So in fact, you're aksing for a method to adapt the minimize/maximize icons...
Mmm... could be difficult. If not impossible, because I guess that's the OS's business.
0
 

Author Comment

by:epaga
ID: 12024509
how and where is that "iconify / maximize" button set? Is there no way to manually switch between the two or something?

PRoviding a custom UI implementation and painting the title bar myself...uh...that sounds a bit complicated. Is it? :-)
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 92

Expert Comment

by:objects
ID: 12024523
> ..uh...that sounds a bit complicated. Is it? :-)

not relly, no different than laying out any container really.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12024532
>> Is there no way to manually switch between the two or something?
I'm afraid not. That icon "follows" the internal frame's state.
That's what 99,99% of the people expect ;°)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12024605
>> My problem is that I'm connecting the various windows with lines, so if I iconify one, I get problems if I do more than just set its size
What kind of problems?
Maybe you have to rethink this part...
0
 

Author Comment

by:epaga
ID: 12052453
Well, in the end I just had to give up on the iconify button - I now have a context menu "Minimize" and "Restore" respectively, and a double click on the title bar minimizes and restores the window.
The problems i was having, btw, was that the lines lost their reference to the actual frame, since it became hidden, and the icon displayed instead was a different reference.

So, there isn't really a solution to the question, and the first correct answer was from objects. :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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
Course of the Month14 days, 3 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