?
Solved

How to modify JInternalFrame's iconfying behaviour?

Posted on 2004-09-10
7
Medium Priority
?
352 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
Industry Leaders: 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

650 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