Package com.jidesoft.swing
Class Contour
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- com.jidesoft.swing.Contour
-
- All Implemented Interfaces:
IContour,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable
public class Contour extends javax.swing.JComponent implements IContour
AContouris a lightweight component which only paints the outline of component when dragged. It is also used as a placeholder for some information during dragging. Notes: this class has to be public so that JIDE can use it in different packages, not meant to release to end user as a public API. JIDE will not guarantee the class will remain as it is.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intFULL_OUTLINE_MODEstatic intMIX_OUTLINE_MODEstatic intPARTIAL_OUTLINE_MODE-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()java.awt.ComponentgetAttachedComponent()Gets the attached component of this contour.intgetAttachedSide()Gets the side of the attached component which the contour is attached to.java.awt.ComponentgetGlassPane()intgetOutlineMode()java.awt.ContainergetRelativeContainer()javax.swing.JComponentgetSaveDraggedComponent()Gets saved dragged component before the contour is hidden.intgetSaveMouseModifier()Gets saved mouse modifier before the contour is hidden.intgetSaveX()Gets saved X position of contour before it's hidden.intgetSaveY()Gets saved Y position of contour before it's hidden.intgetTabHeight()Gets tab height.intgetTabSide()Gets the side of the tab.booleanisAllowDocking()Checks if docking is allowed.booleanisChangeCursor()booleanisDoubleBuffered()Returns whether this component should use a buffer to paint.booleanisFloating()Returns true if the contour is in floating mode.booleanisSingle()When you dragged a component, several other components could be dragged.booleanisTabDocking()Returns true if the contour is in tab-dock mode.booleanisVisible()Determines whether this component should be visible when its parent is visible.voidpaint(java.awt.Graphics g)Paint a rectangle or tab-shape usingDOTTED_STROKEwith width ofWIDTH.voidsetAllowDocking(boolean allowDocking)Sets the value of docking.voidsetAttachedComponent(java.awt.Component attachedComponent)Sets the attached components.voidsetAttachedSide(int attachedSide)Sets the side of the attached component which the contour is attached to.voidsetBounds(int x, int y, int width, int height)Overwrite setBounds so that width and height are always even.voidsetBounds(java.awt.Rectangle r)Overwrite setBounds so that width and height are always even.voidsetChangeCursor(boolean changeCursor)voidsetDraggingInformation(javax.swing.JComponent comp, int saveX, int saveY, int saveMouseModifier)Stores information before the contour is hidden.voidsetFloating(boolean floating)Sets the floating mode.voidsetGlassPane(java.awt.Component glassPane)voidsetOutlineMode(int outlineMode)voidsetRelativeContainer(java.awt.Container relativeContainer)voidsetSingle(boolean single)Sets the value of single.voidsetTabDocking(boolean tabDocking)Sets the tab-docking mode.voidsetTabHeight(int tabHeight)Sets the tab height.voidsetTabSide(int tabSide)Sets the side of the tab.voidsetVisible(boolean aFlag)Makes the component visible or invisible.-
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, unregisterKeyboardAction, update, updateUI
-
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, 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, getAccessibleContext, 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, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.jidesoft.swing.IContour
getBounds, isLightweight
-
-
-
-
Field Detail
-
PARTIAL_OUTLINE_MODE
public static final int PARTIAL_OUTLINE_MODE
- See Also:
- Constant Field Values
-
MIX_OUTLINE_MODE
public static final int MIX_OUTLINE_MODE
- See Also:
- Constant Field Values
-
FULL_OUTLINE_MODE
public static final int FULL_OUTLINE_MODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDoubleBuffered
public boolean isDoubleBuffered()
Returns whether this component should use a buffer to paint.- Overrides:
isDoubleBufferedin classjavax.swing.JComponent- Returns:
- true if this component is double buffered, otherwise false
-
paint
public void paint(java.awt.Graphics g)
Paint a rectangle or tab-shape usingDOTTED_STROKEwith width ofWIDTH.- Overrides:
paintin classjavax.swing.JComponent- Parameters:
g-
-
setBounds
public void setBounds(java.awt.Rectangle r)
Overwrite setBounds so that width and height are always even.
-
setBounds
public void setBounds(int x, int y, int width, int height)Overwrite setBounds so that width and height are always even. It looks ugly for either dimension is odd when painting withDOTTED_STROKE
-
getTabHeight
public int getTabHeight()
Gets tab height.- Specified by:
getTabHeightin interfaceIContour- Returns:
- tab height
-
setTabHeight
public void setTabHeight(int tabHeight)
Sets the tab height.- Specified by:
setTabHeightin interfaceIContour- Parameters:
tabHeight-
-
isTabDocking
public boolean isTabDocking()
Returns true if the contour is in tab-dock mode.- Specified by:
isTabDockingin interfaceIContour- Returns:
- true if tab-docking; false otherwise
-
setTabDocking
public void setTabDocking(boolean tabDocking)
Sets the tab-docking mode.- Specified by:
setTabDockingin interfaceIContour- Parameters:
tabDocking- new mode
-
getTabSide
public int getTabSide()
Gets the side of the tab.- Specified by:
getTabSidein interfaceIContour- Returns:
- the side of the tab
-
setTabSide
public void setTabSide(int tabSide)
Sets the side of the tab.- Specified by:
setTabSidein interfaceIContour- Parameters:
tabSide-
-
isFloating
public boolean isFloating()
Returns true if the contour is in floating mode.- Specified by:
isFloatingin interfaceIContour- Returns:
- true if floating; false otherwise
-
setFloating
public void setFloating(boolean floating)
Sets the floating mode.- Specified by:
setFloatingin interfaceIContour- Parameters:
floating- new mode
-
getAttachedComponent
public java.awt.Component getAttachedComponent()
Gets the attached component of this contour.- Specified by:
getAttachedComponentin interfaceIContour- Returns:
- the attached component
-
setAttachedComponent
public void setAttachedComponent(java.awt.Component attachedComponent)
Sets the attached components.- Specified by:
setAttachedComponentin interfaceIContour- Parameters:
attachedComponent- attached component to be set
-
getAttachedSide
public int getAttachedSide()
Gets the side of the attached component which the contour is attached to.- Specified by:
getAttachedSidein interfaceIContour- Returns:
- side the attached side
-
setAttachedSide
public void setAttachedSide(int attachedSide)
Sets the side of the attached component which the contour is attached to.- Specified by:
setAttachedSidein interfaceIContour- Parameters:
attachedSide- the new attached side to be set
-
isSingle
public boolean isSingle()
When you dragged a component, several other components could be dragged. For example, if user drags on title bar of FrameContainer, all components in the FrameContainer are considered as dragged. If user drags on tab, only selected one is dragged.
-
setSingle
public void setSingle(boolean single)
Sets the value of single.
-
isAllowDocking
public boolean isAllowDocking()
Checks if docking is allowed.- Specified by:
isAllowDockingin interfaceIContour- Returns:
trueif docking is allowed;falseotherwise.
-
setAllowDocking
public void setAllowDocking(boolean allowDocking)
Sets the value of docking.- Specified by:
setAllowDockingin interfaceIContour- Parameters:
allowDocking-trueif docking is allowed;falseotherwise.
-
getRelativeContainer
public java.awt.Container getRelativeContainer()
- Specified by:
getRelativeContainerin interfaceIContour
-
setRelativeContainer
public void setRelativeContainer(java.awt.Container relativeContainer)
- Specified by:
setRelativeContainerin interfaceIContour
-
getSaveX
public int getSaveX()
Gets saved X position of contour before it's hidden.
-
getSaveY
public int getSaveY()
Gets saved Y position of contour before it's hidden.
-
getSaveMouseModifier
public int getSaveMouseModifier()
Gets saved mouse modifier before the contour is hidden.- Specified by:
getSaveMouseModifierin interfaceIContour- Returns:
- saved mouse modifier
-
getSaveDraggedComponent
public javax.swing.JComponent getSaveDraggedComponent()
Gets saved dragged component before the contour is hidden.- Specified by:
getSaveDraggedComponentin interfaceIContour- Returns:
- saved dragged component
-
setDraggingInformation
public void setDraggingInformation(javax.swing.JComponent comp, int saveX, int saveY, int saveMouseModifier)Stores information before the contour is hidden. Those information will be used to restore when the contour is set visible again.- Specified by:
setDraggingInformationin interfaceIContour- Parameters:
comp- the dragged componentsaveX- X position of the contoursaveY- Y position of the contoursaveMouseModifier- mouse modifier in the MouseEvent
-
setVisible
public void setVisible(boolean aFlag)
Makes the component visible or invisible. OverridesComponent.setVisible.- Specified by:
setVisiblein interfaceIContour- Overrides:
setVisiblein classjavax.swing.JComponent- Parameters:
aFlag- true to make the component visible; false to make it invisible
-
isVisible
public boolean isVisible()
Determines whether this component should be visible when its parent is visible. Components are initially visible, with the exception of top level components such asFrameobjects.- Specified by:
isVisiblein interfaceIContour- Overrides:
isVisiblein classjava.awt.Component- Returns:
trueif the component is visible,falseotherwise- Since:
- JDK1.0
- See Also:
setVisible(boolean)
-
getOutlineMode
public int getOutlineMode()
-
setOutlineMode
public void setOutlineMode(int outlineMode)
-
getGlassPane
public java.awt.Component getGlassPane()
- Specified by:
getGlassPanein interfaceIContour
-
setGlassPane
public void setGlassPane(java.awt.Component glassPane)
- Specified by:
setGlassPanein interfaceIContour
-
isChangeCursor
public boolean isChangeCursor()
-
setChangeCursor
public void setChangeCursor(boolean changeCursor)
- Specified by:
setChangeCursorin interfaceIContour
-
-