TabbedPane: support specifying tooltip text for tab close buttons via client property

This commit is contained in:
Karl Tauber
2020-10-21 23:13:01 +02:00
parent 2b50431081
commit c590157561
3 changed files with 55 additions and 11 deletions

View File

@@ -54,6 +54,7 @@ public class FlatContainerTest
tabsClosableCheckBox.setSelected( true );
tabsClosableChanged();
putTabbedPanesClientProperty( TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT, "Close" );
tabScrollCheckBox.setSelected( true );
tabScrollChanged();
@@ -129,14 +130,15 @@ public class FlatContainerTest
private void addInitialTabs( JTabbedPane... tabbedPanes ) {
for( JTabbedPane tabbedPane : tabbedPanes ) {
tabbedPane.addTab( "Tab 1", new Panel1() );
tabbedPane.addTab( "Tab 1", null, new Panel1(), "First tab." );
JComponent tab2 = new Panel2();
tab2.setBorder( new LineBorder( Color.magenta ) );
tabbedPane.addTab( "Second Tab", tab2 );
tabbedPane.addTab( "Second Tab", null, tab2, "This is the second tab." );
addTab( tabbedPane, "Disabled", "tab content 3" );
tabbedPane.setEnabledAt( 2, false );
tabbedPane.setToolTipTextAt( 2, "Disabled tab." );
tabbedPane.addTab( "Tab 4", new JLabel( "non-opaque content", SwingConstants.CENTER ) );
}