ComponentListener
, MouseListener
, MouseWheelListener
, ImageObserver
, MenuContainer
, Serializable
, EventListener
, Accessible
public class JCarosel extends GradientPanel implements MouseListener, MouseWheelListener
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Container.AccessibleAWTContainer
JComponent.AccessibleJComponent
JPanel.AccessibleJPanel
Modifier and Type | Field | Description |
---|---|---|
protected int |
DEFAULT_CONTENT_WIDTH |
The prefered width of the components in the container, everything will be
scaled to this width for neutral scaling (1.0)
|
static String |
FRONT_COMPONENT_CHANGE |
The property that is set when a new component comes to the front.
|
protected Component |
lastWheeledTo |
The last component the wheel selected.
|
protected CaroselLayout |
layout |
The layout being used for the carousel
|
protected int |
spinStartDelay |
Delay in milliseconds from the first click to the start of the spin, this
gives implementors using a double click anywhere to fire an event a
chance for their users to get the double click message before the
component spins around.
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
cache, end, gp, start
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor | Description |
---|---|
JCarosel() |
Creates a new instance of JCarosel
|
JCarosel(int contentWidth) |
Creates a new Carousel specifying the prefered width up front
|
Modifier and Type | Method | Description |
---|---|---|
Component |
add(Component component) |
Adds a component to the carousel
|
Component |
add(Image image,
String text) |
Adds an image to the carousel
|
Component |
add(String imageURL) |
Adds a new image to the carousel
|
Component |
add(String imageURL,
int width,
int height) |
Deprecated.
This function will be removed, use add(String imageURL)
instead.
|
Component |
add(String imageURL,
String textLabel) |
Adds a new image to the carousel
|
Component |
add(String imageURL,
String text,
int width,
int height) |
Deprecated.
This function will be removed, use setNeutralWidth() on
JCarousel instead.
|
void |
bringToFront(Component component) |
Brings the specified component to the front of the carousel
|
void |
finalizeLayoutImmediately() |
Moves everything to their final positions
|
Component |
getFrontmost() |
Which component is at the front
|
int |
getSpinStartDelay() |
Returns the spin start delay
|
Component |
insertAt(int i,
String imageURL,
int width,
int height) |
Inserts a new object at a specific location
|
Component |
insertAt(int i,
String imageURL,
String text,
int width,
int height) |
Inserts a new object at a specific location
|
void |
insertComponentAt(int i,
Component comp) |
Inserts a component at the specified index
|
void |
mouseClicked(MouseEvent mouseEvent) |
Bring the "clicked" component to the front.
|
void |
mouseEntered(MouseEvent mouseEvent) |
Not interested
|
void |
mouseExited(MouseEvent mouseEvent) |
Not interested
|
void |
mousePressed(MouseEvent mouseEvent) |
Not interested
|
void |
mouseReleased(MouseEvent mouseEvent) |
Not interested
|
void |
mouseWheelMoved(MouseWheelEvent mouseWheelEvent) |
When event received will spin the carousel to select the next object.
|
void |
remove(Component component) |
Removes the component from the carousel
|
void |
setContentWidth(int contentWidth) |
Sets the prefered width of the components inside the carousel, this is
the neutral width that will change as the component is scaled, but at 9
and 6 o'clock where the scale is one they will be this width.
|
void |
setDepthBasedAlpha(boolean useDepthBased) |
If set to true the carousel will fade out components as they move away
from the front of the carousel (6 o'clock)
|
void |
setLayout(CaroselLayout layout) |
Specifies which type of CarouselLayout to be used to lay the component
out around the carousel Any looping layout can be used.
|
void |
setSpinStartDelay(int spinStartDelay) |
Sets the delay between clicking on a component in the carousel, and the
spin starting to move that component to the front.
|
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
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
componentHidden, componentMoved, componentResized, componentShown, paintComponent, setBackground, setBackground
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, 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
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
public static final String FRONT_COMPONENT_CHANGE
protected CaroselLayout layout
protected Component lastWheeledTo
protected int DEFAULT_CONTENT_WIDTH
protected int spinStartDelay
public JCarosel()
public JCarosel(int contentWidth)
contentWidth
- The prefered width of component at neutral scale (3 or 9
o'clock)public void setContentWidth(int contentWidth)
contentWidth
- The prefered width.public void setDepthBasedAlpha(boolean useDepthBased)
useDepthBased
- True to fade components as they move to the back, false to not
do itpublic void setLayout(CaroselLayout layout)
layout
- The carousel layout to usepublic Component add(Image image, String text)
image
- The image to addtext
- The text labelpublic void remove(Component component)
public Component add(String imageURL, int width, int height)
imageURL
- The URLwidth
- The desired rendering widthheight
- The desired rendering heightpublic Component add(String imageURL, String text, int width, int height)
imageURL
- The image URLtext
- The text labelwidth
- The widthheight
- The heightpublic void bringToFront(Component component)
component
- The component to bring to the frontpublic Component getFrontmost()
public void mouseClicked(MouseEvent mouseEvent)
mouseClicked
in interface MouseListener
mouseEvent
- Brings the component clicked on by the mouse to the frontpublic void setSpinStartDelay(int spinStartDelay)
spinStartDelay
- public int getSpinStartDelay()
public void insertComponentAt(int i, Component comp)
i
- The indexcomp
- The componentpublic Component insertAt(int i, String imageURL, int width, int height)
i
- The position on the carouselimageURL
- The URL of the imagewidth
- The width of the imageheight
- The height of the imagepublic Component insertAt(int i, String imageURL, String text, int width, int height)
i
- The position on the carouselimageURL
- The URL of the imagetext
- The text labelwidth
- The prefered width of the imageheight
- The prefered height of the imagepublic void finalizeLayoutImmediately()
public void mousePressed(MouseEvent mouseEvent)
mousePressed
in interface MouseListener
mouseEvent
- Ignoredpublic void mouseReleased(MouseEvent mouseEvent)
mouseReleased
in interface MouseListener
mouseEvent
- Ignoredpublic void mouseEntered(MouseEvent mouseEvent)
mouseEntered
in interface MouseListener
mouseEvent
- Ignoredpublic void mouseExited(MouseEvent mouseEvent)
mouseExited
in interface MouseListener
mouseEvent
- Ignoredpublic void mouseWheelMoved(MouseWheelEvent mouseWheelEvent)
mouseWheelMoved
in interface MouseWheelListener
mouseWheelEvent
- The event objectpublic Component add(String imageURL)
imageURL
- The image