aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Is it possible to remove slider from JScrollbar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Is it possible to remove slider from JScrollbar" Watch "Is it possible to remove slider from JScrollbar" New topic
Author

Is it possible to remove slider from JScrollbar

Sandeep Ghosh
Ranch Hand

Joined: Jan 23, 2002
Posts: 145
Hi Friend,
Could we remove slider(thumb) from the JScrollBar .Actually I am trying to create a component which is similar to up/down arrow of Date/Time Property dialog box of MS Windows .Is it a Scrollbar or something else .If it is a Scrollbar how could we make it small so that only up/down arrows appear.
Anybody have any solution.
Thanks in adv.
Sonu
Rene Liebmann
Ranch Hand

Joined: May 02, 2002
Posts: 196
If I understand you right, then you shouldn't use JScrollPane. The idea behind JSrollPane is putting a component into, which is larger than the place available on the frame or screen.
But you want to create a control to enter a Date/Time value. So you should combine a JTextField and two simple JButtons. As dealing with Date/Time is not that easy, I would write a model, where you can increment or decrement the date. I did this with a JSlider. It was not that easy.
Bye
Rene
Sandeep Ghosh
Ranch Hand

Joined: Jan 23, 2002
Posts: 145
Hi,
I think you got me wrong.I am not using JScrollPane.I am using JScrollBar.I have searched but there is no method which could remove slider.I have tried to reduce the size by putting some dummy component in JPanel , but for no use.It is taking Preferred size and showing slider.
So should I say Thumb rule is you cannot remove thumb of JScrollbar.
Correct me if I am wrong.
Sonu
Rene Liebmann
Ranch Hand

Joined: May 02, 2002
Posts: 196
Ok, JScrollPane is nothing else than a Pane and two JScrollBars. But anyway I think you are right. There is no method which hides the thumb.
If you need such a component, you have to do it by your own.
Clarence Kirby
Greenhorn

Joined: Jun 18, 2002
Posts: 16
I am having the exact same problem. If you figure anything out (besides just using 2 buttons) please let me know.
Sandeep Ghosh
Ranch Hand

Joined: Jan 23, 2002
Posts: 145
Hi Friend,
What I have done is that kept the JScrollbar in panel.Reduced the size so small that thumb become invisible,used setPrefferedSize to reduce the panel.This is not the right way,but it worked.
Sonu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to remove slider from JScrollbar