Skip to main content

BookmapScrollPane

Package: velox.gui

Type: Class

Inheritance: java.lang.Object รขโ€ โ€™ java.awt.Component รขโ€ โ€™ java.awt.Container รขโ€ โ€™ javax.swing.JComponent รขโ€ โ€™ javax.swing.JScrollPane รขโ€ โ€™ BookmapScrollPane

All Implemented Interfaces: ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants

Descriptionโ€‹

This is an extension of standard JScrollPane which has the following enhancements:

  1. This version of JScrollPane respects setMaximumSize regardless of layout
  2. It handles vertical scrollbar appearance/disappearance correctly - by default, it will change horizontal size automatically
  3. If compressFromOutside is set it will compress preferred size of inner component from outside automatically (thus making it downsize instead of just staying partially invisible under the scroll panel)
  4. Scrolling speed logic is different and stays the same regardless of content

See Also:

  • Serialized Form

Constructorsโ€‹

BookmapScrollPaneโ€‹

BookmapScrollPane()

BookmapScrollPaneโ€‹

BookmapScrollPane(JComponent view)

BookmapScrollPaneโ€‹

BookmapScrollPane(JComponent view, boolean shouldAddSpaceForScrollbar)

Methodsโ€‹

doLayoutโ€‹

void doLayout()

preferredSizeโ€‹

Dimension preferredSize()

setCompressFromOutsideโ€‹

void setCompressFromOutside(boolean compressFromOutside)

This method sets the value of compressFromOutside flag (see class documentation for the explanation of this flag).

Parameters:

  • compressFromOutside - The compressFromOutside flag value

setPreventSpaceForScrollbarIfShorterThanMaximumHeightโ€‹

void setPreventSpaceForScrollbarIfShorterThanMaximumHeight(boolean preventSpaceForScrollbarIfShorterThanMaximumHeight)

When the BookmapScrollPane is used in a component that resizes itself in response to its children preferred size, we end up in a case when the scroll pane adds some space for the scrollbar, but later receives enough space to show all the contents without the scrollbar.

Parameters:

  • preventSpaceForScrollbarIfShorterThanMaximumHeight - Whether to prevent space for scrollbar when shorter than maximum height

BookmapScrollPane

Package: velox.gui

Type: Class

Inheritance: java.awt.Container รขโ€ โ€™ java.awt.Component รขโ€ โ€™ java.lang.Object

Constructorsโ€‹

BookmapScrollPaneโ€‹

public BookmapScrollPane()

BookmapScrollPaneโ€‹

public BookmapScrollPane(JComponent view)

BookmapScrollPaneโ€‹

public BookmapScrollPane(JComponent view, boolean shouldAddSpaceForScrollbar)

Methodsโ€‹

setCompressFromOutsideโ€‹

public void setCompressFromOutside(boolean compressFromOutside)

This method sets the value of compressFromOutside flag (see class documentation for the explanation of this flag).

Parameters:

  • compressFromOutside - Flag value

setPreventSpaceForScrollbarIfShorterThanMaximumHeightโ€‹

public void setPreventSpaceForScrollbarIfShorterThanMaximumHeight(boolean preventSpaceForScrollbarIfShorterThanMaximumHeight)

When the BookmapScrollPane is used in a component that resizes itself in response to its children preferred size, we end up in a case when the scroll pane adds some space for the scrollbar, but later receives enough space to show all the contents without the scrollbar. But, there is an additional horizontal space added, which messes up the layout.

This flag forbids adding the space for the scrollbar if the scrollpane getPreferredSize().height is less than or equal to its #getMaximumSize().height. By default, maximum size is the size which will show all the scroll pane in screen.

Parameters:

  • preventSpaceForScrollbarIfShorterThanMaximumHeight - Flag value

preferredSizeโ€‹

public Dimension preferredSize()

Overrides: preferredSize in class Container

doLayoutโ€‹

public void doLayout()

Overrides: doLayout in class Container

Methods Inherited from java.awt.Containerโ€‹

  • add(Component)
  • add(Component, int)
  • add(Component, Object)
  • add(Component, Object, int)
  • add(String, Component)
  • addContainerListener(ContainerListener)
  • addImpl(Component, Object, int)
  • addPropertyChangeListener(PropertyChangeListener)
  • addPropertyChangeListener(String, PropertyChangeListener)
  • applyComponentOrientation(ComponentOrientation)
  • areFocusTraversalKeysSet(int)
  • countComponents()
  • deliverEvent(Event)
  • findComponentAt(int, int)
  • findComponentAt(Point)
  • getComponent(int)
  • getComponentAt(int, int)
  • getComponentAt(Point)
  • getComponentCount()
  • getComponents()
  • getComponentZOrder(Component)
  • getContainerListeners()
  • getFocusTraversalKeys(int)
  • getFocusTraversalPolicy()
  • getLayout()
  • getMousePosition(boolean)
  • insets()
  • invalidate()
  • isAncestorOf(Component)
  • isFocusCycleRoot()
  • isFocusCycleRoot(Container)
  • isFocusTraversalPolicyProvider()
  • isFocusTraversalPolicySet()
  • layout()
  • list(PrintStream, int)
  • list(PrintWriter, int)
  • locate(int, int)
  • minimumSize()
  • paintComponents(Graphics)
  • printComponents(Graphics)
  • processContainerEvent(ContainerEvent)
  • processEvent(AWTEvent)
  • remove(int)
  • remove(Component)
  • removeAll()
  • removeContainerListener(ContainerListener)
  • setComponentZOrder(Component, int)
  • setFocusCycleRoot(boolean)
  • setFocusTraversalPolicy(FocusTraversalPolicy)
  • setFocusTraversalPolicyProvider(boolean)
  • transferFocusDownCycle()
  • validate()
  • validateTree()

