com.sibvisions.rad.ui.swing.ext
Class JVxScrollPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by com.sibvisions.rad.ui.swing.ext.JVxScrollPane
All Implemented Interfaces:
MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ScrollPaneConstants
Direct Known Subclasses:
JVxTable, JVxTree

public class JVxScrollPane
extends JScrollPane
implements MouseListener

ScrollPane implementation that get the right minimum size, preferred size and maximum size.

See Also:
JScrollPane, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JScrollPane
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JVxScrollPane()
          Creates an empty (no viewport view) JVxScrollPane where both horizontal and vertical scrollbars appear when needed.
JVxScrollPane(Component pView)
          Creates a JVxScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
JVxScrollPane(Component pView, int pVerticalScrollBarPolicy, int pHorizontalScrollBarPolicy)
          Creates a JVxScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars.
JVxScrollPane(int pVerticalScrollBarPolicy, int pHorizontalScrollBarPolicy)
          Creates an empty (no viewport view) JVxScrollPane with specified scrollbar policies.
 
Method Summary
protected  Dimension getPreferredComponentSize(Component pComponent)
          The calculation of PreferredSize is in here to prevent wrapping each component.
 Dimension getPreferredSize()
          Returns the preferred size in a bit different way as JScrollPane.
 Component getViewportView()
          Gets the view port view.
 void mouseClicked(MouseEvent pEvent)
          
 void mouseEntered(MouseEvent pEvent)
          
 void mouseExited(MouseEvent pEvent)
          
 void mousePressed(MouseEvent pEvent)
          
 void mouseReleased(MouseEvent pEvent)
          
 void setViewport(JViewport pViewport)
          
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JVxScrollPane

public JVxScrollPane(Component pView,
                     int pVerticalScrollBarPolicy,
                     int pHorizontalScrollBarPolicy)
Creates a JVxScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, if vsbPolicy is VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed at JScrollPane.setVerticalScrollBarPolicy(int) and JScrollPane.setHorizontalScrollBarPolicy(int).

Parameters:
pView - the component to display in the scrollpanes viewport
pVerticalScrollBarPolicy - an integer that specifies the vertical scrollbar policy
pHorizontalScrollBarPolicy - an integer that specifies the horizontal scrollbar policy
See Also:
JScrollPane.setViewportView(java.awt.Component)

JVxScrollPane

public JVxScrollPane(Component pView)
Creates a JVxScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.

Parameters:
pView - the component to display in the scrollpane's viewport
See Also:
JScrollPane.setViewportView(java.awt.Component)

JVxScrollPane

public JVxScrollPane(int pVerticalScrollBarPolicy,
                     int pHorizontalScrollBarPolicy)
Creates an empty (no viewport view) JVxScrollPane with specified scrollbar policies. The available policy settings are listed at JScrollPane.setVerticalScrollBarPolicy(int) and JScrollPane.setHorizontalScrollBarPolicy(int).

Parameters:
pVerticalScrollBarPolicy - an integer that specifies the vertical scrollbar policy
pHorizontalScrollBarPolicy - an integer that specifies the horizontal scrollbar policy
See Also:
JScrollPane.setViewportView(java.awt.Component)

JVxScrollPane

public JVxScrollPane()
Creates an empty (no viewport view) JVxScrollPane where both horizontal and vertical scrollbars appear when needed.

Method Detail

mouseClicked

public void mouseClicked(MouseEvent pEvent)

Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent pEvent)

Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent pEvent)

Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent pEvent)

Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent pEvent)

Specified by:
mouseReleased in interface MouseListener

setViewport

public void setViewport(JViewport pViewport)

Overrides:
setViewport in class JScrollPane

getPreferredComponentSize

protected Dimension getPreferredComponentSize(Component pComponent)
The calculation of PreferredSize is in here to prevent wrapping each component. TextArea and TextField uses preferred size of set columns and rows. If columns or rows are set to 0 the default preferred size is used.

Parameters:
pComponent - the component we want to know the preferred size.
Returns:
the preferred component size.

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size in a bit different way as JScrollPane. In the case of SCROLLBARS_AS_NEEDED, the space for them is reserved if the width or height is not tracked. This gives fixes the problem, layouts will resize everything do to changing the visibility of the scrollbars.

Overrides:
getPreferredSize in class JComponent
Returns:
the preferred size.

getViewportView

public Component getViewportView()
Gets the view port view.

Returns:
the view port view.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.