Java Utililty Methods JButton Key Event

List of utility methods to do JButton Key Event

Description

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

Method

voidaddFastKeys(JButton[] buttonList)
add Fast Keys
for (JButton button : buttonList) {
    button.setMnemonic(button.getText().charAt(button.getText().indexOf('&') + 1));
    button.setText(button.getText().replace("&", ""));
JButtonmakeJButton(ResourceBundle resource, String panelName, String keyword, Icon icon, ActionListener listener)
Factory Method to create Button using specified params
String label;
try {
    label = resource.getString(panelName + "_BUTTON_" + keyword + "_LABEL");
} catch (MissingResourceException e) {
    label = "Missing Label";
JButton button = new JButton();
if (label != null)
...
voidsetButtonKeyStroke(final JButton button, KeyStroke keyStroke)
set Button Key Stroke
Action action = new AbstractAction() {
    private static final long serialVersionUID = 1L;
    @Override
    public void actionPerformed(ActionEvent e) {
        if (button != null) {
            button.doClick();
};
setKeyStroke(button, keyStroke, action);