Class JThumbnail<T>

  • Type Parameters:
    T - the type of the object displayed within the thumbnail.
    All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
    Direct Known Subclasses:
    JThumbnailImage

    public class JThumbnail<T>
    extends javax.swing.JPanel
    implements java.util.EventListener, java.awt.event.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

        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 
      Modifier and Type Field Description
      protected T content  
      protected java.awt.Color currentBgColor  
      protected javax.swing.border.Border currentBorder  
      protected java.awt.Color focusBgColor  
      protected boolean focused  
      protected javax.swing.border.Border focusedBorder  
      protected java.awt.Color idColor  
      protected java.awt.Font idFont  
      protected javax.swing.event.EventListenerList idListenerList
      Liste des ecouteurs informes des evenements du label
      protected boolean idVisible
      Is the numerical identifier of the thumbnail has to be visible.
      By default this value is set to true.
      protected boolean marked  
      protected java.awt.Color markedBgColor  
      protected java.lang.String name  
      protected javax.swing.JLabel nameLB  
      protected java.lang.String nameOrientation
      Where the name of the label has to be visible.
      protected boolean nameVisible
      Is the name of the thumbnail have to be visible.
      By default this value is set to true.
      protected boolean selected  
      protected java.awt.Color selectedBgColor  
      protected boolean standard  
      protected java.awt.Color standardBgColor  
      protected javax.swing.JComponent thumbnailComponent  
      protected int thumbnailID  
      protected int thumbnailMargin  
      protected javax.swing.JPanel thumbnailPN
      The panel dedicated 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​(java.lang.String name, int width, int height, int margin, int ID)
      Create a new thumbnail.
      JThumbnail​(java.lang.String name, T content, javax.swing.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
      void addThumbnailListener​(JThumbnailListener<T> l)
      Add an Active Label Listener to this Active Label
      protected void fireThumbnailActivated​(JThumbnail<T> thumbnail)  
      protected void fireThumbnailFocused​(JThumbnail<T> thumbnail)  
      protected void fireThumbnailSelected()  
      protected void fireThumbnailSelected​(JThumbnail<T> thumbnail)  
      protected void fireThumbnailUnfocused​(JThumbnail<T> thumbnail)  
      T getContent()
      Get the content that is displayed within this thumbnail.
      int getID()
      Get the identifier of the thumbnail.
      java.lang.String getName()  
      java.lang.String getNameOrientation()
      Get the orientation of the thumbnail name.
      boolean isFocused()
      Set if the thumbnail is focused.
      boolean isIdVisible()
      Get if the thumbnail numerical identifier is visible.
      boolean isMarked()
      Get if the thumbnail is marked.
      boolean isNameVisible()
      Get if the thumbnail name is visible.
      boolean isSelected()
      Get if the thumbnail is selected.
      boolean isStandard()
      Get if the thumbnail is standard.
      protected void labelActivated()  
      void mouseClicked​(java.awt.event.MouseEvent e)
      mouseClicked
      void mouseEntered​(java.awt.event.MouseEvent e)
      mouseEntered
      void mouseExited​(java.awt.event.MouseEvent e)
      mouseExited
      void mousePressed​(java.awt.event.MouseEvent e)
      mousePressed
      void mouseReleased​(java.awt.event.MouseEvent e)
      mouseReleased
      void paint​(java.awt.Graphics g)  
      protected void processComponentMouseEvent​(java.awt.event.MouseEvent e)
      Processin embed component mouse event.
      protected void processLabelMouseEvent​(java.awt.event.MouseEvent e)  
      void refresh()
      Refresh the graphical components of the thumbnail.
      protected void refreshGUI()  
      void removeThumbnailListener​(JThumbnailListener<T> l)
      Remove an Active Label Listener from this Active Label
      void setContent​(T content)
      Set the content that is displayed within this thumbnail.
      void setFocused​(boolean b)
      Get if the thumbnail is focused.
      void setIdFont​(java.awt.Font f)
      Set the font to use for the thumbnail identifier display.
      void setIdVisible​(boolean visible)
      Set if the thumbnail numerical identifier has to be visible.
      void setMarked​(boolean b)
      Set if the thumbnail is marked.
      void setName​(java.lang.String n)  
      void setNameOrientation​(java.lang.String nameOrientation)
      Set the orientation of the thumbnail name.
      void setNameVisible​(boolean nameVisible)
      Set if the thumbnail name has to be visible.
      void setSelected​(boolean b)
      Set if the thumbnail is selected.
      void setStandard​(boolean b)
      Set if the thumbnail is standard.
      void validate()  
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • thumbnailPN

        protected javax.swing.JPanel thumbnailPN
        The panel dedicated to thumbnail content display.
      • nameLB

        protected javax.swing.JLabel nameLB
      • thumbnailMargin

        protected int thumbnailMargin
      • idFont

        protected java.awt.Font idFont
      • idColor

        protected java.awt.Color idColor
      • standardBgColor

        protected java.awt.Color standardBgColor
      • focusBgColor

        protected java.awt.Color focusBgColor
      • selectedBgColor

        protected java.awt.Color selectedBgColor
      • markedBgColor

        protected java.awt.Color markedBgColor
      • focusedBorder

        protected javax.swing.border.Border focusedBorder
      • currentBorder

        protected javax.swing.border.Border currentBorder
      • currentBgColor

        protected java.awt.Color currentBgColor
      • standard

        protected boolean standard
      • focused

        protected boolean focused
      • selected

        protected boolean selected
      • marked

        protected boolean marked
      • thumbnailID

        protected int thumbnailID
      • name

        protected java.lang.String name
      • content

        protected T content
      • thumbnailComponent

        protected javax.swing.JComponent thumbnailComponent
      • idListenerList

        protected javax.swing.event.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 to true.
      • nameOrientation

        protected java.lang.String nameOrientation
        Where the name of the label has to be visible. Possible values can be:
        • BorderLayout.NORTH
        • BorderLayout.SOUTH
        • BorderLayout.EAST
        • BorderLayout.WEST
        by default this value is set to BorderLayout.SOUTH.
      • idVisible

        protected boolean idVisible
        Is the numerical identifier of the thumbnail has to be visible.
        By default this value is set to true.
    • Constructor Detail

      • JThumbnail

        public JThumbnail​(java.lang.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​(java.lang.String name,
                          T content,
                          javax.swing.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 - true if the thumbnail is standard and false otherwise.
        See Also:
        isStandard()
      • isStandard

        public boolean isStandard()
        Get if the thumbnail is standard.
        Returns:
        true if the thumbnail is standard and false otherwise.
        See Also:
        setStandard(boolean)
      • setMarked

        public void setMarked​(boolean b)
        Set if the thumbnail is marked.
        Parameters:
        b - true if the thumbnail is marked and false otherwise.
        See Also:
        isMarked()
      • isMarked

        public boolean isMarked()
        Get if the thumbnail is marked.
        Returns:
        true if the thumbnail is marked and false otherwise.
        See Also:
        setMarked(boolean)
      • setFocused

        public void setFocused​(boolean b)
        Get if the thumbnail is focused.
        Parameters:
        b - true if the thumbnail is focused and false otherwise.
        See Also:
        isFocused()
      • isFocused

        public boolean isFocused()
        Set if the thumbnail is focused.
        Returns:
        true if the thumbnail is focused and false otherwise.
        See Also:
        setFocused(boolean)
      • setName

        public void setName​(java.lang.String n)
        Overrides:
        setName in class java.awt.Component
      • getName

        public java.lang.String getName()
        Overrides:
        getName in class java.awt.Component
      • 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 - true if the thumbnail is selected and false otherwise.
        See Also:
        isSelected()
      • isSelected

        public boolean isSelected()
        Get if the thumbnail is selected.
        Returns:
        true if the thumbnail is selected and false otherwise.
        See Also:
        setSelected(boolean)
      • setIdFont

        public void setIdFont​(java.awt.Font f)
        Set the font to use for the thumbnail identifier display.
        Parameters:
        f - the font to use for the thumbnail identifier display.
      • setNameVisible

        public void setNameVisible​(boolean nameVisible)
        Set if the thumbnail name has to be visible.
        Parameters:
        nameVisible - true if the thumbnail name has to be visible and false otherwise.
        See Also:
        isNameVisible(), setNameOrientation(String)
      • getNameOrientation

        public java.lang.String getNameOrientation()
        Get the orientation of the thumbnail name. Possible values can be:
        • BorderLayout.NORTH
        • BorderLayout.SOUTH
        • BorderLayout.EAST
        • BorderLayout.WEST
        by default this value is set to BorderLayout.SOUTH.
        Returns:
        the orientation of the thumbnail name.
        See Also:
        setNameOrientation(String), isNameVisible()
      • setNameOrientation

        public void setNameOrientation​(java.lang.String nameOrientation)
        Set the orientation of the thumbnail name. Possible values can be:
        • BorderLayout.NORTH
        • BorderLayout.SOUTH
        • BorderLayout.EAST
        • BorderLayout.WEST
        by default this value is set to BorderLayout.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:
        true if the thumbnail numerical identifier is visible and false otherwise.
        See Also:
        setIdVisible(boolean)
      • setIdVisible

        public void setIdVisible​(boolean visible)
        Set if the thumbnail numerical identifier has to be visible.
        Parameters:
        visible - true if the thumbnail numerical identifier has to be visible and false otherwise.
        See Also:
        isIdVisible()
      • refresh

        public void refresh()
        Refresh the graphical components of the thumbnail.
      • paint

        public void paint​(java.awt.Graphics g)
        Overrides:
        paint in class javax.swing.JComponent
      • 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​(java.awt.event.MouseEvent e)
        mouseClicked
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        e - MouseEvent
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        mouseEntered
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        e - MouseEvent
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        mouseExited
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        e - MouseEvent
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        mousePressed
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        e - MouseEvent
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        mouseReleased
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        e - MouseEvent
      • processLabelMouseEvent

        protected void processLabelMouseEvent​(java.awt.event.MouseEvent e)
      • refreshGUI

        protected void refreshGUI()
      • processComponentMouseEvent

        protected void processComponentMouseEvent​(java.awt.event.MouseEvent e)
        Processin embed component mouse event.
        Parameters:
        e - The mouse event fired by embed component
      • validate

        public void validate()
        Overrides:
        validate in class java.awt.Container