Class JCarouselMenu.CarouselListCellRenderer

    • Constructor Detail

      • CarouselListCellRenderer

        public CarouselListCellRenderer​(ImageBorder border)
        Creates a new list cell renderer for the menu with the specified image border
        Parameters:
        border - The border to use
    • Method Detail

      • setImageBorder

        public void setImageBorder​(ImageBorder border)
        Allows the setting of the image border
        Parameters:
        border - The border to use
      • getListCellRendererComponent

        public Component getListCellRendererComponent​(JList jList,
                                                      Object object,
                                                      int i,
                                                      boolean isSelected,
                                                      boolean cellHasFocus)
        Sets up the component for stamping
        Specified by:
        getListCellRendererComponent in interface ListCellRenderer
        Parameters:
        jList - The list
        object - The object being drawn
        i - The index of the object
        isSelected - If the object is selected
        cellHasFocus - Does the cell have the focus
        Returns:
        The object to use to stamp the list item
      • paintComponent

        public void paintComponent​(Graphics g)
        Our image border can paint a center as well as a surround. Call paint center if we want it to do this.
        Overrides:
        paintComponent in class JComponent
        Parameters:
        g - The graphcis context
      • getPreferredSize

        public Dimension getPreferredSize()
        I want it to be wider than it needs to be
        Overrides:
        getPreferredSize in class JComponent
        Returns:
        The desired width of the cell