🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
4 messages
4 total messages Started by George Mon, 03 May 2004 20:20
Problems with frame size after L&F change
#1065
Author: George
Date: Mon, 03 May 2004 20:20
24 lines
1741 bytes
My application has a frame window whose initial size is set to the screen
size at application startup with the following  statement:

frame.setSize(frame.getToolkit().getScreenSize).

I have a menu option to set the Look and Feel dynamically.  However I find
that when I switch from Metal (the startup default) to, say, Windows the
size of the frame window gets changed to something larger than the screen.
I can no longer see the Minimize, Maximize and Close buttons in the top
right hand corner of the frame.  The status bar at the bottom is also not
visible.

This is how I am changing the look and feel (copied from tutorial)


UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel
");
    SwingUtilities.updateComponentTreeUI(frame);
    frame.pack()

Any help on what I'm doing wrong would be appreciated.

TIA
George
Re: Problems with frame size after L&F change
#1066
Author: George
Date: Tue, 04 May 2004 15:13
39 lines
2213 bytes
The problem is not so bad when I do

frame.setDefaultLookAndFeelDecorated(false).  In this case, only part of the
status bar is not visible and I click the Maximize button of the frame, the
frame resizes itself correctly.

BTW, I use JBuilder X Foundation on Windows 2000 "Professional"

TIA

"George" <geo_54321@yahoo.com> wrote in message
news:4096a942$1@newsgroups.borland.com...
> My application has a frame window whose initial size is set to the screen
> size at application startup with the following  statement:
>
> frame.setSize(frame.getToolkit().getScreenSize).
>
> I have a menu option to set the Look and Feel dynamically.  However I find
> that when I switch from Metal (the startup default) to, say, Windows the
> size of the frame window gets changed to something larger than the screen.
> I can no longer see the Minimize, Maximize and Close buttons in the top
> right hand corner of the frame.  The status bar at the bottom is also not
> visible.
>
> This is how I am changing the look and feel (copied from tutorial)
>
>
>
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel
> ");
>     SwingUtilities.updateComponentTreeUI(frame);
>     frame.pack()
>
> Any help on what I'm doing wrong would be appreciated.
>
> TIA
> George
>
>
Re: Problems with frame size after L&F change
#1074
Author: Lori M Olson (TeamB)
Date: Fri, 07 May 2004 21:28
36 lines
2181 bytes
George wrote:

> My application has a frame window whose initial size is set to the screen
> size at application startup with the following  statement:
> 
> frame.setSize(frame.getToolkit().getScreenSize).
> 

And there-in lies your problem.  Never do this.

I worked with cross-platform GUI's in C for years.  This issue of 
switching L&F on the fly is a thorny one.  EVERY L&F has differently 
sized frame decorations, so when you start sizing the frame and messing 
with L&F at the same time, you will never get what you want.

If you want your application to fill the screen, then set it 
"maximized".  See Frame.setExtendedState(int) for details.

-- 

Regards,

Lori Olson (TeamB)

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
     http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
     http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
     http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: Problems with frame size after L&F change
#1075
Author: George
Date: Tue, 11 May 2004 13:40
46 lines
2470 bytes
I changed to Frame.SetExtendedState(int) but it doesn't make much
difference.  The sizing problem is still there.

BTW, the L&Fs on offer in my program are just the usual Metal, Motif &
Windows combination just as in JBuilder itself.

"Lori M Olson (TeamB)" <javadragon@techie.com> wrote in message
news:409bffc1$1@newsgroups.borland.com...
> George wrote:
>
> > My application has a frame window whose initial size is set to the
screen
> > size at application startup with the following  statement:
> >
> > frame.setSize(frame.getToolkit().getScreenSize).
> >
>
> And there-in lies your problem.  Never do this.
>
> I worked with cross-platform GUI's in C for years.  This issue of
> switching L&F on the fly is a thorny one.  EVERY L&F has differently
> sized frame decorations, so when you start sizing the frame and messing
> with L&F at the same time, you will never get what you want.
>
> If you want your application to fill the screen, then set it
> "maximized".  See Frame.setExtendedState(int) for details.
>
> -- 
>
> Regards,
>
> Lori Olson (TeamB)
>
> ------------
>
> Save yourself, and everyone else, some time and search the
> newsgroups and the FAQ-O-Matic before posting your next
> question.
>
> Google Advanced Newsgroup Search
>      http://www.google.ca/advanced_group_search
> Other Newsgroup Searches:
>      http://www.borland.com/newsgroups/ngsearch.html
> Joi Ellis's FAQ-O-Matic:
>      http://www.visi.com/~gyles19/fom-serve/cache/1.html
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads