mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
ComboBox: use small border if used as table editor
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## Unreleased
|
||||
|
||||
- ComboBox: Use small border if used as table editor.
|
||||
|
||||
|
||||
## 0.13
|
||||
|
||||
- Added developer information to Maven POM for Maven Central publishing.
|
||||
|
||||
@@ -72,9 +72,10 @@ public class FlatBorder
|
||||
try {
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
float focusWidth = getFocusWidth();
|
||||
boolean isCellEditor = FlatUIUtils.isTableCellEditor( c );
|
||||
float focusWidth = isCellEditor ? 0 : getFocusWidth();
|
||||
float borderWidth = getBorderWidth( c );
|
||||
float arc = getArc();
|
||||
float arc = isCellEditor ? 0 : getArc();
|
||||
|
||||
if( isFocused( c ) ) {
|
||||
g2.setColor( getFocusColor( c ) );
|
||||
@@ -134,7 +135,8 @@ public class FlatBorder
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets( Component c, Insets insets ) {
|
||||
float ow = getFocusWidth() + getLineWidth();
|
||||
boolean isCellEditor = FlatUIUtils.isTableCellEditor( c );
|
||||
float ow = (isCellEditor ? 0 : getFocusWidth()) + getLineWidth();
|
||||
|
||||
insets = super.getBorderInsets( c, insets );
|
||||
insets.top = Math.round( scale( (float) insets.top ) + ow );
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
@@ -80,6 +81,10 @@ public class FlatUIUtils
|
||||
return (c instanceof ColorUIResource) ? new Color( c.getRGB(), true ) : c;
|
||||
}
|
||||
|
||||
public static boolean isTableCellEditor( Component c ) {
|
||||
return c instanceof JComponent && Boolean.TRUE.equals( ((JComponent)c).getClientProperty( "JComboBox.isTableCellEditor" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets rendering hints used for painting.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user