From 37de39ad8a1b135f78dd6c931472e71c8f3417bc Mon Sep 17 00:00:00 2001 From: hneemann Date: Sat, 27 May 2017 23:12:33 +0200 Subject: [PATCH] Top most string field gets focus if the attribute dialog is opened --- .../de/neemann/digital/gui/components/AttributeDialog.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/neemann/digital/gui/components/AttributeDialog.java b/src/main/java/de/neemann/digital/gui/components/AttributeDialog.java index f95610702..51ae5e6ce 100644 --- a/src/main/java/de/neemann/digital/gui/components/AttributeDialog.java +++ b/src/main/java/de/neemann/digital/gui/components/AttributeDialog.java @@ -70,10 +70,11 @@ public class AttributeDialog extends JDialog { topMostTextComponent = null; for (Key key : list) { Editor e = EditorFactory.INSTANCE.create(key, elementAttributes.get(key)); - if (topMostTextComponent == null && e instanceof EditorFactory.StringEditor) - topMostTextComponent = ((EditorFactory.StringEditor) e).getTextComponent(); editors.add(new EditorHolder(e, key)); e.addToPanel(panel, key, elementAttributes, this); + + if (topMostTextComponent == null && e instanceof EditorFactory.StringEditor) + topMostTextComponent = ((EditorFactory.StringEditor) e).getTextComponent(); } JButton okButton = new JButton(new AbstractAction(Lang.get("ok")) {