File tree 1 file changed +11
-1
lines changed
src/main/java/org/scijava/ui/swing/widget
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 46
46
import javax .swing .JColorChooser ;
47
47
import javax .swing .JDialog ;
48
48
import javax .swing .JPanel ;
49
+ import javax .swing .UIManager ;
49
50
import javax .swing .colorchooser .AbstractColorChooserPanel ;
50
51
51
52
import org .scijava .plugin .Plugin ;
@@ -66,7 +67,7 @@ public class SwingColorWidget extends SwingInputWidget<ColorRGB> implements
66
67
ActionListener , ColorWidget <JPanel >
67
68
{
68
69
69
- private static final int SWATCH_WIDTH = 64 , SWATCH_HEIGHT = 16 ;
70
+ private static final int SWATCH_WIDTH = 64 , SWATCH_HEIGHT = widgetHeight () ;
70
71
71
72
private static final String HSB_CLASS_NAME =
72
73
"javax.swing.colorchooser.DefaultHSBChooserPanel" ;
@@ -211,6 +212,15 @@ private int value(final Object o) {
211
212
return chooser ;
212
213
}
213
214
215
+ private static int widgetHeight () {
216
+ try {
217
+ return UIManager .getFont ("TextField.font" ).getSize ();
218
+ } catch (final Exception ignored ) {
219
+ // do nothing
220
+ }
221
+ return 16 ;
222
+ }
223
+
214
224
// -- AbstractUIInputWidget methods ---
215
225
216
226
@ Override
You can’t perform that action at this time.
0 commit comments