public class BasicScrollPaneUI extends ScrollPaneUI implements ScrollPaneConstants
A default L&F implementation of ScrollPaneUI.
Modifier and Type | Class and Description |
---|---|
class |
BasicScrollPaneUI.HSBChangeListener Horizontal scrollbar listener. |
protected class |
BasicScrollPaneUI.MouseWheelHandler MouseWheelHandler is an inner class which implements the MouseWheelListener interface. |
class |
BasicScrollPaneUI.PropertyChangeHandler |
class |
BasicScrollPaneUI.ViewportChangeHandler Listener for viewport events. |
class |
BasicScrollPaneUI.VSBChangeListener Vertical scrollbar listener. |
protected JScrollPane scrollpane
protected ChangeListener vsbChangeListener
protected ChangeListener hsbChangeListener
protected ChangeListener viewportChangeListener
protected PropertyChangeListener spPropertyChangeListener
public BasicScrollPaneUI()
public static ComponentUI createUI(JComponent x)
public void paint(Graphics g, JComponent c)
Description copied from class: ComponentUI
Paints the specified component appropriately for the look and feel. This method is invoked from the ComponentUI.update
method when the specified component is being painted. Subclasses should override this method and use the specified Graphics
object to render the content of the component.
paint
in class ComponentUI
g
- the Graphics
context in which to paintc
- the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple componentsComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
Description copied from class: ComponentUI
Returns the specified component's maximum size appropriate for the look and feel. If null
is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize
and returns that value.
getMaximumSize
in class ComponentUI
c
- the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple componentsJComponent.getMaximumSize()
, LayoutManager2.maximumLayoutSize(java.awt.Container)
protected void installDefaults(JScrollPane scrollpane)
protected void installListeners(JScrollPane c)
protected void installKeyboardActions(JScrollPane c)
public void installUI(JComponent x)
Description copied from class: ComponentUI
Configures the specified component appropriately for the look and feel. This method is invoked when the ComponentUI
instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:
LayoutManager
on the component if necessary. PropertyChangeListener
on the component in order to detect and respond to component property changes appropriately. installUI
in class ComponentUI
x
- the component where this UI delegate is being installedComponentUI.uninstallUI(javax.swing.JComponent)
, JComponent.setUI(javax.swing.plaf.ComponentUI)
, JComponent.updateUI()
protected void uninstallDefaults(JScrollPane c)
protected void uninstallListeners(JComponent c)
protected void uninstallKeyboardActions(JScrollPane c)
public void uninstallUI(JComponent c)
Description copied from class: ComponentUI
Reverses configuration which was done on the specified component during installUI
. This method is invoked when this UIComponent
instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI
, being careful to leave the JComponent
instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:
uninstallUI
in class ComponentUI
c
- the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple componentsComponentUI.installUI(javax.swing.JComponent)
, JComponent.updateUI()
protected void syncScrollPaneWithViewport()
public int getBaseline(JComponent c, int width, int height)
Returns the baseline.
getBaseline
in class ComponentUI
c
- JComponent
baseline is being requested forwidth
- the width to get the baseline forheight
- the height to get the baseline forNullPointerException
- if c
is null
IllegalArgumentException
- if width or height is < 0JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
Returns an enum indicating how the baseline of the component changes as the size changes.
getBaselineResizeBehavior
in class ComponentUI
c
- JComponent
to return baseline resize behavior forNullPointerException
- if c
is null
JComponent.getBaseline(int, int)
protected ChangeListener createViewportChangeListener()
protected ChangeListener createHSBChangeListener()
protected ChangeListener createVSBChangeListener()
protected MouseWheelListener createMouseWheelListener()
Creates an instance of MouseWheelListener, which is added to the JScrollPane by installUI(). The returned MouseWheelListener is used to handle mouse wheel-driven scrolling.
installUI(javax.swing.JComponent)
, BasicScrollPaneUI.MouseWheelHandler
protected void updateScrollBarDisplayPolicy(PropertyChangeEvent e)
protected void updateViewport(PropertyChangeEvent e)
protected void updateRowHeader(PropertyChangeEvent e)
protected void updateColumnHeader(PropertyChangeEvent e)
protected PropertyChangeListener createPropertyChangeListener()
Creates an instance of PropertyChangeListener that's added to the JScrollPane by installUI(). Subclasses can override this method to return a custom PropertyChangeListener, e.g.
class MyScrollPaneUI extends BasicScrollPaneUI { protected PropertyChangeListener createPropertyChangeListener() { return new MyPropertyChangeListener(); } public class MyPropertyChangeListener extends PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals("viewport")) { // do some extra work when the viewport changes } super.propertyChange(e); } } }
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.