Re: JFrame Resize Issues
- From: casey.lutz@xxxxxxxxx
- Date: 30 Jun 2005 05:52:46 -0700
Oh boy, um... providing compilable source code for this problem may
span quite a few pages. I'll start by explaining what I mean by
"fight".
When I have the frames undecorated, I believe the Java VM uses
Windows(r) own Window Manager (Windows2000/XP is what I am developing
on). In this case, the componentResized() event is issued when the
user has completed resizing the frame. However, when I switch to
Decorated frames, the Java VM issues componentResized() while the user
is still resizing (like every couple of pixels that they move it).
When a resize is called, I basically call a function: resizeVideo()
which checks to see if aspect ratio is enabled and if it is resizes the
window based on the aspect ratio.
if ( ControlAspect.getText().equals( "Aspect Off" ) ) {
if ( newHeight != oldHeight || newWidth != oldWidth ) {
// Keep aspect ratio
if ( java.lang.Math.abs( oldHeight - newHeight ) >=
java.lang.Math.abs( oldWidth - newWidth ) ) {
oldHeight = newHeight;
inHeight = oldHeight - diffHeight;
inWidth = ( int ) ( ratio * ( ( float ) inHeight ) );
oldWidth = inWidth + diffWidth;
}
else {
oldWidth = newWidth;
inWidth = oldWidth - diffWidth;
inHeight = ( int ) ( ( ( float ) inWidth ) / ratio );
oldHeight = inHeight + diffHeight;
}
if ( fvmain.debug2 ) {
System.out.println( "ratio: " + ratio );
}
}
this.setSize( oldWidth, oldHeight );
}
Currently the layoutManager is set to BorderLayout. I'm using Borland
JBuilder X with JDK 4. The reason that I'm using BorderLayout is
because I have two components in this window, a bar which basically
contains a row of buttons (which act as sort of a graphical menu bar)
and a JPanel that acts as a drawing canvas.
Here's to hoping this is enough information. If you need more I'll be
happy to comply. Thank you.
.
- Follow-Ups:
- Re: JFrame Resize Issues
- From: Andrew Thompson
- Re: JFrame Resize Issues
- References:
- JFrame Resize Issues
- From: casey . lutz
- Re: JFrame Resize Issues
- From: Joan
- Re: JFrame Resize Issues
- From: Thomas Weidenfeller
- JFrame Resize Issues
- Prev by Date: Re: Utility class to check validity of package, class, and method name
- Next by Date: Re: Ant targets
- Previous by thread: Re: JFrame Resize Issues
- Next by thread: Re: JFrame Resize Issues
- Index(es):