Ashish
Ashish

Reputation: 14707

Difference between JScrollPane.getViewportBorderBounds() and JScrollPane.getViewport()

What is the difference between

JScrollPane.getViewportBorderBounds() 

and

JScrollPane.getViewport() 

and

JscrollPane.getVisibleRect()

First two are returning same dimension.

Upvotes: 0

Views: 803

Answers (2)

Shobhit
Shobhit

Reputation: 33

With different LookAndFeel, getViewportBorderBounds() and getViewport() will give different values.

Upvotes: 0

shuangwhywhy
shuangwhywhy

Reputation: 5625

getViewportBorderBounds() returns Rectangle which represents the bounds of the viewport border

getViewport() returns current JViewport.

getVisibleRect() returns visible rectangle of the JScrollPane (including borders and scroll bars), which is inherited from JComponent.

I don't see any comparability among these three methods. They are telling you different things. Read for more details on http://docs.oracle.com/javase/7/docs/api/javax/swing/JScrollPane.html

Upvotes: 3

Related Questions