Java Reference
In-Depth Information
IllegalArgumentException . Because there can't be a border, the insets property setting is always
(0, 0, 0, 0). Instead of displaying a border around the JViewport , you can display a border around
the component within the view. Simply place a border around the component, or place the
component inside a JPanel with a border before adding it to the JViewport . If you do place a
border around the component, the border would be seen only if that part of the component is
visible. If you don't want the border to scroll, you must place the JViewport within a component
such as a JScrollPane that has its own border.
Tip To set the background color of what appears in the JScrollPane , you need to set the background
color of the viewport: aScrollPane.getViewport().setBackground(newColor) .
The size of the view ( viewSize property) is based on the size of the component ( view property)
within the JViewport . The view position ( viewPosition property) is the upper-left corner of the
view rectangle ( viewRect property), where the rectangle's size is the extent size ( extentSize
property) of the viewport. If that's confusing, Figure 11-18 should help you see where all these
properties lie within the JViewport .
Figure 11-18. Visualizing JViewport properties
 
Search WWH ::




Custom Search