mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
JIDE: JideTabbedPane: fixed close button in tab area
This commit is contained in:
@@ -168,10 +168,12 @@ public class FlatJideTabbedPaneUI
|
||||
_tabScroller.scrollForwardButton.setIcon( arrowIcon );
|
||||
_tabScroller.scrollBackwardButton.setIcon( arrowIcon );
|
||||
_tabScroller.listButton.setIcon( arrowIcon );
|
||||
_tabScroller.closeButton.setIcon( closeIcon );
|
||||
|
||||
_tabScroller.scrollForwardButton.setContentAreaFilled( false );
|
||||
_tabScroller.scrollBackwardButton.setContentAreaFilled( false );
|
||||
_tabScroller.listButton.setContentAreaFilled( false );
|
||||
_tabScroller.closeButton.setContentAreaFilled( false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,6 +739,7 @@ public class FlatJideTabbedPaneUI
|
||||
y += tabAreaInsets.top;
|
||||
|
||||
// layout buttons
|
||||
x = layoutButtonHorizontal( _tabScroller.closeButton, 16, x, y, h, leftToRight );
|
||||
x = layoutButtonHorizontal( _tabScroller.listButton, 24, x, y, h, leftToRight );
|
||||
x = layoutButtonHorizontal( _tabScroller.scrollForwardButton, 16, x, y, h, leftToRight );
|
||||
x = layoutButtonHorizontal( _tabScroller.scrollBackwardButton, 16, x, y, h, leftToRight );
|
||||
@@ -767,6 +770,7 @@ public class FlatJideTabbedPaneUI
|
||||
x += tabAreaInsets.left;
|
||||
|
||||
// layout buttons
|
||||
y = layoutButtonVertical( _tabScroller.closeButton, 16, x, y, w );
|
||||
y = layoutButtonVertical( _tabScroller.listButton, 24, x, y, w );
|
||||
y = layoutButtonVertical( _tabScroller.scrollForwardButton, 16, x, y, w );
|
||||
y = layoutButtonVertical( _tabScroller.scrollBackwardButton, 16, x, y, w );
|
||||
|
||||
@@ -308,9 +308,11 @@ public class FlatJideOssContainerTest
|
||||
|
||||
private void tabsClosableChanged() {
|
||||
boolean closable = tabsClosableCheckBox.isSelected() && tabScrollCheckBox.isSelected();
|
||||
boolean onTab = showCloseButtonOnTabCheckBox.isSelected();
|
||||
|
||||
for( JideTabbedPane tabbedPane : allTabbedPanes ) {
|
||||
tabbedPane.setShowCloseButton( closable );
|
||||
tabbedPane.setShowCloseButtonOnTab( closable );
|
||||
tabbedPane.setShowCloseButtonOnTab( onTab );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,6 +325,13 @@ public class FlatJideOssContainerTest
|
||||
}
|
||||
}
|
||||
|
||||
private void showCloseButtonOnTabChanged() {
|
||||
boolean onTab = showCloseButtonOnTabCheckBox.isSelected();
|
||||
|
||||
for( JideTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setShowCloseButtonOnTab( onTab );
|
||||
}
|
||||
|
||||
private void showCloseButtonOnSelectedTabChanged() {
|
||||
boolean onSelected = showCloseButtonOnSelectedTabCheckBox.isSelected();
|
||||
|
||||
@@ -407,6 +416,7 @@ public class FlatJideOssContainerTest
|
||||
tabIconsCheckBox = new JCheckBox();
|
||||
tabIconSizeSpinner = new JSpinner();
|
||||
tabsClosableCheckBox = new JCheckBox();
|
||||
showCloseButtonOnTabCheckBox = new JCheckBox();
|
||||
showCloseButtonOnSelectedTabCheckBox = new JCheckBox();
|
||||
JLabel tabPlacementLabel = new JLabel();
|
||||
tabPlacementField = new FlatTestEnumComboBox<>();
|
||||
@@ -541,6 +551,12 @@ public class FlatJideOssContainerTest
|
||||
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
|
||||
tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 2 3");
|
||||
|
||||
//---- showCloseButtonOnTabCheckBox ----
|
||||
showCloseButtonOnTabCheckBox.setText("on tab");
|
||||
showCloseButtonOnTabCheckBox.setSelected(true);
|
||||
showCloseButtonOnTabCheckBox.addActionListener(e -> showCloseButtonOnTabChanged());
|
||||
tabbedPaneControlPanel.add(showCloseButtonOnTabCheckBox, "cell 2 3");
|
||||
|
||||
//---- showCloseButtonOnSelectedTabCheckBox ----
|
||||
showCloseButtonOnSelectedTabCheckBox.setText("show on selected");
|
||||
showCloseButtonOnSelectedTabCheckBox.addActionListener(e -> showCloseButtonOnSelectedTabChanged());
|
||||
@@ -663,6 +679,7 @@ public class FlatJideOssContainerTest
|
||||
private JCheckBox tabIconsCheckBox;
|
||||
private JSpinner tabIconSizeSpinner;
|
||||
private JCheckBox tabsClosableCheckBox;
|
||||
private JCheckBox showCloseButtonOnTabCheckBox;
|
||||
private JCheckBox showCloseButtonOnSelectedTabCheckBox;
|
||||
private FlatTestEnumComboBox<TabPlacement> tabPlacementField;
|
||||
private JCheckBox secondTabClosableCheckBox;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "16" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -178,6 +178,17 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "showCloseButtonOnTabCheckBox"
|
||||
"text": "on tab"
|
||||
"selected": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showCloseButtonOnTabChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "showCloseButtonOnSelectedTabCheckBox"
|
||||
"text": "show on selected"
|
||||
|
||||
Reference in New Issue
Block a user