• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to remove slider from JScrollbar

 
Sandeep Ghosh
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic