mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +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.scrollForwardButton.setIcon( arrowIcon );
|
||||||
_tabScroller.scrollBackwardButton.setIcon( arrowIcon );
|
_tabScroller.scrollBackwardButton.setIcon( arrowIcon );
|
||||||
_tabScroller.listButton.setIcon( arrowIcon );
|
_tabScroller.listButton.setIcon( arrowIcon );
|
||||||
|
_tabScroller.closeButton.setIcon( closeIcon );
|
||||||
|
|
||||||
_tabScroller.scrollForwardButton.setContentAreaFilled( false );
|
_tabScroller.scrollForwardButton.setContentAreaFilled( false );
|
||||||
_tabScroller.scrollBackwardButton.setContentAreaFilled( false );
|
_tabScroller.scrollBackwardButton.setContentAreaFilled( false );
|
||||||
_tabScroller.listButton.setContentAreaFilled( false );
|
_tabScroller.listButton.setContentAreaFilled( false );
|
||||||
|
_tabScroller.closeButton.setContentAreaFilled( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,6 +739,7 @@ public class FlatJideTabbedPaneUI
|
|||||||
y += tabAreaInsets.top;
|
y += tabAreaInsets.top;
|
||||||
|
|
||||||
// layout buttons
|
// layout buttons
|
||||||
|
x = layoutButtonHorizontal( _tabScroller.closeButton, 16, x, y, h, leftToRight );
|
||||||
x = layoutButtonHorizontal( _tabScroller.listButton, 24, 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.scrollForwardButton, 16, x, y, h, leftToRight );
|
||||||
x = layoutButtonHorizontal( _tabScroller.scrollBackwardButton, 16, x, y, h, leftToRight );
|
x = layoutButtonHorizontal( _tabScroller.scrollBackwardButton, 16, x, y, h, leftToRight );
|
||||||
@@ -767,6 +770,7 @@ public class FlatJideTabbedPaneUI
|
|||||||
x += tabAreaInsets.left;
|
x += tabAreaInsets.left;
|
||||||
|
|
||||||
// layout buttons
|
// layout buttons
|
||||||
|
y = layoutButtonVertical( _tabScroller.closeButton, 16, x, y, w );
|
||||||
y = layoutButtonVertical( _tabScroller.listButton, 24, x, y, w );
|
y = layoutButtonVertical( _tabScroller.listButton, 24, x, y, w );
|
||||||
y = layoutButtonVertical( _tabScroller.scrollForwardButton, 16, x, y, w );
|
y = layoutButtonVertical( _tabScroller.scrollForwardButton, 16, x, y, w );
|
||||||
y = layoutButtonVertical( _tabScroller.scrollBackwardButton, 16, x, y, w );
|
y = layoutButtonVertical( _tabScroller.scrollBackwardButton, 16, x, y, w );
|
||||||
|
|||||||
@@ -308,9 +308,11 @@ public class FlatJideOssContainerTest
|
|||||||
|
|
||||||
private void tabsClosableChanged() {
|
private void tabsClosableChanged() {
|
||||||
boolean closable = tabsClosableCheckBox.isSelected() && tabScrollCheckBox.isSelected();
|
boolean closable = tabsClosableCheckBox.isSelected() && tabScrollCheckBox.isSelected();
|
||||||
|
boolean onTab = showCloseButtonOnTabCheckBox.isSelected();
|
||||||
|
|
||||||
for( JideTabbedPane tabbedPane : allTabbedPanes ) {
|
for( JideTabbedPane tabbedPane : allTabbedPanes ) {
|
||||||
tabbedPane.setShowCloseButton( closable );
|
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() {
|
private void showCloseButtonOnSelectedTabChanged() {
|
||||||
boolean onSelected = showCloseButtonOnSelectedTabCheckBox.isSelected();
|
boolean onSelected = showCloseButtonOnSelectedTabCheckBox.isSelected();
|
||||||
|
|
||||||
@@ -407,6 +416,7 @@ public class FlatJideOssContainerTest
|
|||||||
tabIconsCheckBox = new JCheckBox();
|
tabIconsCheckBox = new JCheckBox();
|
||||||
tabIconSizeSpinner = new JSpinner();
|
tabIconSizeSpinner = new JSpinner();
|
||||||
tabsClosableCheckBox = new JCheckBox();
|
tabsClosableCheckBox = new JCheckBox();
|
||||||
|
showCloseButtonOnTabCheckBox = new JCheckBox();
|
||||||
showCloseButtonOnSelectedTabCheckBox = new JCheckBox();
|
showCloseButtonOnSelectedTabCheckBox = new JCheckBox();
|
||||||
JLabel tabPlacementLabel = new JLabel();
|
JLabel tabPlacementLabel = new JLabel();
|
||||||
tabPlacementField = new FlatTestEnumComboBox<>();
|
tabPlacementField = new FlatTestEnumComboBox<>();
|
||||||
@@ -541,6 +551,12 @@ public class FlatJideOssContainerTest
|
|||||||
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
|
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
|
||||||
tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 2 3");
|
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 ----
|
||||||
showCloseButtonOnSelectedTabCheckBox.setText("show on selected");
|
showCloseButtonOnSelectedTabCheckBox.setText("show on selected");
|
||||||
showCloseButtonOnSelectedTabCheckBox.addActionListener(e -> showCloseButtonOnSelectedTabChanged());
|
showCloseButtonOnSelectedTabCheckBox.addActionListener(e -> showCloseButtonOnSelectedTabChanged());
|
||||||
@@ -663,6 +679,7 @@ public class FlatJideOssContainerTest
|
|||||||
private JCheckBox tabIconsCheckBox;
|
private JCheckBox tabIconsCheckBox;
|
||||||
private JSpinner tabIconSizeSpinner;
|
private JSpinner tabIconSizeSpinner;
|
||||||
private JCheckBox tabsClosableCheckBox;
|
private JCheckBox tabsClosableCheckBox;
|
||||||
|
private JCheckBox showCloseButtonOnTabCheckBox;
|
||||||
private JCheckBox showCloseButtonOnSelectedTabCheckBox;
|
private JCheckBox showCloseButtonOnSelectedTabCheckBox;
|
||||||
private FlatTestEnumComboBox<TabPlacement> tabPlacementField;
|
private FlatTestEnumComboBox<TabPlacement> tabPlacementField;
|
||||||
private JCheckBox secondTabClosableCheckBox;
|
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 {
|
new FormModel {
|
||||||
contentType: "form/swing"
|
contentType: "form/swing"
|
||||||
@@ -178,6 +178,17 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 2 3"
|
"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" ) {
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
name: "showCloseButtonOnSelectedTabCheckBox"
|
name: "showCloseButtonOnSelectedTabCheckBox"
|
||||||
"text": "show on selected"
|
"text": "show on selected"
|
||||||
|
|||||||
Reference in New Issue
Block a user