JIDE 3.5.15

com.jidesoft.status
Class ResizeStatusBarItem

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.swing.NullPanel
                      extended by com.jidesoft.status.StatusBarItem
                          extended by com.jidesoft.status.LabelStatusBarItem
                              extended by com.jidesoft.status.ResizeStatusBarItem
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ResizeStatusBarItem
extends LabelStatusBarItem

A status bar item which can be used as resizable corner. You should always add it as the last status bar item on status bar as it will serve as a resizable target which user can drag it to resize the top level window. You probably shouldn't use it if the status bar is not used at the bottom of the top level window because it doesn't make sense to have a resizable target which is not at the bottom-right corner of the resizable window.

Please note, if user uses ResizeStatusBarItem to resize the top level window, the resizing operation is not done via native code any more. So it flickers a lot on any JDK before JDK1.6 because of missing the double buffering feature. To make it feels better, we added a method setStopRepaintDuringResizing(boolean). If set to true, repaint event will be blocked, thus you won't see any flickerings. However, the content of the window is not shown either during resizing. There is better than flickering but still not as good as resizing using window's resize border. We just couldn't find a better way to do it yet. By default, we set it false if JDK is 1.6 and above, and true otherwise. Since JDK1.6 has the double buffer which reduces flickering a lot during resizing, it actually feels better when set to false.

See Also:
Serialized Form

Nested Class Summary
 class ResizeStatusBarItem.ResizableMouseInputAdapter
          Mouse input listenr to control the resizing of Resizable component.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
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.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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ResizeStatusBarItem()
          Creates a resize status bar item.
ResizeStatusBarItem(boolean resizeTopLevelAncestor)
          Creates a resize status bar item.
ResizeStatusBarItem(String name)
          Creates a resize status bar item.
ResizeStatusBarItem(String name, boolean resizeTopLevelAncestor)
           
 
Method Summary
protected  void configureLabel(JLabel label)
          Configures the label.
protected  JLabel createLabel()
          Creates the label component used by LabelStatusBarItem.
protected  boolean isResizable()
          Checks if the status bar item should show resizable corner.
 void setStopRepaintDuringResizing(boolean stopRepaintDuringResizing)
          Sets to true if you want to stop repaint event during resizing.
 
Methods inherited from class com.jidesoft.status.LabelStatusBarItem
addMouseListener, getComponent, getHorizontalAlignment, getIcon, getItemName, getPreferredSize, getText, getToolTipLocation, getToolTipText, setAlignment, setEnabled, setHorizontalAlignment, setIcon, setText, setToolTip, setToolTipText
 
Methods inherited from class com.jidesoft.status.StatusBarItem
getPreferredWidth, setPreferredWidth, updateUI
 
Methods inherited from class com.jidesoft.swing.NullPanel
setBackground, setFont, setForeground
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, 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, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, setComponentOrientation, 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

ResizeStatusBarItem

public ResizeStatusBarItem()
Creates a resize status bar item. By default, it will be able to resize top level ancestor.


ResizeStatusBarItem

public ResizeStatusBarItem(String name)
Creates a resize status bar item. By default, it will be able to resize top level ancestor.

Parameters:
name - the name of this status bar item.

ResizeStatusBarItem

public ResizeStatusBarItem(boolean resizeTopLevelAncestor)
Creates a resize status bar item.

Parameters:
resizeTopLevelAncestor - if true, pressing on the component and dragging will resize the top level ancestor.

ResizeStatusBarItem

public ResizeStatusBarItem(String name,
                           boolean resizeTopLevelAncestor)
Parameters:
name - the name of this status bar item.
resizeTopLevelAncestor - If true, pressing on the component and dragging will resize the top level ancestor. If false, this component is simply an indicator to indicate top level ancestor is resizable. User still needs to press and drag and border of top level ancestor to resize.
Method Detail

createLabel

protected JLabel createLabel()
Creates the label component used by LabelStatusBarItem.

Overrides:
createLabel in class LabelStatusBarItem
Returns:
the label.

configureLabel

protected void configureLabel(JLabel label)
Description copied from class: LabelStatusBarItem
Configures the label.

Overrides:
configureLabel in class LabelStatusBarItem

isResizable

protected boolean isResizable()
Checks if the status bar item should show resizable corner. Subclass can override this method to return different value.

The default implementation is: It will get the top level ancestor. If it is an instance of Frame, it will return true only when Frame.getExtendedState() return Frame.NORMAL. If the top level ancestor is not a Frame, it will always return true as there isn't enough information to determine it is resizable or not.

Returns:
true if the resizable corner is shown.

setStopRepaintDuringResizing

public void setStopRepaintDuringResizing(boolean stopRepaintDuringResizing)
Sets to true if you want to stop repaint event during resizing. This will make resizing looks better. However it is still not as good as the resizing by dragging the window border. We just haven't found a better way to do it.

By default, we set it false if JDK is 1.6 and above, and true otherwise. Since JDK1.6 has the double buffer which reduces flickering a lot during resizing, it actually feels better when set to false. If you are on JDK1.5 and less, it'd better to set to true.

Parameters:
stopRepaintDuringResizing -

JIDE 3.5.15