Java Utililty Methods JButton Create

List of utility methods to do JButton Create

Description

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

Method

voidbuildButton(AbstractButton button, String text, ActionListener handler)
This method builds the specified button according to the specified parameters.
buildButton(button, text, handler, text);
JButtonbutton(JPanel panel, String text, char mnemonic, Font font)
button
JButton builderBt = new JButton(text);
builderBt.setFont(font);
builderBt.setMnemonic(mnemonic);
panel.add(builderBt);
return builderBt;
JButtonbutton(String name)
button
JButton ret = nameComponent(new JButton(), name);
ret.setBorderPainted(false);
ret.setFocusable(false);
return ret;
JPanelcreateAddRemoveButtonPanel(Action addAction, Icon addIcon, String addToolTip, Action removeAction, Icon removeIcon, String removeToolTip, int axis)
create Add Remove Button Panel
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, axis));
buttonPanel.setOpaque(false);
JButton addButton = new JButton(addAction);
if (addIcon != null) {
    addButton.setIcon(addIcon);
    addButton.setText(null);
addButton.setToolTipText(addToolTip);
addButton.putClientProperty("JButton.buttonType", "toolbar");
addButton.setOpaque(false);
addAction.setEnabled(false);
JButton removeButton = new JButton(removeAction);
if (removeIcon != null) {
    removeButton.setIcon(removeIcon);
    removeButton.setText(null);
removeButton.setToolTipText(removeToolTip);
removeButton.putClientProperty("JButton.buttonType", "toolbar");
removeButton.setOpaque(false);
removeAction.setEnabled(false);
buttonPanel.add(addButton);
buttonPanel.add(new JToolBar.Separator(new Dimension(6, 6)));
buttonPanel.add(removeButton);
return buttonPanel;
JButtoncreateButton(Action action)
create Button
return new JButton(action);
JButtoncreateButton(Action action)
create Button
JButton button = new JButton(action);
button.setMargin(new Insets(0, 0, 0, 0));
button.setText(null);
button.setFocusable(false);
KeyStroke keyStroke = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY);
if (keyStroke != null) {
    InputMap inputMap = button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(keyStroke, Action.ACCELERATOR_KEY);
...
JButtoncreateButton(Action action)
create Button
JButton button = new JButton(action);
setButtonSize(button, buttonPrefSize);
return button;
JButtoncreateButton(char mnemonic, Action action, Icon icon)
Creates a JButton
JButton button = new JButton(action);
if (icon != null) {
    button.setIcon(icon);
button.setMnemonic(mnemonic);
return button;
JButtonCreateButton(final String name, final String text, final ImageIcon icon, final JPanel panel)
Create Button
JButton button = new JButton();
button.setName(name);
button = new JButton();
button.setIcon(icon);
button.setBackground(panel.getBackground());
button.setText(text);
button.setActionCommand(name);
return button;
...
JButtoncreateButton(Icon icon, String tooltip, String ac)
Mache einen Button.
JButton button = new JButton();
button.setToolTipText(tooltip);
button.setActionCommand(ac);
button.setIcon(icon);
button.setEnabled(false);
return button;