mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17:13 -06:00
FileChooser: fixed too small text field when renaming a file/directory in Flat IntelliJ/Darcula themes (issue #143)
This commit is contained in:
@@ -31,6 +31,8 @@ FlatLaf Change Log
|
||||
combo box and vertical scroll bar is visible. (issue #137)
|
||||
- MenuItem on macOS: Removed plus characters from accelerator text and made
|
||||
modifier key order conform with macOS standard. (issue #141)
|
||||
- FileChooser: Fixed too small text field when renaming a file/directory in Flat
|
||||
IntelliJ/Darcula themes. (issue #143)
|
||||
|
||||
|
||||
## 0.38
|
||||
|
||||
@@ -87,7 +87,7 @@ public class FlatBorder
|
||||
try {
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
boolean isCellEditor = isTableCellEditor( c );
|
||||
boolean isCellEditor = isCellEditor( c );
|
||||
float focusWidth = isCellEditor ? 0 : scale( (float) getFocusWidth( c ) );
|
||||
float borderWidth = scale( (float) getBorderWidth( c ) );
|
||||
float arc = isCellEditor ? 0 : scale( (float) getArc( c ) );
|
||||
@@ -95,7 +95,7 @@ public class FlatBorder
|
||||
|
||||
// paint outer border
|
||||
if( outlineColor != null || isFocused( c ) ) {
|
||||
float innerWidth = !(c instanceof JScrollPane)
|
||||
float innerWidth = !isCellEditor && !(c instanceof JScrollPane)
|
||||
? (outlineColor != null ? innerOutlineWidth : innerFocusWidth)
|
||||
: 0;
|
||||
|
||||
@@ -198,13 +198,13 @@ public class FlatBorder
|
||||
return FlatUIUtils.isPermanentFocusOwner( c );
|
||||
}
|
||||
|
||||
protected boolean isTableCellEditor( Component c ) {
|
||||
return FlatUIUtils.isTableCellEditor( c );
|
||||
protected boolean isCellEditor( Component c ) {
|
||||
return FlatUIUtils.isCellEditor( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets( Component c, Insets insets ) {
|
||||
boolean isCellEditor = isTableCellEditor( c );
|
||||
boolean isCellEditor = isCellEditor( c );
|
||||
float focusWidth = isCellEditor ? 0 : scale( (float) getFocusWidth( c ) );
|
||||
float ow = focusWidth + scale( (float) getLineWidth( c ) );
|
||||
|
||||
@@ -213,6 +213,18 @@ public class FlatBorder
|
||||
insets.left = Math.round( scale( (float) insets.left ) + ow );
|
||||
insets.bottom = Math.round( scale( (float) insets.bottom ) + ow );
|
||||
insets.right = Math.round( scale( (float) insets.right ) + ow );
|
||||
|
||||
if( isCellEditor ) {
|
||||
// remove top and bottom insets if used as cell editor
|
||||
insets.top = insets.bottom = 0;
|
||||
|
||||
// remove right/left insets to avoid that text is truncated (e.g. in file chooser)
|
||||
if( c.getComponentOrientation().isLeftToRight() )
|
||||
insets.right = 0;
|
||||
else
|
||||
insets.left = 0;
|
||||
}
|
||||
|
||||
return insets;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,16 @@ public class FlatUIUtils
|
||||
return FlatClientProperties.clientPropertyInt( c, FlatClientProperties.MINIMUM_HEIGHT, minimumHeight );
|
||||
}
|
||||
|
||||
public static boolean isTableCellEditor( Component c ) {
|
||||
public static boolean isCellEditor( Component c ) {
|
||||
// check whether used as cell editor in file chooser
|
||||
// Tree.cellEditor is set in sun.swing.FilePane.editFileName()
|
||||
// Table.editor is set in JTable.GenericEditor constructor
|
||||
String name = c.getName();
|
||||
if( "Tree.cellEditor".equals( name ) || "Table.editor".equals( name ) )
|
||||
return true;
|
||||
|
||||
// for using combo box as cell editor in table
|
||||
// JComboBox.isTableCellEditor is set in javax.swing.DefaultCellEditor(JComboBox) constructor
|
||||
return c instanceof JComponent && Boolean.TRUE.equals( ((JComponent)c).getClientProperty( "JComboBox.isTableCellEditor" ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user