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

JButtoncreateToolBarButton(Action action)
create Tool Bar Button
JButton button = new JButton();
button.putClientProperty("hideActionText", true);
button.setFocusable(false);
button.setHorizontalTextPosition(SwingConstants.CENTER);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setAction(action);
return button;
JButtoncreateToolBarButton(String text, Icon icon)
create Tool Bar Button
final JButton btn;
if (icon == null) {
    btn = new JButton(text);
} else {
    btn = new JButton(icon);
    btn.setToolTipText(text);
    btn.setBorderPainted(false);
    btn.setMargin(ZERO_INSETS);
...
JToggleButtoncreateToolBarToggleButton(ImageIcon ic, String toolTip, ActionListener al)
create Tool Bar Toggle Button
JToggleButton button = new JToggleButton(ic);
fixButton(button, toolTip);
if (al != null)
    button.addActionListener(al);
return button;
JButtoncreateTransparentButton(Action action, boolean withText)
create Transparent Button
JButton button = new JButton(action);
if (withText) {
    button.setVerticalTextPosition(SwingConstants.BOTTOM);
    button.setHorizontalTextPosition(SwingConstants.CENTER);
} else {
    button.setText("");
    button.setMargin(new Insets(0, 0, 0, 0));
button.setOpaque(false);
button.setContentAreaFilled(false);
button.setBorderPainted(false);
return button;
JButtongetCreateButton()
get Create Button
createButton.setToolTipText("New project");
return createButton;
JButtonmakeButton(Action action)
make Button
JButton button = new JButton(action);
return button;
JButtonmakeButton(String name, ActionListener l)
Return a button with action command set to name.
JButton button = new JButton(name);
button.addActionListener(l);
button.setActionCommand(name);
return button;
voidmakeButtonActLikeLabel(JButton button)
Makes a button to act and look like a label, while keeping the action performed events.
button.setFocusPainted(false);
button.setMargin(new Insets(0, 0, 0, 0));
button.setContentAreaFilled(false);
button.setBorderPainted(false);
button.setOpaque(false);
JPanelmakeButtonBar(int align, Component... comps)
make Button Bar
JPanel pan = new JPanel(new FlowLayout(align));
for (Component component : comps) {
    pan.add(component);
return pan;
voidmakeButtonFlat(AbstractButton button)
make Button Flat
if (button instanceof JToggleButton) {
    button.setUI(new BasicToggleButtonUI());
} else {
    button.setUI(new BasicButtonUI());
button.setRolloverEnabled(true);
UIDefaults table = UIManager.getLookAndFeelDefaults();
button.setBorder(new BasicBorders.RolloverButtonBorder(table.getColor("controlShadow"), 
...