Set Size for JSlider

Reply

Join Date: Nov 2004
Posts: 89
Reputation: MrScruff is an unknown quantity at this point 
Solved Threads: 0
MrScruff's Avatar
MrScruff MrScruff is offline Offline
Junior Poster in Training

Set Size for JSlider

 
0
  #1
Feb 5th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Set Size for JSlider

 
0
  #2
Feb 5th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 89
Reputation: MrScruff is an unknown quantity at this point 
Solved Threads: 0
MrScruff's Avatar
MrScruff MrScruff is offline Offline
Junior Poster in Training

Re: Set Size for JSlider

 
0
  #3
Feb 5th, 2005
Darn so how can i make them bigger?! I feel the grid layout might be restricting the size but im not so sure.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Set Size for JSlider

 
0
  #4
Feb 6th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: Set Size for JSlider

 
0
  #5
Feb 22nd, 2005
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC