JXTitledPanel extends JXPanel { @Override public void updateUI() { setUI((TitledPanelUI) LookAndFeelAddons .getUI(this, TitledPanelUI.class)); } JXTitledPanel();  JXTitledPanel(String title);  JXTitledPanel(String title, Container content); @Override TitledPanelUI getUI(); void setUI(TitledPanelUI ui); @Override String getUIClassID(); @Override void updateUI(); String getTitle(); void setTitle(String title); Container getContentContainer(); void setContentContainer(Container contentPanel); void setRightDecoration(JComponent decoration); JComponent getRightDecoration(); void setLeftDecoration(JComponent decoration); JComponent getLeftDecoration(); Font getTitleFont(); void setTitleFont(Font titleFont); void setTitlePainter(Painter p); Painter getTitlePainter(); Color getTitleForeground(); void setTitleForeground(Color titleForeground); static final String uiClassID; static final String LEFT_DECORATION; static final String RIGHT_DECORATION; }
@Test public void testOpaque() { JXTitledPanel titledPanel = new JXTitledPanel(); boolean opaque = titledPanel.isOpaque(); titledPanel.setOpaque(!opaque); assertEquals("sanity: opaqueness toggled: ", !opaque, titledPanel.isOpaque()); titledPanel.updateUI(); assertEquals("ui must not overwrite custom setting: ", !opaque, titledPanel.isOpaque()); }
@Test public void testBorderOnLFChange() { JXTitledPanel titledPanel = new JXTitledPanel(); assertTrue("sanity: titledPanels default border must be ui-installable " + titledPanel.getBorder(), SwingXUtilities.isUIInstallable(titledPanel.getBorder())); LineBorder border = new LineBorder(titledPanel.getBackground()); titledPanel.setBorder(border); assertEquals("sanity: border set", border, titledPanel.getBorder()); titledPanel.updateUI(); assertEquals("border untouched ", border, titledPanel.getBorder()); }