dirnthelord 0 Newbie Poster

Ok, Here is the thing.
I have a JPanel inside the JScrollPane. JPanel has many Images (as ImageIcons on JLabel). Now I want to make the auto scrolling to be happen when I place mouse over the JScrollPane or any child of its.

I could do the scrolling to the end of JPanel by calling this

for (int i = 1; i < jPanel1.getHeight(); i++)
jPanel1.scrollRectToVisible(new Rectangle(0, i, 1, 1));

under mouseEntered event of JScrollPane.
But this is not what I want.

I want it to happen smoothly and I also want the Scroll Bar to move according to the viewport. Like a animation. When I get the mouse pointer back, I want it to freeze where the JPanel is nw....

How can I do this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.