Class JXTitledPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, AlphaPaintable, BackgroundPaintable

@JavaBean 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
See Also:
  • Field Details

    • uiClassID

      public static final String uiClassID
      See Also:
    • LEFT_DECORATION

      public static final String LEFT_DECORATION
      See Also:
    • RIGHT_DECORATION

      public static final String RIGHT_DECORATION
      See Also:
    • title

      private String title
      The text to use for the title
    • titleFont

      private Font titleFont
      The Font to use for the Title
    • titleForeground

      private Color titleForeground
      The foreground color to use for the Title (particularly for the text)
    • contentPanel

      private Container contentPanel
      The ContentPanel. Whatever this container is will be displayed in the Content section
    • titlePainter

      private Painter titlePainter
      The Painter to use for painting the title section of the JXTitledPanel
  • Constructor Details

    • 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 Details

    • getUI

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

      public void setUI(TitledPanelUI ui)
      Sets the look and feel (Linvalid input: '&F') object that renders this component.
      Parameters:
      ui - the TitledPanelUI Linvalid input: '&F' object
      See Also:
    • getUIClassID

      public String getUIClassID()
      Returns a string that specifies the name of the Linvalid input: '&F' class that renders this component.
      Overrides:
      getUIClassID in class JPanel
      Returns:
      "TitledPanelUI"
      See Also:
    • updateUI

      public void updateUI()
      Notification from the UIManager that the Linvalid input: '&F' has changed. Replaces the current UI object with the latest version from the UIManager.
      Overrides:
      updateUI in class JPanel
      See Also:
    • 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)
    • createDefaultContainer

      private static Container createDefaultContainer()