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

JRadioButtoncreateRadioButton(String text, ButtonGroup buttonGroup, ActionListener... listeners)
create Radio Button
JRadioButton result = new JRadioButton(text);
if (buttonGroup != null) {
    buttonGroup.add(result);
for (ActionListener listener : listeners) {
    result.addActionListener(listener);
return result;
...
JRadioButtoncreateRadioButton(String text, int mnemonic, ActionListener listener, boolean selected)
create Radio Button
JRadioButton button = new JRadioButton(text);
button.setMnemonic(mnemonic);
button.setSelected(selected);
button.setMinimumSize(labelPrefSize);
if (listener != null)
    button.addActionListener(listener);
if (text.length() == 0)
    button.setPreferredSize(labelPrefSize);
...
ContainercreateRadioButtonGrouping(String elements[], String title)
create Radio Button Grouping
return createRadioButtonGrouping(elements, title, null, null, null);
JButtoncreateScreenCaptureButton()
create Screen Capture Button
return new JButton("Screen Capture");
JButtoncreateSimpleTextButton(String caption, Action action)
Create simple JButton .
JButton button = decoratedToSimpleButton(new JButton(caption));
button.addActionListener(action);
return button;
JButtoncreateSmallButton()
create Small Button
JButton button = new JButton();
button.setBorderPainted(false);
button.setBorder(new EmptyBorder(0, 1, 0, 1));
button.setContentAreaFilled(false);
button.setFocusPainted(false);
button.setRolloverEnabled(true);
button.setHorizontalAlignment(SwingConstants.CENTER);
return button;
...
JButtoncreateSmallButton(Icon icon, String tooltip, ActionListener listener)
create Small Button
final JButton btn = new JButton(icon);
btn.setBorder(BorderFactory.createEmptyBorder());
final Dimension size = new Dimension(16, 16);
btn.setMinimumSize(size);
btn.setPreferredSize(size);
btn.setMaximumSize(size);
btn.setMargin(new Insets(0, 0, 0, 0));
if (listener != null)
...
JButtoncreateSquareButton(String text, int size)
Creates a new JButton that is perfectly square
JButton button = new JButton(text);
button.setPreferredSize(new Dimension(size, size));
button.setMargin(new Insets(0, 0, 0, 0));
return button;
JButtoncreateStandartButton(String name)
create Standart Button
JButton bt = new JButton(name);
FontMetrics fm = bt.getFontMetrics(bt.getFont());
return bt;
JToggleButtoncreateToggleButton(ImageIcon icon, int dimension, String tooltipText, java.awt.event.ActionListener action)
create Toggle Button
JToggleButton btn = createToggleButton(icon, dimension, tooltipText);
if (action != null)
    btn.addActionListener(action);
return btn;