Made the okButton as the default button everytime so that it gets highlighted

This commit is contained in:
Akarshit Wal
2015-04-30 18:42:51 +05:30
parent 7c1abb7b11
commit 2bd5f7a8e7

View File

@@ -77,6 +77,8 @@ public class PreferencesFrame {
String[] monoFontFamilies;
JComboBox<String> 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