Java Utililty Methods JButton Default

List of utility methods to do JButton Default

Description

The list of methods to do JButton Default are organized into topic(s).

Method

voidapplyDefaultProperties(final JButton comp)
Sets default background and foreground color as well as a default font for the specified component.
if (comp == null) {
    return;
applyProperties(comp, "Button.background", 
        "Button.foreground", 
        "Button.font"); 
voidensureDefaultButtonWidth(JButton button)
Ensures a button has a specific minimum width, similar to what Windows does.
ensureButtonWidth(button, DEFAULT_BUTTON_SIZE);
voidsetDefaultButton(final JRootPane rp, final JButton b)
set Default Button
rp.setDefaultButton(b);
voidsetDefaultButton(JButton jButton)
set Default Button
if (jButton == null) {
    throw new IllegalArgumentException();
jButton.getRootPane().setDefaultButton(jButton);
voidsetupWindowContentPane(final Window aWindow, final Component aCenterComponent, final Component aButtonPane, final JButton defaultButton)
Sets up the given window content pane by setting its border to provide a good default spacer, and setting the content pane to the given components.
final JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(DIALOG_PADDING, DIALOG_PADDING, 
        DIALOG_PADDING, DIALOG_PADDING));
contentPane.add(aCenterComponent, BorderLayout.CENTER);
contentPane.add(aButtonPane, BorderLayout.PAGE_END);
if (aWindow instanceof JDialog) {
    ((JDialog) aWindow).setContentPane(contentPane);
    ((JDialog) aWindow).getRootPane().setDefaultButton(defaultButton);
...