- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.jorigin.gui.thumbnail.JThumbnail<T>
-
- Type Parameters:
T- the type of the object displayed within the thumbnail.
- All Implemented Interfaces:
MouseListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible
- Direct Known Subclasses:
JThumbnailImage
public class JThumbnail<T> extends JPanel implements EventListener, MouseListener
A SWING component that is dedicated to the display of a thumbnail.- Since:
- 1.0.8
- Version:
- 1.0.8
- Author:
- Julien Seinturier
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 Modifier and Type Field Description protected Tcontentprotected ColorcurrentBgColorprotected BordercurrentBorderprotected ColorfocusBgColorprotected booleanfocusedprotected BorderfocusedBorderprotected ColoridColorprotected FontidFontprotected EventListenerListidListenerListListe des ecouteurs informes des evenements du labelprotected booleanidVisibleIs the numerical identifier of the thumbnail has to be visible.
By default this value is set totrue.protected booleanmarkedprotected ColormarkedBgColorprotected Stringnameprotected JLabelnameLBprotected StringnameOrientationWhere the name of the label has to be visible.protected booleannameVisibleIs the name of the thumbnail have to be visible.
By default this value is set totrue.protected booleanselectedprotected ColorselectedBgColorprotected booleanstandardprotected ColorstandardBgColorprotected JComponentthumbnailComponentprotected intthumbnailIDprotected intthumbnailMarginprotected JPanelthumbnailPNThepaneldedicated to thumbnail content display.-
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
-
Fields inherited from class java.awt.Component
accessibleContext, 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
Constructors Constructor Description JThumbnail(String name, int width, int height, int margin, int ID)Create a new thumbnail.JThumbnail(String name, T content, JComponent component, int width, int height, int margin, int labelID)Create a new thumbnail that display the given component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddThumbnailListener(JThumbnailListener<T> l)Add an Active Label Listener to this Active Labelprotected voidfireThumbnailActivated(JThumbnail<T> thumbnail)protected voidfireThumbnailFocused(JThumbnail<T> thumbnail)protected voidfireThumbnailSelected()protected voidfireThumbnailSelected(JThumbnail<T> thumbnail)protected voidfireThumbnailUnfocused(JThumbnail<T> thumbnail)TgetContent()Get the content that is displayed within this thumbnail.intgetID()Get the identifier of the thumbnail.StringgetName()StringgetNameOrientation()Get the orientation of the thumbnail name.booleanisFocused()Set if the thumbnail is focused.booleanisIdVisible()Get if the thumbnail numerical identifier is visible.booleanisMarked()Get if the thumbnail is marked.booleanisNameVisible()Get if the thumbnail name is visible.booleanisSelected()Get if the thumbnail is selected.booleanisStandard()Get if the thumbnail is standard.protected voidlabelActivated()voidmouseClicked(MouseEvent e)mouseClickedvoidmouseEntered(MouseEvent e)mouseEnteredvoidmouseExited(MouseEvent e)mouseExitedvoidmousePressed(MouseEvent e)mousePressedvoidmouseReleased(MouseEvent e)mouseReleasedvoidpaint(Graphics g)protected voidprocessComponentMouseEvent(MouseEvent e)Processin embed component mouse event.protected voidprocessLabelMouseEvent(MouseEvent e)voidrefresh()Refresh the graphical components of the thumbnail.protected voidrefreshGUI()voidremoveThumbnailListener(JThumbnailListener<T> l)Remove an Active Label Listener from this Active LabelvoidsetContent(T content)Set the content that is displayed within this thumbnail.voidsetFocused(boolean b)Get if the thumbnail is focused.voidsetIdFont(Font f)Set thefontto use for the thumbnail identifier display.voidsetIdVisible(boolean visible)Set if the thumbnail numerical identifier has to be visible.voidsetMarked(boolean b)Set if the thumbnail is marked.voidsetName(String n)voidsetNameOrientation(String nameOrientation)Set the orientation of the thumbnail name.voidsetNameVisible(boolean nameVisible)Set if the thumbnail name has to be visible.voidsetSelected(boolean b)Set if the thumbnail is selected.voidsetStandard(boolean b)Set if the thumbnail is standard.voidvalidate()-
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, 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, 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, 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, transferFocusDownCycle, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
nameLB
protected JLabel nameLB
-
thumbnailMargin
protected int thumbnailMargin
-
idFont
protected Font idFont
-
idColor
protected Color idColor
-
standardBgColor
protected Color standardBgColor
-
focusBgColor
protected Color focusBgColor
-
selectedBgColor
protected Color selectedBgColor
-
markedBgColor
protected Color markedBgColor
-
focusedBorder
protected Border focusedBorder
-
currentBorder
protected Border currentBorder
-
currentBgColor
protected Color currentBgColor
-
standard
protected boolean standard
-
focused
protected boolean focused
-
selected
protected boolean selected
-
marked
protected boolean marked
-
thumbnailID
protected int thumbnailID
-
name
protected String name
-
content
protected T content
-
thumbnailComponent
protected JComponent thumbnailComponent
-
idListenerList
protected EventListenerList idListenerList
Liste des ecouteurs informes des evenements du label
-
nameVisible
protected boolean nameVisible
Is the name of the thumbnail have to be visible.
By default this value is set totrue.
-
nameOrientation
protected String nameOrientation
Where the name of the label has to be visible. Possible values can be: by default this value is set toBorderLayout.SOUTH.
-
idVisible
protected boolean idVisible
Is the numerical identifier of the thumbnail has to be visible.
By default this value is set totrue.
-
-
Constructor Detail
-
JThumbnail
public JThumbnail(String name, int width, int height, int margin, int ID)
Create a new thumbnail.- Parameters:
name- the name of the thumbnail.width- the width of the thumbnail.height- the height of the thumbnail.margin- the margin size of the thumbnail.ID- the identifier of the thumbnail.
-
JThumbnail
public JThumbnail(String name, T content, JComponent component, int width, int height, int margin, int labelID)
Create a new thumbnail that display the given component.- Parameters:
name- the name of the thumbnail.content- the content of the thumbnail.component- the component to use as display.width- the width of the thumbnail.height- the height of the thumbnail.margin- the margin size of the thumbnail.labelID- the identifier of the thumbnail.
-
-
Method Detail
-
setStandard
public void setStandard(boolean b)
Set if the thumbnail is standard.- Parameters:
b-trueif the thumbnail is standard andfalseotherwise.- See Also:
isStandard()
-
isStandard
public boolean isStandard()
Get if the thumbnail is standard.- Returns:
trueif the thumbnail is standard andfalseotherwise.- See Also:
setStandard(boolean)
-
setMarked
public void setMarked(boolean b)
Set if the thumbnail is marked.- Parameters:
b-trueif the thumbnail is marked andfalseotherwise.- See Also:
isMarked()
-
isMarked
public boolean isMarked()
Get if the thumbnail is marked.- Returns:
trueif the thumbnail is marked andfalseotherwise.- See Also:
setMarked(boolean)
-
setFocused
public void setFocused(boolean b)
Get if the thumbnail is focused.- Parameters:
b-trueif the thumbnail is focused andfalseotherwise.- See Also:
isFocused()
-
isFocused
public boolean isFocused()
Set if the thumbnail is focused.- Returns:
trueif the thumbnail is focused andfalseotherwise.- See Also:
setFocused(boolean)
-
setContent
public void setContent(T content)
Set the content that is displayed within this thumbnail.- Parameters:
content- the content that is displayed within this thumbnail.- See Also:
getContent()
-
getContent
public T getContent()
Get the content that is displayed within this thumbnail.- Returns:
- the content that is displayed within this thumbnail.
- See Also:
setContent(Object)
-
getID
public int getID()
Get the identifier of the thumbnail.- Returns:
- the identifier of the thumbnail.
-
setSelected
public void setSelected(boolean b)
Set if the thumbnail is selected.- Parameters:
b-trueif the thumbnail is selected andfalseotherwise.- See Also:
isSelected()
-
isSelected
public boolean isSelected()
Get if the thumbnail is selected.- Returns:
trueif the thumbnail is selected andfalseotherwise.- See Also:
setSelected(boolean)
-
setIdFont
public void setIdFont(Font f)
Set thefontto use for the thumbnail identifier display.- Parameters:
f- the font to use for the thumbnail identifier display.
-
isNameVisible
public boolean isNameVisible()
Get if the thumbnail name is visible.- Returns:
trueif the thumbnail name is visible andfalseotherwise.- See Also:
setNameVisible(boolean),getNameOrientation()
-
setNameVisible
public void setNameVisible(boolean nameVisible)
Set if the thumbnail name has to be visible.- Parameters:
nameVisible-trueif the thumbnail name has to be visible andfalseotherwise.- See Also:
isNameVisible(),setNameOrientation(String)
-
getNameOrientation
public String getNameOrientation()
Get the orientation of the thumbnail name. Possible values can be: by default this value is set toBorderLayout.SOUTH.- Returns:
- the orientation of the thumbnail name.
- See Also:
setNameOrientation(String),isNameVisible()
-
setNameOrientation
public void setNameOrientation(String nameOrientation)
Set the orientation of the thumbnail name. Possible values can be: by default this value is set toBorderLayout.SOUTH.- Parameters:
nameOrientation- the orientation of the thumbnail name.- See Also:
getNameOrientation(),setNameVisible(boolean)
-
isIdVisible
public boolean isIdVisible()
Get if the thumbnail numerical identifier is visible.- Returns:
trueif the thumbnail numerical identifier is visible andfalseotherwise.- See Also:
setIdVisible(boolean)
-
setIdVisible
public void setIdVisible(boolean visible)
Set if the thumbnail numerical identifier has to be visible.- Parameters:
visible-trueif the thumbnail numerical identifier has to be visible andfalseotherwise.- See Also:
isIdVisible()
-
refresh
public void refresh()
Refresh the graphical components of the thumbnail.
-
paint
public void paint(Graphics g)
- Overrides:
paintin classJComponent
-
fireThumbnailFocused
protected void fireThumbnailFocused(JThumbnail<T> thumbnail)
-
fireThumbnailUnfocused
protected void fireThumbnailUnfocused(JThumbnail<T> thumbnail)
-
fireThumbnailSelected
protected void fireThumbnailSelected()
-
fireThumbnailSelected
protected void fireThumbnailSelected(JThumbnail<T> thumbnail)
-
fireThumbnailActivated
protected void fireThumbnailActivated(JThumbnail<T> thumbnail)
-
labelActivated
protected void labelActivated()
-
addThumbnailListener
public void addThumbnailListener(JThumbnailListener<T> l)
Add an Active Label Listener to this Active Label- Parameters:
l- ActiveLabelListener Listener added to the Active Label
-
removeThumbnailListener
public void removeThumbnailListener(JThumbnailListener<T> l)
Remove an Active Label Listener from this Active Label- Parameters:
l- ActiveLabelListener Active Listener to remove
-
mouseClicked
public void mouseClicked(MouseEvent e)
mouseClicked- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseEntered
public void mouseEntered(MouseEvent e)
mouseEntered- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseExited
public void mouseExited(MouseEvent e)
mouseExited- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e- MouseEvent
-
mousePressed
public void mousePressed(MouseEvent e)
mousePressed- Specified by:
mousePressedin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseReleased
public void mouseReleased(MouseEvent e)
mouseReleased- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
e- MouseEvent
-
processLabelMouseEvent
protected void processLabelMouseEvent(MouseEvent e)
-
refreshGUI
protected void refreshGUI()
-
processComponentMouseEvent
protected void processComponentMouseEvent(MouseEvent e)
Processin embed component mouse event.- Parameters:
e- The mouse event fired by embed component
-
-