Hi,
I want to implement a custom scroll bar which functions like the one
in StartMenu->Programs option. Instead of a vertical scroll bar I want
buttons at the top and botton of the frame and on mouse over of it I
want to implement the vertical scroll bar functionality. Is there any
way to do it in Java. Basically I have a panel where in I have added a
JTree component. I want to implement these scroll bars in this panel.
Thanks in advance.
Ralf Seitner - 20 Jul 2006 15:38 GMT
akhila schrieb:
> Hi,
>
[quoted text clipped - 6 lines]
>
> Thanks in advance.
Hi!
I think you are not looking for a scrollbar (JScrollBar), but looking
for a JPopupMenu (javax.swing.JPopupMenu).
Have a look at the swing tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html
bye, Ralf
Andrey Kuznetsov - 20 Jul 2006 16:22 GMT
> I want to implement a custom scroll bar which functions like the one
> in StartMenu->Programs option. Instead of a vertical scroll bar I want
> buttons at the top and botton of the frame and on mouse over of it I
> want to implement the vertical scroll bar functionality. Is there any
> way to do it in Java. Basically I have a panel where in I have added a
> JTree component. I want to implement these scroll bars in this panel.
I think that I understand what you mean,
however this is horrible thing - I hate it - aspecially if there are
*very*many*items*to*scroll*,
you may scroll half a year to last item.
I think you can hack it very easy - take JScrollPane and make both scroll
bars always invisible.
Now you just need two JButtons and implement mouse handling - by mouse over
buttons
you decrement/increment position of JScrollPane's verticall JScrollBar.
Thats it!
Andrey
--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities