954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Setting the size for a JSlider

Alright I have been using the setSize method for the JSlider to try to set it's size but it seems to be having no effect what soever. I have the JSliders instead a JPanel that is using a GridBagLayout, the JPanel is then being adding to another JPanel which uses a GridBag Layout. The second JPanel then functions as the contentArea for a JFrame. I have my JSliders set to Vertical (as for an equalizer) and I need to make them shorter, so I figured using setSize would work, but, as I mentioned, it is not :(.

Thanks for any help you can provide!

Frank0051
Light Poster
27 posts since Dec 2004
Reputation Points: 10
Solved Threads: 0
 

Check your layout manager. Maybe alter the gridbaglayout a little bit so it works.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

setSize has little effect for most controls, it's mainly there to enable resizing of entire windows (and might have been better implemented at a different level in the class hierarchy), you're not supposed to control the size in pixels of user interface controls in Java as they're controlled by the layoutmanager.
This is to make sure it looks decent on whichever operating system your application may run on.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You