• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JFrame JPanel JDesktopPane

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?



 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when do you set the frame visible:
before or after adding the components?
 
Mwenya Chongo
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I set the set the frame visible before adding the components
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try changing that.
 
Mwenya Chongo
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic