- Dark border
- pressing the Enter key to trigger button's event
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JRootPane;
public class SettingDefaultButtonJRootPane {
public static void main(String args[]) {
JFrame frame = new JFrame("DefaultButton");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button4 = new JButton("AAA");
frame.add(button4,"Center");
frame.add(new JButton("BBB"),"South");
JRootPane rootPane = frame.getRootPane();
rootPane.setDefaultButton(button4);
frame.setSize(300, 200);
frame.setVisible(true);
}
}