- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.jorigin.swing.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.14" - b202111241200L
- Author:
- Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
- 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 TcontentThe thumbnail underlying content.protected ColorcurrentBgColorThe thumbnail current background colorprotected BordercurrentBorderThe thumbnail current borderprotected ColorfocusBgColorThe thumbnail focused background colorprotected booleanfocusedIs the label is in focused state.protected BorderfocusedBorderThe thumbnail focused borderprotected ColoridColorThe thumbnail identifier font colorprotected FontidFontThe thumbnail identifier fontprotected 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 booleanmarkedIs the label is in marked state.protected ColormarkedBgColorThe thumbnail marked background colorprotected StringnameThe thumbnail name.protected JLabelnameLBThe thumbnail name labelprotected 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 booleanselectedIs the label is in selected state.protected ColorselectedBgColorThe thumbnail activated background colorprotected booleanstandardIs the label is in standard state.protected ColorstandardBgColorThe thumbnail standard background colorprotected JComponentthumbnailComponentThe thumbnail displayed component.protected intthumbnailIDThe thumbnail numerical identifier.protected intthumbnailMarginThe thumbnail marginprotected 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)Fire a thumbnail activated event.protected voidfireThumbnailFocused(JThumbnail<T> thumbnail)Fire a thumbnail focused event.protected voidfireThumbnailSelected()Fire a thumbnail selected event.protected voidfireThumbnailSelected(JThumbnail<T> thumbnail)Fire a thumbnail selected event.protected voidfireThumbnailUnfocused(JThumbnail<T> thumbnail)Fire a thumbnail unfocused event.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()Fire a label activated event.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)Process a mouse event that occurred on the label.voidrefresh()Refresh the graphical components of the thumbnail.protected voidrefreshGUI()Refresh the Graphical User Interface (GUI) components.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
The thumbnail name label
-
thumbnailMargin
protected int thumbnailMargin
The thumbnail margin
-
idFont
protected Font idFont
The thumbnail identifier font
-
idColor
protected Color idColor
The thumbnail identifier font color
-
standardBgColor
protected Color standardBgColor
The thumbnail standard background color
-
focusBgColor
protected Color focusBgColor
The thumbnail focused background color
-
selectedBgColor
protected Color selectedBgColor
The thumbnail activated background color
-
markedBgColor
protected Color markedBgColor
The thumbnail marked background color
-
focusedBorder
protected Border focusedBorder
The thumbnail focused border
-
currentBorder
protected Border currentBorder
The thumbnail current border
-
currentBgColor
protected Color currentBgColor
The thumbnail current background color
-
standard
protected boolean standard
Is the label is in standard state.
-
focused
protected boolean focused
Is the label is in focused state.
-
selected
protected boolean selected
Is the label is in selected state.
-
marked
protected boolean marked
Is the label is in marked state.
-
thumbnailID
protected int thumbnailID
The thumbnail numerical identifier.
-
name
protected String name
The thumbnail name.
-
content
protected T content
The thumbnail underlying content.
-
thumbnailComponent
protected JComponent thumbnailComponent
The thumbnail displayed component.
-
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)
Fire a thumbnail focused event.- Parameters:
thumbnail- the thumbnail that has raised the event.
-
fireThumbnailUnfocused
protected void fireThumbnailUnfocused(JThumbnail<T> thumbnail)
Fire a thumbnail unfocused event.- Parameters:
thumbnail- the thumbnail that has raised the event.
-
fireThumbnailSelected
protected void fireThumbnailSelected()
Fire a thumbnail selected event.
-
fireThumbnailSelected
protected void fireThumbnailSelected(JThumbnail<T> thumbnail)
Fire a thumbnail selected event.- Parameters:
thumbnail- the thumbnail that has raised the event.
-
fireThumbnailActivated
protected void fireThumbnailActivated(JThumbnail<T> thumbnail)
Fire a thumbnail activated event.- Parameters:
thumbnail- the thumbnail that has raised the event.
-
labelActivated
protected void labelActivated()
Fire a label activated event.
-
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)
Process a mouse event that occurred on the label.- Parameters:
e- the underlying mouse event
-
refreshGUI
protected void refreshGUI()
Refresh the Graphical User Interface (GUI) components.
-
processComponentMouseEvent
protected void processComponentMouseEvent(MouseEvent e)
Processin embed component mouse event.- Parameters:
e- The mouse event fired by embed component
-
-