From 2bd5f7a8e7bbe2e0057e4fe4e136ed75dfb063e2 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Thu, 30 Apr 2015 18:42:51 +0530 Subject: [PATCH] Made the okButton as the default button everytime so that it gets highlighted --- app/src/processing/app/PreferencesFrame.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/PreferencesFrame.java b/app/src/processing/app/PreferencesFrame.java index e5d90e102..b3121da55 100644 --- a/app/src/processing/app/PreferencesFrame.java +++ b/app/src/processing/app/PreferencesFrame.java @@ -77,6 +77,8 @@ public class PreferencesFrame { String[] monoFontFamilies; JComboBox fontSelectionBox; + JButton okButton; + /** Base object so that updates can be applied to the list of editors. */ Base base; @@ -554,7 +556,7 @@ public class PreferencesFrame { // [ OK ] [ Cancel ] maybe these should be next to the message? - JButton okButton = new JButton(Preferences.PROMPT_OK); + okButton = new JButton(Preferences.PROMPT_OK); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { applyFrame(); @@ -913,6 +915,10 @@ public class PreferencesFrame { if (autoAssociateBox != null) { autoAssociateBox.setSelected(Preferences.getBoolean("platform.auto_file_type_associations")); //$NON-NLS-1$ } + // The OK Button has to be set as the default button every time the + // PrefWindow is to be displayed + dialog.getRootPane().setDefaultButton(okButton); + // The pack is called again here second time to fix layout bugs // the bugs are not due to groupLayout but due to HTML rendering of components // more info can be found here -> https://netbeans.org/bugzilla/show_bug.cgi?id=79967