Solved

How to modify JInternalFrame's iconfying behaviour?

Posted on 2004-09-10
7
348 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 125 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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
tomcat startup error 5 166
Java program running SQL query 5 62
Cisco ASA: Java web start no go, asdm launcher no go 3 88
What does this method description mean? 1 10
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
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 arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

734 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