Solved

How to modify JInternalFrame's iconfying behaviour?

Posted on 2004-09-10
7
340 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
Comment Utility
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
Comment Utility
>> 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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 92

Expert Comment

by:objects
Comment Utility
> ..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
Comment Utility
>> 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
Comment Utility
>> 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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
json format text only 4 64
json example 39 108
java  and programming certification ? 4 62
backtracking recursion  code 19 39
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 will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

728 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

9 Experts available now in Live!

Get 1:1 Help Now