944,008 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 8685
  • Java RSS
Feb 5th, 2005
0

Set Size for JSlider

Expand Post »
Is there anyway of actually changing the length of a slider. I have a some sliders in a grid layout and im wondering wether the grid layout will stop the sliders from expanding.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
MrScruff is offline Offline
89 posts
since Nov 2004
Feb 5th, 2005
0

Re: Set Size for JSlider

Controls will always take up all available room in a layout manager. That's guaranteed by the AWT API (on which Swing builds).
So your answer is no, you can't prevent the sliders from changing their size.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 5th, 2005
0

Re: Set Size for JSlider

Darn so how can i make them bigger?! I feel the grid layout might be restricting the size but im not so sure.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
MrScruff is offline Offline
89 posts
since Nov 2004
Feb 6th, 2005
0

Re: Set Size for JSlider

A grid layout will give each element in it the exact same horizontal and vertical size.
If you don't want that (for example you want some controls to take up less space, think of a group of very short labels) you will have to use another layout manager that offers more flexibility like GridBagLayout.
Those are of course harder to use because of that greater flexibility.

You can still not control size directly but you can now say that your slider can run across multiple columns.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 22nd, 2005
0

Re: Set Size for JSlider

if you are usign a JSlider you can use setPreferredSize() to change the size, but if you are usign GridLayout then it will not expand over the "cell" you are in. You will have to use multiple layout managers to accomplish this goal while still maintaining your GridLayout
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: two compiler errors to do with arrays
Next Thread in Java Forum Timeline: varible not working in for loop





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC