mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
TabbedPane: support per component tab height
This commit is contained in:
@@ -21,6 +21,8 @@ FlatLaf Change Log
|
||||
- ToggleButton: No longer use focus width for tab-style toggle buttons to
|
||||
compute component size, which reduces/fixes component size in "Flat IntelliJ"
|
||||
and "Flat Darcula" themes.
|
||||
- TabbedPane: Support per component tab height (set client property
|
||||
`JTabbedPane.tabHeight` to an integer).
|
||||
|
||||
|
||||
## 0.24
|
||||
|
||||
@@ -117,6 +117,14 @@ public interface FlatClientProperties
|
||||
*/
|
||||
String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder";
|
||||
|
||||
/**
|
||||
* Specifies the height of a tab.
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.Integer}
|
||||
*/
|
||||
String TABBED_PANE_TAB_HEIGHT = "JTabbedPane.tabHeight";
|
||||
|
||||
/**
|
||||
* Placeholder text that is only painted if the text field is empty.
|
||||
* <p>
|
||||
|
||||
@@ -169,6 +169,7 @@ public class FlatTabbedPaneUI
|
||||
switch( e.getPropertyName() ) {
|
||||
case TABBED_PANE_SHOW_TAB_SEPARATORS:
|
||||
case TABBED_PANE_HAS_FULL_BORDER:
|
||||
case TABBED_PANE_TAB_HEIGHT:
|
||||
tabPane.revalidate();
|
||||
tabPane.repaint();
|
||||
break;
|
||||
@@ -215,6 +216,7 @@ public class FlatTabbedPaneUI
|
||||
|
||||
@Override
|
||||
protected int calculateTabHeight( int tabPlacement, int tabIndex, int fontHeight ) {
|
||||
int tabHeight = clientPropertyInt( tabPane, TABBED_PANE_TAB_HEIGHT, this.tabHeight );
|
||||
return Math.max( tabHeight, super.calculateTabHeight( tabPlacement, tabIndex, fontHeight ) - 2 /* was added by superclass */ );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user