Class ImagePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
ImageLinePanel, TrackerObjectQuadPanel

public class ImagePanel extends JPanel
Simple JPanel for displaying buffered images.
See Also:
  • Field Details

    • img

      @Nullable protected @Nullable BufferedImage img
    • scaling

      protected ScaleOptions scaling
    • scale

      public double scale
    • offsetX

      public double offsetX
    • offsetY

      public double offsetY
    • mouseListener

      protected SaveImageOnClick mouseListener
    • transform

      protected AffineTransform transform
  • Constructor Details

    • ImagePanel

      public ImagePanel(BufferedImage img)
    • ImagePanel

      public ImagePanel(BufferedImage img, ScaleOptions scaling)
    • ImagePanel

      public ImagePanel(int width, int height)
    • ImagePanel

      public ImagePanel(boolean addMouseListener)
      Adds the ability to save an image using the middle mouse button. A dialog is shown to the user so that they know what has happened. They can hide it in the future if they wish.
    • ImagePanel

      public ImagePanel()
  • Method Details

    • addClickToSaveListener

      public ImagePanel addClickToSaveListener()
      Adds the ability to save an image using the middle mouse button. A dialog is shown to the user so that they know what has happened. They can hide it in the future if they wish.
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • configureDrawImageGraphics

      protected void configureDrawImageGraphics(Graphics2D g2)
    • setImage

      public ImagePanel setImage(BufferedImage image)
      Change the image being displayed. If panel is active then don't call unless inside the GUI thread. Repaint() is not automatically called.
      Parameters:
      image - The new image which will be displayed.
    • setImageRepaint

      public ImagePanel setImageRepaint(@Nullable @Nullable BufferedImage image)
      Changes the buffered image and calls repaint. Does not need to be called in the UI thread.
    • setImageUI

      public void setImageUI(@Nullable @Nullable BufferedImage image)
      Changes the image and will be invoked inside the UI thread at a later time. repaint() is automatically called.
      Parameters:
      image - The new image which will be displayed.
    • isCentered

      public boolean isCentered()
    • setCentering

      public void setCentering(boolean center)
    • repaintJustImage

      public void repaintJustImage()
      Repaints just the region around the image.
    • repaintJustImage

      protected void repaintJustImage(@Nullable @Nullable BufferedImage img, boofcv.gui.image.ImagePanel.ScaleOffset workspace)
    • getImage

      @Nullable public @Nullable BufferedImage getImage()
    • getImageDimension

      public Dimension getImageDimension()
    • setScaling

      public ImagePanel setScaling(ScaleOptions scaling)
    • autoSetPreferredSize

      public void autoSetPreferredSize()
    • getMouseClickToSaveListener

      public MouseListener getMouseClickToSaveListener()
    • setScale

      public ImagePanel setScale(double scale)