Re: Draggable JButton and problem with scroll pane




"Chanchal" <chanchal.jacob@xxxxxxxxx> wrote in message
news:dea1b5f2-9d39-4455-a4ed-f91a9853e8dd@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello All,

The following code adds a JButton to a JPanel in a JScollPane, when a
JButton is clicked. A MouseMotionAdapted is regitered to the added
JButton to make it draggable. The problem i'm facing is that the
scrollbars of the JSrollPane is not getting activated when the added
button is dragged outside the viewable area. The result i want is
that, if the added JButton is dragged out side the viewable area, is
should be posible to bring it back to the viewable area by scrolling
the scollbars. Kindly advice how can i create this result.

The documentation for JComponent.setAutoscrolls() explains what
to do.


.