Class JXTaskPane
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,JXCollapsiblePane.CollapsiblePaneContainer
JXTaskPane is a container for tasks and other
arbitrary components.
Several JXTaskPanes are usually grouped together within a
JXTaskPaneContainer. However it is not mandatory
to use a JXTaskPaneContainer as the parent for JXTaskPane. The JXTaskPane can
be added to any other container. See
JXTaskPaneContainer to understand the benefits of
using it as the parent container.
JXTaskPane provides control to expand and
collapse the content area in order to show or hide the task list. It can have an
icon, a title and can be marked as
special. Marking a JXTaskPane as
special (setSpecial(boolean) is only a hint for
the pluggable UI which will usually paint it differently (by example by
using another color for the border of the pane).
When the JXTaskPane is expanded or collapsed, it will be
animated with a fade effect. The animated can be disabled on a per
component basis through setAnimated(boolean).
To disable the animation for all newly created JXTaskPane,
use the UIManager property:
UIManager.put("TaskPane.animate", Boolean.FALSE);.
Example:
JXFrame frame = new JXFrame();
// a container to put all JXTaskPane together
JXTaskPaneContainer taskPaneContainer = new JXTaskPaneContainer();
// create a first taskPane with common actions
JXTaskPane actionPane = new JXTaskPane();
actionPane.setTitle("Files and Folders");
actionPane.setSpecial(true);
// actions can be added, a hyperlink will be created
Action renameSelectedFile = createRenameFileAction();
actionPane.add(renameSelectedFile);
actionPane.add(createDeleteFileAction());
// add this taskPane to the taskPaneContainer
taskPaneContainer.add(actionPane);
// create another taskPane, it will show details of the selected file
JXTaskPane details = new JXTaskPane();
details.setTitle("Details");
// add standard components to the details taskPane
JLabel searchLabel = new JLabel("Search:");
JTextField searchField = new JTextField("");
details.add(searchLabel);
details.add(searchField);
taskPaneContainer.add(details);
// put the action list on the left
frame.add(taskPaneContainer, BorderLayout.EAST);
// and a file browser in the middle
frame.add(fileBrowser, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
- Author:
- Frederic Lavigne, Karl George Schaefer
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUsed when generating PropertyChangeEvents for the "animated" propertystatic final StringUsed when generating PropertyChangeEvents for the "icon" propertystatic final StringUsed when generating PropertyChangeEvents for the "scrollOnExpand" propertystatic final StringUsed when generating PropertyChangeEvents for the "special" propertystatic final StringUsed when generating PropertyChangeEvents for the "title" propertystatic final StringJXTaskPane pluggable UI key swingx/TaskPaneUIFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new emptyJXTaskPane.JXTaskPane(String title) Creates a new task pane with the specified title.JXTaskPane(String title, Icon icon) Creates a new task pane with the specified title and icon.JXTaskPane(Icon icon) Creates a new task pane with the specified icon. -
Method Summary
Modifier and TypeMethodDescriptionAdds an action to thisJXTaskPane.protected voidOverridden to redirect call to the content pane.Returns the contentPane object for this JXTaskPane.intgetIcon()Returns the icon currently displayed in the border of this pane.intgetTitle()Returns the title currently displayed in the border of this pane.Returns the name of the Linvalid input: '&F' class that renders this component.booleanReturns true if this task pane is animated during expand/collapse transition.booleanReturns the collapsed state of this task pane.booleanShould this group scroll to be visible after this group was expanded.booleanReturns true if this pane is "special".protected Stringvoidremove(int index) Overridden to redirect call to the content pane.voidOverridden to redirect call to the content panevoidOverridden to redirect call to the content pane.voidsetAnimated(boolean animated) Enables or disables animation during expand/collapse transition.voidsetCollapsed(boolean collapsed) Expands or collapses this group.voidsetDisplayedMnemonicIndex(int index) voidSets the icon to be displayed in the border of this pane.voidsetLayout(LayoutManager mgr) Overridden to redirect call to the content pane.voidsetMnemonic(int mnemonic) voidsetScrollOnExpand(boolean scrollOnExpand) Should this group be scrolled to be visible on expand.voidsetSpecial(boolean special) Sets this pane to be "special" or not.voidSets the title to be displayed in the border of this pane.voidsetUI(TaskPaneUI ui) Sets the Linvalid input: '&F' object that renders this component.voidupdateUI()Notification from theUIManagerthat the Linvalid input: '&F' has changed.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, setUIMethods 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeMethods 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
uiClassID
JXTaskPane pluggable UI key swingx/TaskPaneUI- See Also:
-
SCROLL_ON_EXPAND_CHANGED_KEY
Used when generating PropertyChangeEvents for the "scrollOnExpand" property- See Also:
-
TITLE_CHANGED_KEY
Used when generating PropertyChangeEvents for the "title" property- See Also:
-
ICON_CHANGED_KEY
Used when generating PropertyChangeEvents for the "icon" property- See Also:
-
SPECIAL_CHANGED_KEY
Used when generating PropertyChangeEvents for the "special" property- See Also:
-
ANIMATED_CHANGED_KEY
Used when generating PropertyChangeEvents for the "animated" property- See Also:
-
-
Constructor Details
-
JXTaskPane
public JXTaskPane()Creates a new emptyJXTaskPane. -
JXTaskPane
Creates a new task pane with the specified title.- Parameters:
title- the title to use
-
JXTaskPane
Creates a new task pane with the specified icon.- Parameters:
icon- the icon to use
-
JXTaskPane
Creates a new task pane with the specified title and icon.- Parameters:
title- the title to useicon- the icon to use
-
-
Method Details
-
getContentPane
Returns the contentPane object for this JXTaskPane.- Returns:
- the contentPane property
-
updateUI
public void updateUI()Notification from theUIManagerthat the Linvalid input: '&F' has changed. Replaces the current UI object with the latest version from theUIManager. -
setUI
Sets the Linvalid input: '&F' object that renders this component.- Parameters:
ui- theTaskPaneUILinvalid input: '&F' object- See Also:
-
getUIClassID
Returns the name of the Linvalid input: '&F' class that renders this component.- Overrides:
getUIClassIDin classJPanel- Returns:
- the string
uiClassID - See Also:
-
getTitle
Returns the title currently displayed in the border of this pane.- Returns:
- the title currently displayed in the border of this pane
-
setTitle
Sets the title to be displayed in the border of this pane.- Parameters:
title- the title to be displayed in the border of this pane
-
getIcon
Returns the icon currently displayed in the border of this pane.- Returns:
- the icon currently displayed in the border of this pane
-
setIcon
Sets the icon to be displayed in the border of this pane. Some pluggable UIs may impose size constraints for the icon. A size of 16x16 pixels is the recommended icon size.- Parameters:
icon- the icon to be displayed in the border of this pane
-
isSpecial
public boolean isSpecial()Returns true if this pane is "special".- Returns:
- true if this pane is "special"
- See Also:
-
setSpecial
public void setSpecial(boolean special) Sets this pane to be "special" or not. Marking aJXTaskPaneasspecialis only a hint for the pluggable UI which will usually paint it differently (by example by using another color for the border of the pane).Usually the first JXTaskPane in a JXTaskPaneContainer is marked as special because it contains the default set of actions which can be executed given the current context.
- Parameters:
special- true if this pane is "special", false otherwise
-
setScrollOnExpand
public void setScrollOnExpand(boolean scrollOnExpand) Should this group be scrolled to be visible on expand.- Parameters:
scrollOnExpand- true to scroll this group to be visible if this group is expanded.- See Also:
-
isScrollOnExpand
public boolean isScrollOnExpand()Should this group scroll to be visible after this group was expanded.- Returns:
- true if we should scroll false if nothing should be done.
-
setCollapsed
public void setCollapsed(boolean collapsed) Expands or collapses this group.As of SwingX 1.6.3, the property change event only fires when the state is accurate. As such, animated task panes fire once the animation is complete.
- Parameters:
collapsed- true to collapse the group, false to expand it
-
isCollapsed
public boolean isCollapsed()Returns the collapsed state of this task pane.- Returns:
trueif the task pane is collapsed;falseotherwise
-
setAnimated
public void setAnimated(boolean animated) Enables or disables animation during expand/collapse transition.- Parameters:
animated-
-
isAnimated
public boolean isAnimated()Returns true if this task pane is animated during expand/collapse transition.- Returns:
- true if this task pane is animated during expand/collapse transition.
-
getMnemonic
public int getMnemonic()If the character defined by the mnemonic is found within the task pane's text string, the first occurrence of it will be underlined to indicate the mnemonic to the user.
-
setMnemonic
public void setMnemonic(int mnemonic) -
getDisplayedMnemonicIndex
public int getDisplayedMnemonicIndex() -
setDisplayedMnemonicIndex
- Throws:
IllegalArgumentException
-
add
Adds an action to thisJXTaskPane. Returns a component built from the action. The returned component has been added to theJXTaskPane.- Parameters:
action-- Returns:
- a component built from the action
-
getValidatingContainer
- Specified by:
getValidatingContainerin interfaceJXCollapsiblePane.CollapsiblePaneContainer- See Also:
-
addImpl
Overridden to redirect call to the content pane. -
setLayout
Overridden to redirect call to the content pane. -
remove
Overridden to redirect call to the content pane -
remove
public void remove(int index) Overridden to redirect call to the content pane. -
removeAll
public void removeAll()Overridden to redirect call to the content pane. -
paramString
- Overrides:
paramStringin classJPanel- See Also:
-