aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JFrame JPanel JDesktopPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame JPanel JDesktopPane" Watch "JFrame JPanel JDesktopPane" New topic
Author

JFrame JPanel JDesktopPane

Mwenya Chongo
Greenhorn

Joined: Dec 15, 2010
Posts: 10
Hi
I am working on some swing components. What am trying to do is to create a Jframe and this Jframe will take to size of the computer screen. In this Jframe I want to add the JPanel which has a fixed width and the JDesktopPane to take up the remaining Jframe size. So the Jframe size will be variable depending on the screen of the computer it running on. Can this work? If so how can I do it?



Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you set the frame to full screen
give your panel a preferredSize - the width you want, height can be any number
add the panel to the frame's contentPane at BorderLayout.EAST or WEST (depends on which side you want the panel)
add the desktopPanel to the frame's contentPane at BorderLayout.CENTER

basically, the panel will get the width it wants, height will be determined by screen size and
desktopPane will get what's left over
Mwenya Chongo
Greenhorn

Joined: Dec 15, 2010
Posts: 10
Thanks a lot that worked perfect.

I have another issue. How can I force the screen to load fast. I am experiencing a noticeable delay in the loading of the components an at time do not load at all, all I see is the JFrame. Is there anything I can do about that?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
when do you set the frame visible:
before or after adding the components?
Mwenya Chongo
Greenhorn

Joined: Dec 15, 2010
Posts: 10
I set the set the frame visible before adding the components
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4527
    
    5

Try changing that.


luck, db
There are no new questions, but there may be new answers.
Mwenya Chongo
Greenhorn

Joined: Dec 15, 2010
Posts: 10
Thank you very much, I will try that.

Do you have any code that compares time and executes an event when the two times are equivalent?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFrame JPanel JDesktopPane