![]() |
java swing : vertical slider on jtextpane - no thumb
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.8) (fedora-53.1.9.8.fc14-i386) OpenJDK Client VM (build 19.0-b09, mixed mode) I want to add a vertical slider to a JTextPane component. When I do, I get the slider but I don't get a thumb - i.e. the slider doesnt do anything here is my code Code:
JPanel dataPane = new JPanel(); // create panel dataPaneas you see, this code comes when I create the object but before I populate it. maybe I need to do something after I populate the textpane? any help would be much appreciated |
Okay, for starters, I'd put the textpane in/on a jpanel with a fixed size and put that in a scrollpane.
I think you're confusing this with the known behaviour of a JList where the scroller pops up as soon as the viewport becomes too small to handle the content. A scrollpane is something you use when screen space is at a premium and you nee to show a bit more... Quote:
Lemme know where this thing lands, okay? :) Thor |
Thor
see if I captured your suggestion result is a tiny bar maybe 1mm high and 1cm long instead of the textpane and slider when I do it the other way, I get the full pane but with an inoperable slider when I do it the old way, I get the fell pane and no slider and YES - I am confused Dick Code:
JPanel dataPane = new JPanel(); // create panel dataPane |
I found what I needed
my original solution was ok, I just needed to add Code:
slider.setPreferredSize(new Dimension(330, 500)); // needed this |
Cool, glad you found it!
Happy programmin' ! Anything in particular you're working on? Thor |
for the archive, here is the source that works to put a vertical slider on a JTextPane
Code:
|
| All times are GMT -5. The time now is 01:07 AM. |