Java JRootPane set default button
import javax.swing.JButton; import javax.swing.JRootPane; public class Main { public static void setDefaultButton(final JRootPane rp, final JButton b) { rp.setDefaultButton(b);/*from w w w . ja v a 2s . c o m*/ } }