Option to allow tabbed pane separator to take full height

This commit is contained in:
Bill Culp
2020-02-10 22:32:11 -08:00
parent 5796057a75
commit b6789e14a4
2 changed files with 13 additions and 1 deletions

View File

@@ -133,6 +133,14 @@ public interface FlatClientProperties
*/ */
String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder"; String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder";
/**
* Specifies whether tab separators (if enabled) extend to tab height.
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.Boolean}
*/
String TABBED_PANE_TAB_SEPARATORS_FULL_HEIGHT = "JTabbedPane.tabSeparatorsFullHeight";
/** /**
* Specifies the height of a tab. * Specifies the height of a tab.
* <p> * <p>

View File

@@ -48,6 +48,7 @@ import com.formdev.flatlaf.util.UIScale;
* *
* @clientProperty JTabbedPane.showTabSeparators boolean * @clientProperty JTabbedPane.showTabSeparators boolean
* @clientProperty JTabbedPane.hasFullBorder boolean * @clientProperty JTabbedPane.hasFullBorder boolean
* @clientProperty JTabbedPane.tabSeparatorsFullHeight boolean
* *
* <!-- BasicTabbedPaneUI --> * <!-- BasicTabbedPaneUI -->
* *
@@ -83,6 +84,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TabbedPane.contentSeparatorHeight int * @uiDefault TabbedPane.contentSeparatorHeight int
* @uiDefault TabbedPane.showTabSeparators boolean * @uiDefault TabbedPane.showTabSeparators boolean
* @uiDefault TabbedPane.hasFullBorder boolean * @uiDefault TabbedPane.hasFullBorder boolean
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -105,6 +107,7 @@ public class FlatTabbedPaneUI
protected boolean showTabSeparators; protected boolean showTabSeparators;
protected boolean hasFullBorder; protected boolean hasFullBorder;
protected boolean tabsOverlapBorder; protected boolean tabsOverlapBorder;
protected boolean tabSeparatorsFullHeight;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatTabbedPaneUI(); return new FlatTabbedPaneUI();
@@ -130,6 +133,7 @@ public class FlatTabbedPaneUI
showTabSeparators = UIManager.getBoolean( "TabbedPane.showTabSeparators" ); showTabSeparators = UIManager.getBoolean( "TabbedPane.showTabSeparators" );
hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" ); hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" );
tabsOverlapBorder = UIManager.getBoolean( "TabbedPane.tabsOverlapBorder" ); tabsOverlapBorder = UIManager.getBoolean( "TabbedPane.tabsOverlapBorder" );
tabSeparatorsFullHeight = UIManager.getBoolean( "TabbedPane.tabSeparatorsFullHeight" );
// scale // scale
textIconGap = scale( textIconGap ); textIconGap = scale( textIconGap );
@@ -307,7 +311,7 @@ public class FlatTabbedPaneUI
!isLastInRun( tabIndex ) ) !isLastInRun( tabIndex ) )
{ {
float sepWidth = UIScale.scale( 1f ); float sepWidth = UIScale.scale( 1f );
float offset = UIScale.scale( 5f ); float offset = tabSeparatorsFullHeight ? 0.0f : UIScale.scale( 5f );
g.setColor( (tabSeparatorColor != null) ? tabSeparatorColor : contentAreaColor ); g.setColor( (tabSeparatorColor != null) ? tabSeparatorColor : contentAreaColor );
if( tabPlacement == LEFT || tabPlacement == RIGHT ) { if( tabPlacement == LEFT || tabPlacement == RIGHT ) {