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

JButtoncreateButton(ImageIcon icon, String text)
create Button
JButton toret;
if (icon != null) {
    toret = new JButton(icon);
} else {
    toret = new JButton(text);
toret.setToolTipText(text);
return toret;
...
JButtoncreateButton(String aText, String aTooltip, ActionListener aListener)
Creates a new button with manageable width.
JButton button = new JButton(aText);
button.setToolTipText(aTooltip);
button.addActionListener(aListener);
button.setMaximumSize(new Dimension(Short.MAX_VALUE, button.getHeight()));
return button;
JButtoncreateButton(String name, ActionListener listener)
create Button
final JButton button = new JButton(name);
button.addActionListener(listener);
return button;
JButtoncreateButton(String name, int x, int y, int width, int height, ImageIcon imageIcon)
create Button
JButton jButton = imageIcon == null ? new JButton(name) : new JButton(imageIcon);
jButton.setBounds(x, y, width, height);
return jButton;
JButtoncreateButton(String text, boolean parse)
Creates a new button with the given text.
JButton button = new JButton();
if (parse) {
    setMenuText(button, text, true);
} else {
    button.setText(text);
return button;
JButtoncreateButton(String text, String icon)
Create a button with a pre-defined look-and-feel
ImageIcon iconRefresh = new ImageIcon(icon);
JButton jButton = new JButton(iconRefresh);
jButton.setBorderPainted(false);
jButton.setBackground(buttonGgColor);
jButton.setForeground(buttonTextColor);
jButton.setFont(buttonFont);
jButton.setText(text);
jButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
...
JButtoncreateButton16(final ImageIcon icon)
create Button
return createButton16(icon, null);
ContainercreateButtonFooter(JButton ok, JButton cancel)
Creates a "footer" containing two buttons (typically OK and Cancel) for a dialog.
return createButtonFooter(ok, cancel, -1);
javax.swing.ButtonGroupcreateButtonGroup(javax.swing.AbstractButton... buttons)
Creates and returns a button group from 'buttons'.
javax.swing.ButtonGroup bg = new javax.swing.ButtonGroup();
for (int i = 0; i < buttons.length; ++i)
    bg.add(buttons[i]);
return bg;
JPanelcreateButtonPanel()
Create and return the button panel.
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
buttonPanel.setBorder(new EmptyBorder(0, 20, 20, 20));
buttonPanel.add(new JButton("Help"));
buttonPanel.add(Box.createGlue());
buttonPanel.add(Box.createGlue());
buttonPanel.add(Box.createGlue());
return buttonPanel;
...