Java Utililty Methods JButton Settings

List of utility methods to do JButton Settings

Description

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

Method

voidaddAbstractButtonListeners(AbstractButton b, Object... objs)
add Abstract Button Listeners
if (b == null)
    return;
addJContainerListeners(b, objs);
ActionListener actionListener = search(objs, ActionListener.class);
ChangeListener changeListener = search(objs, ChangeListener.class);
ItemListener itemListener = search(objs, ItemListener.class);
if (actionListener != null)
    b.addActionListener(actionListener);
...
voidaddActionListener(ActionListener listener, AbstractButton... buttons)
add Action Listener
for (AbstractButton button : buttons) {
    button.addActionListener(listener);
voidaddActionListeners(AbstractButton button, ActionListener[] listeners)
add Action Listeners
for (ActionListener listener : listeners) {
    button.addActionListener(listener);
voidaddActionListenerToButtons(ActionListener l, AbstractButton... components)
This Method adds a Actionlistener to Several AbstractButtons
for (AbstractButton component : components) {
    component.addActionListener(l);
voidaddButton(ActionListener l, Container container, String name, String cmd)
Add a button to a container with the given parameters and action listener.
JButton button = new JButton(name);
button.addActionListener(l);
button.setActionCommand(cmd);
container.add(button);
JButtonaddButton(Container component, String text, Icon icon, ActionListener listener, String actionCommand)
Add a new button to a given component
return addButton(component, text, icon, listener, actionCommand, 0, null);
JButtonaddButton(String name, JPanel panel, ActionListener action)
Create a button.
final JButton button = new JButton(name);
if (action != null) {
    button.addActionListener(action);
panel.add(button);
return button;
JButtonaddButtonInPanel(Container component, String text, ActionListener listener)
Add a new button to a JPanel and then add the panel to a given component
return addButtonInPanel(component, text, listener, null);
JButtonaddButtonToPanel(JPanel panel, Object constraints, String text)
Adds a button to a panel.
JButton button = new JButton(text);
button.setBackground(BACKGROUND);
panel.add(button, constraints);
return button;
voidaddMiddleButtonDragSupport(Component targetComponent)
add Middle Button Drag Support
MouseInputAdapter mia = new MouseInputAdapter() {
    int m_XDifference, m_YDifference;
    boolean m_dragging = false;
    public void mouseDragged(MouseEvent e) {
        if (!m_dragging)
            return;
        Component target = e.getComponent();
        Container c = target.getParent();
...