Class ImageLabel

    • Field Detail

      • imageIcon

        protected ImageIcon imageIcon
        The image that ends up getting scaled
    • Constructor Detail

      • ImageLabel

        public ImageLabel​(ImageIcon icon)
        Creates a new instance of ImageLabel. The prefered width and height will be set to the dimensions of the image
        Parameters:
        icon - The image to display
      • ImageLabel

        public ImageLabel​(ImageIcon icon,
                          int width,
                          int height)
        Creates a new instance of ImageLabel, setting the preferred rendering size to the supplied dimensions
        Parameters:
        icon - The image to place on the label
        width - The prefered width
        height - The prefered height
    • Method Detail

      • paintComponent

        public void paintComponent​(Graphics graphics)
        Paints the label scaling the image to the appropriate size
        Overrides:
        paintComponent in class JComponent
        Parameters:
        graphics - The graphics context