Package selector

Class ImagePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ImagePanel extends JPanel
A Swing component that displays an image and facilitates interaction with it in order to select a region of the image. The image and selection model can both be changed, and a placeholder label is shown if no valid image has been set.
See Also:
  • Constructor Details

    • ImagePanel

      public ImagePanel()
  • Method Details

    • selection

      public SelectionModel selection()
      Return the selection model we are currently controlling.
    • image

      public BufferedImage image()
      Return the image we are currently displaying and selecting from. Returns null if no image is currently set.
    • setSelectionModel

      public void setSelectionModel(SelectionModel newModel)
      Have our selection interactions control `newModel` instead of our current model. The new model will be set to use our current image and will initialize its selection path to our current model's path if possible.
    • setImage

      public void setImage(BufferedImage img)
      Display and select from `img` instead of our current image. If `img` is null, then do not display any image or support any selection interaction (a placeholder message will be shown instead). This will set the image on our selection model (which may reset its selection).