Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2003

Tip: Looking for answers? Try searching our database.

real-time resizing?

Thread view: 
Jim Pete - 20 Nov 2003 12:29 GMT
I have a swing application that is made up of only one textarea that takes
the size of the window. When I resize it using the window's border, it does
not resize in real-time. It only resizes when I release my finger from the
mouse. Im using BorderLayout for this app.

Also, when I use the mouseDragged event, it does not get called when I
resize the borders.

Can anyone help me out?

Thanks
Antti S. Brax - 20 Nov 2003 13:31 GMT
jimmypete2k3@hotmail.com wrote in comp.lang.java.gui:
> I have a swing application that is made up of only one textarea that takes
> the size of the window. When I resize it using the window's border, it does
> not resize in real-time. It only resizes when I release my finger from the
> mouse. Im using BorderLayout for this app.

    The window resizing events come from your operating system.
    Try adding a component listener to your JFrame (You are using
    Jframe, right?) and print some debugging info every time you
    receive a componentResized event. My bet is that you only
    receive one event (when you release the mouse button).

> Also, when I use the mouseDragged event, it does not get called when I
> resize the borders.

    It is not a mouse drag event. Try listening for a "mouseExited"
    event and you'll notice you get one before you get a chance to
    resize the window.

    You need to go to a newsgroup that handles questions about your
    specific operating environment. The Java virtual machine can not
    do anything if it does not receive events from the operating
    system.

    PS. In Fedora Core 1 with Metacity window manager Swing windows
    are resized in real time. Maybe you should try it. :-)

Signature

Antti S. Brax - asb(at)iki.fi   Rullalautailu pitää lapset poissa ladulta
  http://www.iki.fi/asb/          http://www.cs.helsinki.fi/u/abrax/hlb/

Jim Pete - 20 Nov 2003 14:01 GMT
Hi,

Thanks for responding. Yes, I am using JFrame. You are saying that resizing
is an operating system issue... hmmm.... I am on Windows. I don't think the
windows newsgroups will respond to any swing-java issues... they'll
recommend I go to a java newsgroup... hehehe.. its never ending loop..

There must be some workaround to make this work on Windows....

> jimmypete2k3@hotmail.com wrote in comp.lang.java.gui:
> > I have a swing application that is made up of only one textarea that takes
[quoted text clipped - 22 lines]
> PS. In Fedora Core 1 with Metacity window manager Swing windows
> are resized in real time. Maybe you should try it. :-)
ak - 23 Nov 2003 12:57 GMT
first call Frame.setResizeable(false);
then write your own MouseListener and MouseMotionListener to handle resize.

> I have a swing application that is made up of only one textarea that takes
> the size of the window. When I resize it using the window's border, it does
[quoted text clipped - 7 lines]
>
> Thanks
Antti S. Brax - 24 Nov 2003 12:43 GMT
k.andrei@gmx.de.spam wrote in comp.lang.java.gui:
> first call Frame.setResizeable(false);
> then write your own MouseListener and MouseMotionListener to handle resize.

    Won't work.

Signature

Antti S. Brax - asb(at)iki.fi   Rullalautailu pitää lapset poissa ladulta
  http://www.iki.fi/asb/          http://www.cs.helsinki.fi/u/abrax/hlb/

ak - 25 Nov 2003 13:40 GMT
it worked with JWindow, why not with JFrame?

> k.andrei@gmx.de.spam wrote in comp.lang.java.gui:
> > first call Frame.setResizeable(false);
[quoted text clipped - 5 lines]
>  Antti S. Brax - asb(at)iki.fi   Rullalautailu pit?? lapset poissa ladulta
>    http://www.iki.fi/asb/          http://www.cs.helsinki.fi/u/abrax/hlb/
ak - 25 Nov 2003 20:46 GMT
Ok, you right, it don't work
> it worked with JWindow, why not with JFrame?
>
[quoted text clipped - 8 lines]
> >  Antti S. Brax - asb(at)iki.fi   Rullalautailu pit?? lapset poissa ladulta
> >    http://www.iki.fi/asb/          http://www.cs.helsinki.fi/u/abrax/hlb/
Thomas Kellerer - 23 Nov 2003 15:28 GMT
Jim Pete schrieb:

> I have a swing application that is made up of only one textarea that takes
> the size of the window. When I resize it using the window's border, it does
[quoted text clipped - 7 lines]
>
> Thanks

Toolkit.getDefaultToolkit().setDynamicLayout(true);
ak - 23 Nov 2003 15:50 GMT
> Jim Pete schrieb:
>
[quoted text clipped - 11 lines]
> >
> Toolkit.getDefaultToolkit().setDynamicLayout(true);

this works only with 1.4 and later and is platform-specific issue!
Thomas Kellerer - 23 Nov 2003 20:49 GMT
ak schrieb:

>>Toolkit.getDefaultToolkit().setDynamicLayout(true);
>
> this works only with 1.4 and later and is platform-specific issue!

So what :-)

1.4 is pretty much the standard in the meantime, especially for any new
development there is hardly no reason to use something else.

And it's only so far platform specific that on those platforms where the
user can control this feature, the user setting will override this featuer,
which is perfectly accetable I think.

Thomas
Jim Pete - 23 Nov 2003 19:09 GMT
Thats it!!!!!!! It worked!!!!

Thanks Thomas!!

ak: platform-specific and only 1.4... I'll have to remember that... thanks.

> Jim Pete schrieb:
>
[quoted text clipped - 11 lines]
> >
> Toolkit.getDefaultToolkit().setDynamicLayout(true);


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.