Class 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:
  • Field Details

    • thumbnailPN

      protected JPanel thumbnailPN
      The panel dedicated to thumbnail content display.
    • 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 to true.
    • nameOrientation

      protected String nameOrientation
      Where the name of the label has to be visible. Possible values can be: 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 Details

    • 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 Details

    • 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

      public boolean isStandard()
      Get if the thumbnail is standard.
      Returns:
      true if the thumbnail is standard and false otherwise.
      See Also:
    • 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

      public boolean isMarked()
      Get if the thumbnail is marked.
      Returns:
      true if the thumbnail is marked and false otherwise.
      See Also:
    • 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

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

      public void setName(String n)
      Overrides:
      setName in class Component
    • getName

      public String getName()
      Overrides:
      getName in class 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

      public T getContent()
      Get the content that is displayed within this thumbnail.
      Returns:
      the content that is displayed within this thumbnail.
      See Also:
    • 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

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

      public void setIdFont(Font f)
      Set the font to 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:
      true if the thumbnail name is visible and false otherwise.
      See Also:
    • 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:
    • getNameOrientation

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

      public void setNameOrientation(String nameOrientation)
      Set the orientation of the thumbnail name. Possible values can be: by default this value is set to BorderLayout.SOUTH.
      Parameters:
      nameOrientation - the orientation of the thumbnail name.
      See Also:
    • 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

      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:
    • refresh

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

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • 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:
      mouseClicked in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      mouseEntered
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseExited

      public void mouseExited(MouseEvent e)
      mouseExited
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      e - MouseEvent
    • mousePressed

      public void mousePressed(MouseEvent e)
      mousePressed
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      mouseReleased
      Specified by:
      mouseReleased in interface MouseListener
      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
    • validate

      public void validate()
      Overrides:
      validate in class Container