Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat #59 Option to allow tabbed pane separator to take full height #62

Merged
merged 2 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ public interface FlatClientProperties
*/
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.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*
* @clientProperty JTabbedPane.showTabSeparators boolean
* @clientProperty JTabbedPane.hasFullBorder boolean
* @clientProperty JTabbedPane.tabSeparatorsFullHeight boolean
*
* <!-- BasicTabbedPaneUI -->
*
Expand Down Expand Up @@ -83,6 +84,7 @@
* @uiDefault TabbedPane.contentSeparatorHeight int
* @uiDefault TabbedPane.showTabSeparators boolean
* @uiDefault TabbedPane.hasFullBorder boolean
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
*
* @author Karl Tauber
*/
Expand All @@ -105,6 +107,7 @@ public class FlatTabbedPaneUI
protected boolean showTabSeparators;
protected boolean hasFullBorder;
protected boolean tabsOverlapBorder;
protected boolean tabSeparatorsFullHeight;

public static ComponentUI createUI( JComponent c ) {
return new FlatTabbedPaneUI();
Expand All @@ -130,6 +133,7 @@ protected void installDefaults() {
showTabSeparators = UIManager.getBoolean( "TabbedPane.showTabSeparators" );
hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" );
tabsOverlapBorder = UIManager.getBoolean( "TabbedPane.tabsOverlapBorder" );
tabSeparatorsFullHeight = UIManager.getBoolean( "TabbedPane.tabSeparatorsFullHeight" );

// scale
textIconGap = scale( textIconGap );
Expand Down Expand Up @@ -307,7 +311,7 @@ protected void paintTabBorder( Graphics g, int tabPlacement, int tabIndex,
!isLastInRun( tabIndex ) )
{
float sepWidth = UIScale.scale( 1f );
float offset = UIScale.scale( 5f );
float offset = tabSeparatorsFullHeight ? 0.0f : UIScale.scale( 5f );

g.setColor( (tabSeparatorColor != null) ? tabSeparatorColor : contentAreaColor );
if( tabPlacement == LEFT || tabPlacement == RIGHT ) {
Expand Down