• 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

Converting from null Layout to Layouts

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have made a project using setLayout(null) and added the components using setBounds.
Now the requirement is that we have to use Layouts, so that the program runs in various resolutions (800x600) and (1024x768), which is not possible using hard bound values.
How can I do this ?
When I use scrollPane to add a table,and add it without using setSize, then it takes the whole window.
Is there any other way to write a GUI SWING application which is independent of the screen resolution?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I'm a little curious about why you opted not to use a layout manager if you don't mind me asking.
- Johanna
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For general information on how to use different layout managers, check out the Swing Tutorial.

As for the table taking up the whole frame... use the setPreferredScrollableViewportSize( Dimension ) method of JTable to set the size you want the scrollpane to be.
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I feel your pain, I've read the Swing Tutorial and I still don't have a clue how to design a UI that looks good, even a simple form, using the layout managers.
 
reply
    Bookmark Topic Watch Topic
  • New Topic