This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

use 80% of a row  RSS feed

 
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I have panel that has a scroll pane (with an editor pane) and a button. I would like that the scroll pane filled 80% of the panel. Is there a way to do this? How?
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out weightx and weighty in GridBagLayout
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another option is BorderLayout.

put everything else in a separate panel, then add that to EAST/WEST/NORTH or SOUTH,
giving it a preferredSize width or height (depending on where it is in the BorderLayout) equal to 20% of the frame's width or height,
then add the scrollpane to BorderLayout.CENTER, and it will take up the remaining 80%
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

I tried the below code but it didn't work. It is 50% for both. I'll try Michael Dunn's suggestion and give feedback.

 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Leandro Coutinho wrote:Thank you.

I tried the below code but it didn't work. It is 50% for both.


No surprise as you're using GridLayout not the suggested GridBagLayout. There's a BIG difference.

Luck
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pete stein wrote:

Leandro Coutinho wrote:Thank you.

I tried the below code but it didn't work. It is 50% for both.


No surprise as you're using GridLayout not the suggested GridBagLayout. There's a BIG difference.

Luck


wow. sorry folks. (ashamed)
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!