gt:         int width  = getItemWidth() - 2;
context: /* Copyright (C) 2022, Specify Collections Consortium
   * 
   * Specify Collections Consortium, Biodiversity Institute, University of Kansas,
   * 1345 Jayhawk Boulevard, Lawrence, Kansas, 66045, USA, support@specifysoftware.org
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
   * as published by the Free Software Foundation; either version 2
   * of the License, or (at your option) any later version.
   * 
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   * 
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
  package edu.ku.brc.ui;
  
  import java.awt.Color;
  import java.awt.Graphics2D;
  import java.awt.datatransfer.DataFlavor;
  import java.awt.image.BufferedImage;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.swing.Icon;
  import javax.swing.JLabel;
  
  import edu.ku.brc.ui.dnd.GhostActionable;
  import edu.ku.brc.ui.dnd.GhostMouseInputAdapter;
  import edu.ku.brc.ui.dnd.ShadowFactory;
  
  public class DraggableJLabel extends JLabel implements GhostActionable
  {
      // Static Data Members
      public static final DataFlavor DATAOBJREP_FLAVOR = new DataFlavor(DraggableJLabel.class, "DraggableJLabel");
      
      // These used for the Ghosting
      protected static final int SHADOW_SIZE = 10;
      
      //protected ImageIcon               imgIcon;
      //protected String                  label      = "";
      
      protected BufferedImage           sizeBufImg       = null;
  
      protected GhostMouseInputAdapter  mouseInputAdapter   = null;
      protected BufferedImage           shadowBuffer        = null;
      protected BufferedImage           buffer              = null;
      protected boolean                 generateImgBuf      = true;    
      
      protected Object                  data                = null;
  
      protected List<DataFlavor>        dropFlavors  = new ArrayList<DataFlavor>();
      protected List<DataFlavor>        dragFlavors  = new ArrayList<DataFlavor>();
      
      
      public DraggableJLabel()
      {
          createMouseInputAdapter();
      }
  
      public DraggableJLabel(String text)
      {
          super(text);
          createMouseInputAdapter();
      }
  
      public DraggableJLabel(Icon image)
      {
          super(image);
          createMouseInputAdapter();
      }
  
      public DraggableJLabel(String text, int horizontalAlignment)
      {
          super(text, horizontalAlignment);
          createMouseInputAdapter();
      }
  
      public DraggableJLabel(Icon image, int horizontalAlignment)
      {
          super(image, horizontalAlignment);
          createMouseInputAdapter();
      }
  
      public DraggableJLabel(String text, Icon icon, int horizontalAlignment)
      {
          super(text, icon, horizontalAlignment);
          createMouseInputAdapter();
      }
  
      /* (non-Javadoc)
       * @see javax.swing.JLabel#setText(java.lang.String)
       */
      public void setText(String label)
      {
          String oldLabel = super.getText();
           super.setText(label);
          if (label == null || oldLabel == null || !oldLabel.equals(label))
          {
              generateImgBuf = true;   
          }
      }
      
      //-----------------------------------------------
      // GhostActionable Interface
      //-----------------------------------------------
  
      /* (non-Javadoc)
       * @see edu.ku.brc.ui.dnd.GhostActionable#doAction(edu.ku.brc.ui.dnd.GhostActionable)
       */
      public void doAction(GhostActionable src)
      {
          if (src != null)
          {
              
              //Object dataObj = src.getData();
  
          }
      }
      
      /* (non-Javadoc)
       * @see edu.ku.brc.ui.dnd.GhostActionable#setData(java.lang.Object)
       */
      public void setData(final Object data)
      {
          this.data = data;
      }
      
      /* (non-Javadoc)
       * @see edu.ku.brc.ui.dnd.GhostActionable#getData()
       */
      public Object getData()
      {
          return data;
      }
      
      /* (non-Javadoc)
       * @see edu.ku.brc.ui.dnd.GhostActionable#getDataForClass(java.lang.Class)
       */
      public Object getDataForClass(Class<?> classObj)
      {
          return UIHelper.getDataForClass(data, classObj);
      }
     
      /* (non-Javadoc)
       * @see edu.ku.brc.ui.dnd.GhostActionable#createMouseInputAdapter()
       */
      public void createMouseInputAdapter()
      {
          mouseInputAdapter = new GhostMouseInputAdapter(UIRegistry.getGlassPane(), "action", this);
          addMouseListener(mouseInputAdapter);
          addMouseMotionListener(mouseInputAdapter);
      }
      
      /* (non-Javadoc)
       * @see edu.ku.brc.ui.dnd.GhostActionable#setActive(boolean)
       */
      public void setActive(boolean isActive)
      {
          // Auto-generated method stub
      }
  
      /**
       * Returns the adaptor for tracking mouse drop gestures
       * @return Returns the adaptor for tracking mouse drop gestures
       */
      public GhostMouseInputAdapter getMouseInputAdapter()
      {
          return mouseInputAdapter;
      }
      
      /**
       * Returns the width.
       * @return Returns the width
       */
      public int getItemWidth()
      {
          return getPreferredSize().width + 10;
      }
  
      /**
       * Returns the height.
       * @return Returns the height
       */
      public int getItemHeight()
      {
          return getPreferredSize().height;
      }
  
      /**
       * Render the control to a buffer
       */
      private void renderOffscreen()
      {
          
          BufferedImage bgBufImg = getBackgroundImageBuffer();
  
          
          buffer = new BufferedImage(bgBufImg.getWidth(), bgBufImg.getHeight(), BufferedImage.TYPE_INT_ARGB);
  
          int shadowWidth  = bgBufImg.getWidth() - getItemWidth();
          int shadowHeight = bgBufImg.getHeight() - getItemHeight();
  
          int left   = (int)((shadowWidth) * 0.5);
          int top    = (int)((shadowHeight)* 0.4);
  