Class JXTitledPanel

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

    public class JXTitledPanel
    extends JXPanel
    A special type of Panel that has a Title section and a Content section.
    The following properties can be set with the UIManager to change the look and feel of the JXTitledPanel:
    • JXTitledPanel.titleForeground
    • JXTitledPanel.titleBackground
    • JXTitledPanel.titleFont
    • JXTitledPanel.titlePainter
    • JXTitledPanel.captionInsets
    • JXTitledPanel.rightDecorationInsets
    • JXTitledPanel.leftDecorationInsets
    Author:
    Richard Bair, Nicola Ken Barozzi, Jeanette Winzenburg
    See Also:
    Serialized Form
    • Constructor Detail

      • JXTitledPanel

        public JXTitledPanel()
        Create a new JTitledPanel with an empty string for the title.
      • JXTitledPanel

        public JXTitledPanel​(String title)
        Create a new JTitledPanel with the given title as the title for the panel.
        Parameters:
        title -
      • JXTitledPanel

        public JXTitledPanel​(String title,
                             Container content)
        Create a new JTitledPanel with the given String as the title, and the given Container as the content panel.
        Parameters:
        title -
        content -
    • Method Detail

      • getUI

        public TitledPanelUI getUI()
        Returns the look and feel (L&F) object that renders this component.
        Overrides:
        getUI in class JPanel
        Returns:
        the TitledPanelUI object that renders this component
      • updateUI

        public void updateUI()
        Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager.
        Overrides:
        updateUI in class JPanel
        See Also:
        JComponent.updateUI()
      • getTitle

        public String getTitle()
        Gets the title for this titled panel.
        Returns:
        the currently displayed title
      • setTitle

        public void setTitle​(String title)
        Sets the title for this title panel.
        Parameters:
        title - the title to display
      • getContentContainer

        public Container getContentContainer()
      • setContentContainer

        public void setContentContainer​(Container contentPanel)
      • setRightDecoration

        public void setRightDecoration​(JComponent decoration)
        Adds the given JComponent as a decoration on the right of the title
        Parameters:
        decoration -
      • getRightDecoration

        public JComponent getRightDecoration()
      • setLeftDecoration

        public void setLeftDecoration​(JComponent decoration)
        Adds the given JComponent as a decoration on the left of the title
        Parameters:
        decoration -
      • getLeftDecoration

        public JComponent getLeftDecoration()
      • getTitleFont

        public Font getTitleFont()
      • setTitleFont

        public void setTitleFont​(Font titleFont)
      • setTitlePainter

        public void setTitlePainter​(Painter p)
        Set the Painter to use for painting the title section of the JXTitledPanel. This value may be null, which will cause the current look and feel to paint an appropriate look
        Parameters:
        p - The Painter to use. May be null
      • getTitlePainter

        public Painter getTitlePainter()
        Returns:
        the Painter to use for painting the background of the title section
      • getTitleForeground

        public Color getTitleForeground()
      • setTitleForeground

        public void setTitleForeground​(Color titleForeground)