Java Utililty Methods JScrollPane Create

List of utility methods to do JScrollPane Create

Description

The list of methods to do JScrollPane Create are organized into topic(s).

Method

ComponentgetScrollPane(Component innerComponent)
get Scroll Pane
Component component = innerComponent;
if ((innerComponent instanceof JScrollPane)) {
    return innerComponent;
if ((component.getParent() != null) && (component.getParent().getParent() != null)
        && ((component.getParent().getParent() instanceof JScrollPane))) {
    component = component.getParent().getParent();
    return component;
...
JScrollPanegetScrollPane(BasicComboPopup popup)
get Scroll Pane
return null;
JScrollPanegetScrollPane(Component component)
Get the JScrollPane that contains the passed in component.
return ((JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, component));
JScrollPanegetScrollPane(Component component)
Adds a component to a ScrollPane.
JScrollPane scrollpane = new JScrollPane();
scrollpane.setViewportView(component);
return scrollpane;
ComponentgetScrollPane(Component innerComponent)
Gets the scroll pane around the component.
Component component = innerComponent;
if (innerComponent instanceof JScrollPane) {
    return innerComponent;
if (component.getParent() != null && component.getParent().getParent() != null
        && component.getParent().getParent() instanceof JScrollPane) {
    component = component.getParent().getParent();
    return component;
...
JScrollPanegetScrollPane(final Component component)
Returns scroll pane for specified component if exists, null otherwise.
if (component != null && component.getParent() != null && component.getParent() instanceof JViewport
        && component.getParent().getParent() != null
        && component.getParent().getParent() instanceof JScrollPane) {
    return (JScrollPane) component.getParent().getParent();
} else {
    return null;
JScrollPanegetScrollPaneAncestor(Component c)
Gets the scroll pane that wraps a given component.
for (c = c.getParent(); c != null; c = c.getParent()) {
    if (c instanceof JScrollPane)
        return (JScrollPane) c;
return null;
ComponentgetScrollPaneViewComponent(JComponent component)
get Scroll Pane View Component
if (component instanceof JScrollPane) {
    return ((JScrollPane) component).getViewport().getView();
return null;
JScrollPanemakeScrollable(JComponent c)
make Scrollable
return new JScrollPane(c, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JScrollPanemakeScrollPane(Component c, int xdim, int ydim)
Make a scroll pane for the input box which may be used to hold selection buttons later; size is given; text for a title in box.
JScrollPane sp = new JScrollPane(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JViewport vp = sp.getViewport();
vp.setViewSize(new Dimension(xdim, ydim));
return sp;