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!

Recommended Answers

All 2 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.