SyntaxFix
Write A Post
Hire A Developer
Questions
Just use this code:
SwingUtilities.getRootPane(myButton).setDefaultButton(myButton);