Class JPanelImage

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JPanelImage extends JPanel
Extend JPanel to draw an optionally anti-aliased image filling the panel.
See Also:
  • Field Details

    • theImage

      private Image theImage
      Image to draw within the JPanel. May be null.
    • antiAlias

      private boolean antiAlias
      Whether or not anti-aliasing is being used.
  • Constructor Details

    • JPanelImage

      public JPanelImage()
      Create a JPanelImage without specifying an Image. Note that this sets antiAlias to true.
    • JPanelImage

      public JPanelImage(Image panelImage)
      Create a JPanelImage that contains the specified Image. Note that this sets antiAlias to true.
      Parameters:
      panelImage - Image to use within the created panel. null is allowed.
  • Method Details

    • getAntiAlias

      public boolean getAntiAlias()
      Determine whether or not this JPanelImage is using anti-aliasing.
      Returns:
      true if anti-aliasing is enabled, false otherwise. Default value is true.
    • setAntiAlias

      public void setAntiAlias(boolean setAA)
      Set whether or not this JPanelImage should use anti-aliasing.
      Parameters:
      setAA - true if anti-aliasing should be enabled, false otherwise.
    • getImage

      public Image getImage()
      Return the Image being used within this JPanelImage.
      Returns:
      Image being used, or null if the Image has not been provided.
    • setImage

      public void setImage(Image panelImage)
      Set the Image to use within this JPanelImage.
      Parameters:
      panelImage - Image to use. null is permitted.
    • update

      public void update(Graphics g)
      Update the panel after a change. Note that this is the same as calling paint(java.awt.Graphics).
      Overrides:
      update in class JComponent
      Parameters:
      g - Specified graphics window. Should not be null.
    • paint

      public void paint(Graphics g)
      Paint the JPanelImage.
      Overrides:
      paint in class JComponent
      Parameters:
      g - Specified graphics window. Should not be null.