|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
contrib.com.blogofbug.swing.components.GradientPanel
contrib.com.blogofbug.swing.components.JCarouselMenu
public class JCarouselMenu
Shows a carousel offset to the left with a menu of actions on the right.
| Nested Class Summary | |
|---|---|
protected class |
JCarouselMenu.CarouselListCellRenderer
ListCellRenderer for the Carousel uses an image border to draw a nice border around the menu item when it is selected |
class |
JCarouselMenu.MenuItem
A menu item inside the carousel |
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class contrib.com.blogofbug.swing.components.GradientPanel |
|---|
cache, end, gp, start |
| 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 | |
|---|---|
JCarouselMenu()
Creates a new instance |
|
JCarouselMenu(ImageBorder border)
Creates a new instance of JCarouselMenu |
|
| Method Summary | |
|---|---|
java.awt.Component |
add(javax.swing.Action action)
Adds an action to the list, creating a menu item and a carousel entry |
java.awt.Component |
add(javax.swing.Action action,
int width,
int height)
Deprecated. Use add(imageURL) instead |
java.awt.Component |
add(java.awt.Component component,
java.lang.String label)
Adds a component to the carousel menu that will be brought into view when the user clicks on the associated item |
java.awt.Component |
add(java.awt.Image image,
java.lang.String label)
Adds an image (with a label) and returns the component created to represent them |
java.awt.Component |
add(java.awt.Image image,
java.lang.String label,
int width,
int height)
Deprecated. Use add(Image, String) instead |
java.awt.Component |
add(java.lang.String imageURL,
java.lang.String label)
Adds an image based on the imageURL and a text label, returning the component that is created as a result |
java.awt.Component |
add(java.lang.String imageURL,
java.lang.String label,
int width,
int height)
Deprecated. Use add(imageURL, label) instead |
javax.swing.JList |
getList()
Returns the list part of the carousel menu |
java.awt.Dimension |
getPreferredSize()
Return the preferred size of the component |
void |
keyPressed(java.awt.event.KeyEvent keyEvent)
Listen for key events, when we see one that looks like it should wrap, set up the lastSelection variable to trigger a change on release of the key |
void |
keyReleased(java.awt.event.KeyEvent keyEvent)
If the wrap-around has detected the need to wrap, sets the selection to the value calculated when the key was first pressed. |
void |
keyTyped(java.awt.event.KeyEvent keyEvent)
Don't Care * |
void |
mouseClicked(java.awt.event.MouseEvent mouseEvent)
Look to see if an item in the list is double clicked, and launch the action if it is |
void |
mouseEntered(java.awt.event.MouseEvent mouseEvent)
Don't Care * |
void |
mouseExited(java.awt.event.MouseEvent mouseEvent)
Don't Care * |
void |
mousePressed(java.awt.event.MouseEvent mouseEvent)
Don't Care * |
void |
mouseReleased(java.awt.event.MouseEvent mouseEvent)
Don't Care * |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent mouseWheelEvent)
Moves the selected menu up or down when the mouse wheel scrolls |
protected void |
processAction()
Launch the action associated with the currently selected list item |
void |
remove(java.awt.Component component)
Removes a component from the menu |
void |
setCellImageBorder(ImageBorder imageBorder)
Sets the image border used to draw around the items in the menu |
void |
setCellRenderer(javax.swing.ListCellRenderer cellRenderer)
Specifies the list cell renderer used to draw the items in the menu |
void |
setMenuScrollColor(java.awt.Color color)
Allows the background color to the menu (left side) to be set |
void |
setSelectedIndex(int i)
Sets the selected item in the menu |
void |
setUpDownColor(java.awt.Color color)
Sets the color the up and down buttons are drawn |
void |
setUpDownIcons(javax.swing.Icon upIcon,
javax.swing.Icon downIcon)
Sets icons to use to show the up and down buttons |
void |
stateChanged(javax.swing.event.ChangeEvent e)
Detect when the list selection changes, and respond by updating the state of the two "arrow" buttons. |
void |
valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
Detect when the list selection changes, and respond by rotating the carousel to show that item |
| Methods inherited from class contrib.com.blogofbug.swing.components.GradientPanel |
|---|
componentHidden, componentMoved, componentResized, componentShown, paintComponent, setBackground, setBackground |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| 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, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, 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, 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, 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, transferFocusBackward, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JCarouselMenu(ImageBorder border)
border - The border to use to draw items in the menupublic JCarouselMenu()
| Method Detail |
|---|
public void setUpDownColor(java.awt.Color color)
color - The desired colorpublic javax.swing.JList getList()
public void setSelectedIndex(int i)
i - The index of the item to select
public java.awt.Component add(java.awt.Component component,
java.lang.String label)
component - The componentlabel - The text to appear in the menu
public void remove(java.awt.Component component)
remove in class java.awt.Containercomponent - The component to remove
public java.awt.Component add(java.awt.Image image,
java.lang.String label,
int width,
int height)
image - The imagelabel - The textwidth - Prefered widthheight - Prefered height
public java.awt.Component add(java.awt.Image image,
java.lang.String label)
image - The image to displaylabel - The label to show
public java.awt.Component add(javax.swing.Action action,
int width,
int height)
action - The action to addwidth - The widthheight - The height
public java.awt.Component add(javax.swing.Action action)
action - The action to add
public java.awt.Component add(java.lang.String imageURL,
java.lang.String label,
int width,
int height)
imageURL - URL of the imagelabel - Text messagewidth - widthheight - height
public java.awt.Component add(java.lang.String imageURL,
java.lang.String label)
imageURL - The URL of the imagelabel - Text label to be shown in the menu
public java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged in interface javax.swing.event.ChangeListenere - The state changed eventChangeListener.stateChanged(javax.swing.event.ChangeEvent)public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
valueChanged in interface javax.swing.event.ListSelectionListenerlistSelectionEvent - The list selection change eventprotected void processAction()
public void mouseClicked(java.awt.event.MouseEvent mouseEvent)
mouseClicked in interface java.awt.event.MouseListenermouseEvent - The mouse eventpublic void mousePressed(java.awt.event.MouseEvent mouseEvent)
mousePressed in interface java.awt.event.MouseListenermouseEvent - The mouse eventpublic void mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased in interface java.awt.event.MouseListenermouseEvent - The mouse eventpublic void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered in interface java.awt.event.MouseListenermouseEvent - The mouse eventpublic void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited in interface java.awt.event.MouseListenermouseEvent - The mouse eventpublic void keyTyped(java.awt.event.KeyEvent keyEvent)
keyTyped in interface java.awt.event.KeyListenerkeyEvent - The key eventpublic void keyPressed(java.awt.event.KeyEvent keyEvent)
keyPressed in interface java.awt.event.KeyListenerkeyEvent - The key eventpublic void setCellImageBorder(ImageBorder imageBorder)
imageBorder - The desired image borderpublic void setCellRenderer(javax.swing.ListCellRenderer cellRenderer)
cellRenderer - The list cell rendererpublic void keyReleased(java.awt.event.KeyEvent keyEvent)
keyReleased in interface java.awt.event.KeyListenerkeyEvent - The key eventpublic void mouseWheelMoved(java.awt.event.MouseWheelEvent mouseWheelEvent)
mouseWheelMoved in interface java.awt.event.MouseWheelListenermouseWheelEvent - The mouse wheel event
public void setUpDownIcons(javax.swing.Icon upIcon,
javax.swing.Icon downIcon)
upIcon - The icon to use for updownIcon - The icon to use for downpublic void setMenuScrollColor(java.awt.Color color)
color - Sets the background color to the menu
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||