javax.swing
public class ViewportLayout extends Object implements LayoutManager, Serializable
JViewport
. The viewport makes its view the
same size as itself, but not smaller than its minimum size.
If the port extends extends into space past the edge of the view,
this layout manager moves the port up or to the left, in view space, by the
amount of empty space (keep the lower and right edges lined up).Constructor and Description |
---|
ViewportLayout() |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(String name,
Component c)
The method is not used with this manager.
|
void |
layoutContainer(Container parent)
Layout the view and viewport to respect the following rules.
|
Dimension |
minimumLayoutSize(Container parent)
Get the minimum layout size.
|
Dimension |
preferredLayoutSize(Container parent)
Get the preferred layout size.
|
void |
removeLayoutComponent(Component c)
The method is not used with this manager.
|
public ViewportLayout()
public void addLayoutComponent(String name, Component c)
addLayoutComponent
in interface LayoutManager
name
- the name of the component to addc
- the component to addpublic void removeLayoutComponent(Component c)
removeLayoutComponent
in interface LayoutManager
c
- the component to removepublic Dimension preferredLayoutSize(Container parent)
Scrollable
, this method returns
Scrollable.getPreferredScrollableViewportSize()
.
Otherwise, it returns Component.getPreferredSize()
.preferredLayoutSize
in interface LayoutManager
parent
- the parent container to lay outLayoutManager.minimumLayoutSize(Container)
public Dimension minimumLayoutSize(Container parent)
Component.getMinimumSize()
.
If the view is not set, the zero size is returned.minimumLayoutSize
in interface LayoutManager
parent
- the viewportLayoutManager.preferredLayoutSize(Container)
public void layoutContainer(Container parent)
JViewport.setViewSize(Dimension)
, the view size is never
set smaller that its minimum size.layoutContainer
in interface LayoutManager
parent
- the container to lay outJViewport.getViewSize()
,
JViewport.setViewSize(java.awt.Dimension)
,
JViewport.getViewPosition()
,
JViewport.setViewPosition(java.awt.Point)