0

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.

3
Contributors
4
Replies
5
Views
13 Years
Discussion Span
Last Post by paradox814
0

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.

0

Darn so how can i make them bigger?! I feel the grid layout might be restricting the size but im not so sure.

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.