This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 29584 - Window sizes not properly saved and restored
Summary: Window sizes not properly saved and restored
Status: CLOSED DUPLICATE of bug 26598
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Peter Zavadsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-16 21:26 UTC by dnoyeB
Modified: 2008-12-23 09:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dnoyeB 2002-12-16 21:26:42 UTC
For your JInternalFrames such as the ones showing the 
source code, you must not simply store the current window 
size, but also other size depending on if window is 
maximized or iconified.  If you do not during the next 
session the windows will have to be manually resized as 
opposed to just hitting the restore button.

In other words;

You need both of these when you store window state
plain = java.awt.Component.getBounds()
rest = javax.swing.JInternalFrame.getNormalBounds();

And if the window was saved while maximized, when ide next 
starts set
	jif.setBounds(restX,restY, restWidth,restHeight);
	jif.setMaximum(true);
If the window was saved while iconified, when ide next 
starts set
	jif.setBounds(restX,restY, restWidth,restHeight);
	jif.setIcon(true);
If the window was saved while not iconified or maximized
	jif.setBounds(plainx,plainy, 
plainwidth,plainheight);

You might say lets just skip getBounds() all together and 
always use getNormalBounds.  but getNormalBounds never has 
a value until either iconify or maximize has been called 
at least once, otherwise I believe it is either null, or 0.

Truthfully normal bounds should be set when the window is 
first created to equal the initial window size (Sun's 
job).  But since this is not happening, you must use both 
normalBounds and bounds.
Comment 1 dnoyeB 2002-12-16 21:34:57 UTC
NOTE:  THIS IS FINE WITH THE SOURCE WINDOW.  IT IS THE 
MAIN IDE WINDOW THAT HAS THIS PROBLEM.  So obviously my 
detailed explanation is not necessary.  Just needs to 
apply source window technique to IDE window.  Noting that 
IDE window is not a JInternalFrame, /me wonders if this is 
another level of issue alltogether...

3.4.1.beta1


How-To:
1. hit 'restore' for the window and set a nice size.
2. hit 'maximize' for window.
3. shut down IDE.
4. Restart IDE.
5. Hit 'restore' on window.

window should shrink down to size you set before.


Comment 2 dnoyeB 2002-12-19 17:16:18 UTC
Actually the maximized state of the IDE at shutdown is not re-applied
at powerup.
Comment 3 mslama 2003-01-06 15:53:20 UTC
It is known problem. The problem is that it is not possible to
detect/programmaticaly maximize main window (javax.swing.JFrame) in
JDK 1.3. There is already some support for it in JDK 1.4 but it does
not work correctly. See issue #26598.

*** This issue has been marked as a duplicate of 26598 ***
Comment 4 dnoyeB 2003-01-06 16:43:32 UTC
Your information is correct.  However, this is not a duplicate of
26598 as far as I can see.  Oh, nevermind.  It is more than 26598 and
this issue are both based on the same root problem, no maximize state
information.  Even if their hack-solutions require different techniques?

Actually the proper hack would be to hack in a maximized state
detection mechanism.  Then I could see these being duplicate.
Comment 5 mslama 2003-01-06 17:17:45 UTC
Yes you are right. There is already code in NB to save maximized state
on JDK 1.4 but it does not work. (eg. on Linux, RH 7.1, KDE 2.1.1 when
I call getExtendedState() after I maximize main window using maximize
button it returns 4 intstead of 6 (MAXIMIZED_BOTH, VERT, HORIZ). When
I call setExtendedState() window is maximized only verticaly. I can
provide you with simple test app if you want.) Anyway fix of issue
#26598 should give common solution if possible both for JDK 1.3 and
JDK 1.4.
Comment 6 Marian Mirilovic 2003-07-22 14:17:25 UTC
verified, closed - it's duplicate.
Comment 7 Jan Chalupa 2003-11-03 17:15:46 UTC

*** This issue has been marked as a duplicate of 26598 ***