Example usage for com.jgoodies.forms.builder ButtonStackBuilder addStrut

List of usage examples for com.jgoodies.forms.builder ButtonStackBuilder addStrut

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder ButtonStackBuilder addStrut.

Prototype

public ButtonStackBuilder addStrut(ConstantSize size) 

Source Link

Document

Adds a strut of a specified size.

Usage

From source file:ai.aitia.meme.utils.FormsUtils.java

License:Open Source License

/**
 * Example:<pre>/*from  w  w w  .  ja  v a 2 s.  c  o  m*/
 *    buttonStack( jMoveUpButton, jMoveDownButton, FormsUtils.BS_UNRELATED, 
 *                jRemoveButton, jEditButton ).getPanel()
 * </pre>
 */
public static ButtonStackBuilder buttonStack(Object... args) {
    ButtonStackBuilder ans = new ButtonStackBuilder();
    boolean addrel = false;
    for (int i = 0; i < args.length; ++i) {
        if (args[i] instanceof javax.swing.JComponent) {
            if (addrel)
                ans.addRelatedGap();
            ans.addGridded((javax.swing.JComponent) args[i]);
            addrel = true;
        } else if (BS_UNRELATED.equals(args[i])) {
            ans.addUnrelatedGap();
            addrel = false;
        } else if (BS_GLUE.equals(args[i])) {
            ans.addGlue();
            addrel = false;
        } else {
            ans.addStrut(Sizes.constant(args[i].toString(), false));
            addrel = false;
        }
    }
    return ans;
}