TabbedPane: allow enabling full border for all tabbed panes in UI defaults

This commit is contained in:
Karl Tauber
2019-08-28 22:28:25 +02:00
parent 072bdfb276
commit a28713dce6
2 changed files with 6 additions and 2 deletions

View File

@@ -62,7 +62,8 @@ import sun.swing.SwingUtilities2;
* @uiDefault TabbedPane.tabAreaInsets Insets
* @uiDefault TabbedPane.tabHeight int
* @uiDefault TabbedPane.tabSelectionHeight int
* @uiDefault TabbedPane.contentSeparatorWidth int
* @uiDefault TabbedPane.contentSeparatorHeight int
* @uiDefault TabbedPane.hasFullBorder boolean
*
* @author Karl Tauber
*/
@@ -80,6 +81,7 @@ public class FlatTabbedPaneUI
protected int tabHeight;
protected int tabSelectionHeight;
protected int contentSeparatorHeight;
protected boolean hasFullBorder;
protected boolean tabsOverlapBorder;
public static ComponentUI createUI( JComponent c ) {
@@ -101,6 +103,7 @@ public class FlatTabbedPaneUI
tabHeight = UIManager.getInt( "TabbedPane.tabHeight" );
tabSelectionHeight = UIManager.getInt( "TabbedPane.tabSelectionHeight" );
contentSeparatorHeight = UIManager.getInt( "TabbedPane.contentSeparatorHeight" );
hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" );
tabsOverlapBorder = UIManager.getBoolean( "TabbedPane.tabsOverlapBorder" );
// scale
@@ -175,7 +178,7 @@ public class FlatTabbedPaneUI
*/
@Override
protected Insets getContentBorderInsets( int tabPlacement ) {
boolean hasFullBorder = (tabPane.getClientProperty( "JTabbedPane.hasFullBorder" ) == Boolean.TRUE);
boolean hasFullBorder = this.hasFullBorder || (tabPane.getClientProperty( "JTabbedPane.hasFullBorder" ) == Boolean.TRUE);
int sh = contentSeparatorHeight;
Insets insets = hasFullBorder ? new Insets( sh, sh, sh, sh ) : new Insets( sh, 0, 0, 0 );

View File

@@ -130,6 +130,7 @@ SplitPaneDivider.border=null
TabbedPane.tabHeight=32
TabbedPane.tabSelectionHeight=3
TabbedPane.contentSeparatorHeight=1
TabbedPane.hasFullBorder=false
TabbedPane.tabInsets=0,12,0,12
TabbedPane.tabAreaInsets=0,0,0,0
TabbedPane.selectedTabPadInsets=0,0,0,0