JIDE: JideTabbedPane: fixed location of tab title editing box

This commit is contained in:
Karl Tauber
2021-03-27 18:22:10 +01:00
parent 69f52c8abd
commit 8e49904f8d
3 changed files with 31 additions and 0 deletions

View File

@@ -503,6 +503,13 @@ public class FlatJideTabbedPaneUI
super.layoutLabel( tabPlacement, metrics, tabIndex, title, icon, tabRect, iconRect, textRect, isSelected );
}
@Override
protected Rectangle getTabsTextBoundsAt( int tabIndex ) {
Rectangle rect = super.getTabsTextBoundsAt( tabIndex );
rect.x += getTabInsets( _tabPane.getTabPlacement(), tabIndex ).left;
return rect;
}
private boolean isLastInRun( int tabIndex ) {
int run = getRunForTab( _tabPane.getTabCount(), tabIndex );
return lastTabInRun( _tabPane.getTabCount(), run ) == tabIndex;

View File

@@ -376,6 +376,13 @@ public class FlatJideOssContainerTest
tabbedPane.setShowGripper( showGripper );
}
private void tabEditingAllowedChanged() {
boolean tabEditingAllowed = tabEditingAllowedCheckBox.isSelected();
for( JideTabbedPane tabbedPane : allTabbedPanes )
tabbedPane.setTabEditingAllowed( tabEditingAllowed );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JPanel panel9 = new JPanel();
@@ -414,6 +421,7 @@ public class FlatJideOssContainerTest
smallerInsetsCheckBox = new JCheckBox();
showGripperCheckBox = new JCheckBox();
showTabSeparatorsCheckBox = new JCheckBox();
tabEditingAllowedCheckBox = new JCheckBox();
hideTabAreaWithOneTabCheckBox = new JCheckBox();
CellConstraints cc = new CellConstraints();
@@ -618,6 +626,11 @@ public class FlatJideOssContainerTest
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 9");
//---- tabEditingAllowedCheckBox ----
tabEditingAllowedCheckBox.setText("Tab editing allowed");
tabEditingAllowedCheckBox.addActionListener(e -> tabEditingAllowedChanged());
tabbedPaneControlPanel.add(tabEditingAllowedCheckBox, "cell 0 10");
//---- hideTabAreaWithOneTabCheckBox ----
hideTabAreaWithOneTabCheckBox.setText("Hide tab area with one tab");
hideTabAreaWithOneTabCheckBox.addActionListener(e -> hideTabAreaWithOneTabChanged());
@@ -661,6 +674,7 @@ public class FlatJideOssContainerTest
private JCheckBox smallerInsetsCheckBox;
private JCheckBox showGripperCheckBox;
private JCheckBox showTabSeparatorsCheckBox;
private JCheckBox tabEditingAllowedCheckBox;
private JCheckBox hideTabAreaWithOneTabCheckBox;
// JFormDesigner - End of variables declaration //GEN-END:variables

View File

@@ -357,6 +357,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabEditingAllowedCheckBox"
"text": "Tab editing allowed"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabEditingAllowedChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 10"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hideTabAreaWithOneTabCheckBox"
"text": "Hide tab area with one tab"