Methods Inherited from java.awt.Componentโ€‹

  • action(Event, Object)
  • add(PopupMenu)
  • addComponentListener(ComponentListener)
  • addFocusListener(FocusListener)
  • addHierarchyBoundsListener(HierarchyBoundsListener)
  • addHierarchyListener(HierarchyListener)
  • addInputMethodListener(InputMethodListener)
  • addKeyListener(KeyListener)
  • addMouseListener(MouseListener)
  • addMouseMotionListener(MouseMotionListener)
  • addMouseWheelListener(MouseWheelListener)
  • bounds()
  • checkImage(Image, int, int, ImageObserver)
  • checkImage(Image, ImageObserver)
  • coalesceEvents(AWTEvent, AWTEvent)
  • contains(Point)
  • createImage(int, int)
  • createImage(ImageProducer)
  • createVolatileImage(int, int)
  • createVolatileImage(int, int, ImageCapabilities)
  • disableEvents(long)
  • dispatchEvent(AWTEvent)
  • enable(boolean)
  • enableEvents(long)
  • enableInputMethods(boolean)
  • firePropertyChange(String, byte, byte)
  • firePropertyChange(String, double, double)
  • firePropertyChange(String, float, float)
  • firePropertyChange(String, long, long)
  • firePropertyChange(String, short, short)
  • firePropertyChange(String, Object, Object)
  • 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()
  • getPropertyChangeListeners()
  • getPropertyChangeListeners(String)
  • getSize()
  • getToolkit()
  • getTreeLock()
  • gotFocus(Event, Object)
  • handleEvent(Event)
  • hasFocus()
  • imageUpdate(Image, int, int, int, int, int)
  • inside(int, int)
  • isBackgroundSet()
  • isCursorSet()
  • isDisplayable()
  • isEnabled()
  • isFocusable()
  • isFocusOwner()
  • isFocusTraversable()
  • isFontSet()
  • isForegroundSet()
  • isLightweight()
  • isMaximumSizeSet()
  • isMinimumSizeSet()
  • isPreferredSizeSet()
  • isShowing()
  • isValid()
  • isVisible()
  • keyDown(Event, int)
  • keyUp(Event, int)
  • list()
  • list(PrintStream)
  • list(PrintWriter)
  • location()
  • lostFocus(Event, Object)
  • mouseDown(Event, int, int)
  • mouseDrag(Event, int, int)
  • mouseEnter(Event, int, int)
  • mouseExit(Event, int, int)
  • mouseMove(Event, int, int)
  • mouseUp(Event, int, int)
  • move(int, int)
  • nextFocus()
  • paintAll(Graphics)
  • postEvent(Event)
  • prepareImage(Image, int, int, ImageObserver)
  • prepareImage(Image, ImageObserver)
  • processComponentEvent(ComponentEvent)
  • processFocusEvent(FocusEvent)
  • processHierarchyBoundsEvent(HierarchyEvent)
  • processHierarchyEvent(HierarchyEvent)
  • processInputMethodEvent(InputMethodEvent)
  • processMouseWheelEvent(MouseWheelEvent)
  • remove(MenuComponent)
  • removeComponentListener(ComponentListener)
  • removeFocusListener(FocusListener)
  • removeHierarchyBoundsListener(HierarchyBoundsListener)
  • removeHierarchyListener(HierarchyListener)
  • removeInputMethodListener(InputMethodListener)
  • removeKeyListener(KeyListener)
  • removeMouseListener(MouseListener)
  • removeMouseMotionListener(MouseMotionListener)
  • removeMouseWheelListener(MouseWheelListener)
  • removePropertyChangeListener(PropertyChangeListener)
  • removePropertyChangeListener(String, PropertyChangeListener)
  • repaint()
  • repaint(int, int, int, int)
  • repaint(long)
  • requestFocus(boolean, FocusEvent.Cause)
  • requestFocus(FocusEvent.Cause)
  • requestFocusInWindow(FocusEvent.Cause)
  • resize(int, int)
  • resize(Dimension)
  • setBounds(int, int, int, int)
  • setBounds(Rectangle)
  • setCursor(Cursor)
  • setDropTarget(DropTarget)
  • setFocusable(boolean)
  • setFocusTraversalKeysEnabled(boolean)
  • setIgnoreRepaint(boolean)
  • setLocale(Locale)
  • setLocation(int, int)
  • setLocation(Point)
  • setMixingCutoutShape(Shape)
  • setName(String)
  • setSize(int, int)
  • setSize(Dimension)
  • show()
  • show(boolean)
  • size()
  • toString()
  • transferFocus()
  • transferFocusBackward()
  • transferFocusUpCycle()

Methods Inherited from java.lang.Objectโ€‹

  • clone()
  • equals(Object)
  • finalize()
  • getClass()
  • hashCode()
  • notify()
  • notifyAll()
  • wait()
  • wait(long)
  • wait(long, int)