mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
TabbedPane: support specifying tab area insets via client property
This commit is contained in:
@@ -284,6 +284,14 @@ public interface FlatClientProperties
|
||||
*/
|
||||
String TABBED_PANE_TAB_INSETS = "JTabbedPane.tabInsets";
|
||||
|
||||
/**
|
||||
* Specifies the insets of the tab area.
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JTabbedPane}
|
||||
* <strong>Value type</strong> {@link java.awt.Insets}
|
||||
*/
|
||||
String TABBED_PANE_TAB_AREA_INSETS = "JTabbedPane.tabAreaInsets";
|
||||
|
||||
/**
|
||||
* Specifies whether tabs are closable.
|
||||
* If set to {@code true} on a tabbed pane component, all tabs in that tabbed pane are closable.
|
||||
|
||||
@@ -604,6 +604,10 @@ public class FlatTabbedPaneUI
|
||||
Insets currentTabAreaInsets = super.getTabAreaInsets( tabPlacement );
|
||||
Insets insets = (Insets) currentTabAreaInsets.clone();
|
||||
|
||||
Object value = tabPane.getClientProperty( TABBED_PANE_TAB_AREA_INSETS );
|
||||
if( value instanceof Insets )
|
||||
rotateInsets( (Insets) value, insets, tabPlacement );
|
||||
|
||||
// This is a "trick" to get rid of the cropped edge:
|
||||
// super.getTabAreaInsets() returns private field BasicTabbedPaneUI.currentTabAreaInsets,
|
||||
// which is also used to translate the origin of the cropped edge in
|
||||
@@ -1937,6 +1941,7 @@ public class FlatTabbedPaneUI
|
||||
case TABBED_PANE_MAXIMUM_TAB_WIDTH:
|
||||
case TABBED_PANE_TAB_HEIGHT:
|
||||
case TABBED_PANE_TAB_INSETS:
|
||||
case TABBED_PANE_TAB_AREA_INSETS:
|
||||
case TABBED_PANE_HIDDEN_TABS_NAVIGATION:
|
||||
case TABBED_PANE_TAB_AREA_ALIGNMENT:
|
||||
case TABBED_PANE_TAB_WIDTH_MODE:
|
||||
|
||||
Reference in New Issue
Block a user