mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
default focus on text when editing JLabel
This commit is contained in:
@@ -116,12 +116,20 @@ public class PropertyEditorDialog extends ButtonDialog {
|
||||
editorPanel.add(createDefaultCheckBox(property), gbc);
|
||||
}
|
||||
}
|
||||
|
||||
// Make value field focused
|
||||
|
||||
if (property.getName().equalsIgnoreCase("value")) {
|
||||
componentToFocus = editor;
|
||||
}
|
||||
|
||||
// Make value field focused
|
||||
try {
|
||||
if (componentToFocus == null && property.getGetter().getName().equalsIgnoreCase("getValue")) {
|
||||
componentToFocus = editor;
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
LOG.warn("Could not determine editor component to focus", e1);
|
||||
}
|
||||
|
||||
gbc.gridy++;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,4 +48,10 @@ public class StringEditor extends JTextField {
|
||||
setBackground(oldBg);
|
||||
property.setValue(getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestFocusInWindow() {
|
||||
selectAll();
|
||||
return super.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user