Example usage for com.jgoodies.forms.layout CellConstraints CellConstraints

List of usage examples for com.jgoodies.forms.layout CellConstraints CellConstraints

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints CellConstraints.

Prototype

public CellConstraints() 

Source Link

Document

Constructs a default instance of CellConstraints .

Usage

From source file:com.salas.bb.installation.wizard.StartingPointsPage.java

License:Open Source License

/**
 * Builds the panel./*  w ww.j a v a2s.  co m*/
 */
public void build(JComponent buttonBar) {
    buttonBar.setBorder(Borders.createEmptyBorder("6dlu, 6dlu, 6dlu, 6dlu"));

    FormLayout layout = new FormLayout("15dlu, pref:grow, 15dlu", "pref, 17dlu, pref:grow, 8dlu, pref");

    PanelBuilder builder = new PanelBuilder(layout, this);
    CellConstraints cc = new CellConstraints();

    builder.add(buildHeader(), cc.xyw(1, 1, 3));
    builder.add(buildDataPage(), cc.xy(2, 3, "f, f"));
    builder.add(buttonBar, cc.xyw(1, 5, 3));
}

From source file:com.salas.bb.installation.wizard.TutorialPage.java

License:Open Source License

/**
 * Builds the panel.//from w w  w  . j av a2s . c  o m
 */
public void build(JComponent buttonBar) {
    buttonBar.setBorder(Borders.createEmptyBorder("6dlu, 6dlu, 6dlu, 6dlu"));

    FormLayout layout = new FormLayout("15dlu, left:min:grow, 15dlu", "pref, 17dlu, min:grow, 2dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout, this);
    CellConstraints cc = new CellConstraints();

    builder.add(buildHeader(), cc.xyw(1, 1, 3));
    builder.add(buildTutorialPanel(), cc.xy(2, 3, "f, f"));
    builder.add(buttonBar, cc.xyw(1, 5, 3));
}

From source file:com.salas.bb.search.ResultGroupPanel.java

License:Open Source License

/**
 * Creates group item.// w  w  w . j a  v  a  2 s.c om
 *
 * @param name      name.
 * @param tooltip   tooltip.
 * @param color1    first background color.
 * @param color2    second background color.
 */
public ResultGroupPanel(String name, String tooltip, Color color1, Color color2) {
    backgroundColor1 = color1;
    backgroundColor2 = color2;

    moreItem = new MoreItem();
    lbCount = new JLabel("0");

    setLayout(new FormLayout("5px, 10px, 5px, 50px:grow, 5px, 30px, 5px", "2px, p, 2px"));
    CellConstraints cc = new CellConstraints();

    GroupCollapseIcon icon = new GroupCollapseIcon();
    icon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    add(icon, cc.xy(2, 2));

    Font fnt = new Font("Lucida Grande", Font.BOLD, 12);
    lbTitle = new JLabel(name);
    lbTitle.setFont(fnt);
    lbTitle.setForeground(Color.WHITE);
    lbCount.setFont(fnt);
    lbCount.setForeground(Color.WHITE);
    lbCount.setAlignmentX(0.5f);
    add(lbTitle, cc.xy(4, 2));
    add(lbCount, cc.xy(6, 2));

    setBackground(backgroundColor1);
    if (tooltip != null)
        setToolTipText(tooltip);
}

From source file:com.salas.bb.search.ResultItemPanel.java

License:Open Source License

/**
 * Creates item.//from   w w w . j  a  v a 2  s. c  o  m
 *
 * @param aItem item.
 */
public ResultItemPanel(ResultItem aItem) {
    item = aItem;

    Font font = getFont().deriveFont(10f);

    setBorder(new ResultItemBorder(Color.decode("#f7f7f7")));
    setLayout(new FormLayout("20px, 16px, 5px, 50px:grow, 8px, p, 8px, p, 8px, p, 5px", "2px, p, 2px"));
    CellConstraints cc = new CellConstraints();

    JLabel lbIcon = new JLabel(item.getType().getIcon());
    add(lbIcon, cc.xy(2, 2));

    lbTitle = new JLabel(item.toString());
    lbTitle.setFont(font);
    add(lbTitle, cc.xy(4, 2));

    lbDate = new JLabel(dateToString(item.getDate()));
    lbDate.setFont(font);
    add(lbDate, cc.xy(6, 2));

    if (aItem.getObject() instanceof IArticle) {
        IArticle article = (IArticle) aItem.getObject();

        lbPin = new ArticlePinControl(article);
        add(lbPin, cc.xy(10, 2));

        lbUnread = new ArticleReadControl(article);
        add(lbUnread, cc.xy(8, 2));

        // Setup the tooltip and delegate the mouse events to the parent (this panel)
        IFeed feed = article.getFeed();
        lbTitle.setToolTipText(feed == null ? null : feed.getTitle());
        DelegatingMouseListener ml = new DelegatingMouseListener(lbTitle, false, 2);
        lbTitle.addMouseListener(ml);
    }

    setSelected(false);

    visibility = false;
    collapsed = false;
}

From source file:com.salas.bb.utils.uif.ColorListCellRenderer.java

License:Open Source License

/**
 * Creates a renderer component.//from   w w  w.j  a  v a 2s.co  m
 *
 * @param noColorText text to show when no color is given.
 */
public ColorListCellRenderer(String noColorText) {
    this.noColorText = noColorText;
    CellConstraints cc = new CellConstraints();
    CellConstraints cc2 = new CellConstraints();

    colorSample = new JPanel(new FormLayout("1dlu, center:p:grow, 1dlu", "0dlu, p:grow, 0dlu"));
    label = new JLabel();
    colorSample.add(label, cc.xy(2, 2));

    if (SystemUtils.IS_OS_MAC) {
        setLayout(new FormLayout("0, 10dlu:grow, 2dlu", "2dlu:grow, pref, 1dlu:grow"));
    } else {
        setLayout(new FormLayout("0, pref:grow, 0", "0, pref:grow, 1dlu"));
    }

    add(colorSample, cc2.xy(2, 2, "f, f"));
}

From source file:com.salas.bb.utils.uif.CoolInternalFrame.java

License:Open Source License

/**
 * Sets a new header control component.// w  ww  .  j a va  2 s  . c om
 *
 * @param newhdrContrlComp the header control component to be set in the header.
 */
public void setHeaderControl(JComponent newhdrContrlComp) {
    JComponent oldhdrContrlComp = getHeaderCtrlComp();
    if (oldhdrContrlComp == newhdrContrlComp)
        return;

    if (oldhdrContrlComp != null) {
        headerPanel.remove(oldhdrContrlComp);
    }

    if (newhdrContrlComp != null) {
        newhdrContrlComp.setBorder(null);
        CellConstraints cc = new CellConstraints();
        headerPanel.add(newhdrContrlComp, cc.xywh(5, 2, 1, 3, "r, c"));
    }
    headerCtrlComp = newhdrContrlComp;
    updateHeader();
    firePropertyChange("toolBar", oldhdrContrlComp, newhdrContrlComp);
}

From source file:com.salas.bb.utils.uif.CoolInternalFrame.java

License:Open Source License

/**
 * Creates the appropriately laied out Header for the CoolInternalFrame.
 *
 * @return the header./*  w w w . j  a va  2 s.  c o m*/
 */
private JPanel buildHeader() {
    FormLayout layout = new FormLayout("11px, pref, min:grow, 2px, pref, 11px", "6px, pref, 1px, pref, 8px");
    headerPanel = new GradientPanel(layout);

    CellConstraints cc = new CellConstraints();
    headerPanel.add(titleLabel, cc.xy(2, 2));
    headerPanel.add(subtitleLabel, cc.xyw(2, 4, 3));
    if (headerCtrlComp != null)
        headerPanel.add(headerCtrlComp, cc.xywh(5, 2, 1, 3, "r, c"));

    headerPanel.setOpaque(SystemUtils.IS_OS_MAC);
    return headerPanel;
}

From source file:com.salas.bb.utils.uif.HeaderPanelExt.java

License:Open Source License

/**
 * Builds the panel.//from ww  w.  j  ava  2 s . c  o  m
 */
private void build() {
    setLayout(new FormLayout(COLUMNS, ROWS));
    CellConstraints cc = new CellConstraints();
    add(buildCenterComponent(), cc.xy(1, 1));
    add(buildBottomComponent(), cc.xy(1, 2, CellConstraints.FILL, CellConstraints.BOTTOM));
}

From source file:com.salas.bb.utils.uif.HeaderPanelExt.java

License:Open Source License

/**
 * Builds and answers the panel's center component.
 *//*w  w w.  j a va 2 s . c o  m*/
protected JComponent buildCenterComponent() {
    FormLayout fl = new FormLayout("7dlu, 9dlu, pref:grow, 14dlu, pref, 4dlu",
            "7dlu, pref, 2dlu, pref, 7dlu:grow");
    JPanel panel = new JPanel(fl);

    //        if (height != HEIGHT_AUTO)
    //        {
    Dimension size = new Dimension(300, height);
    panel.setMinimumSize(size);
    panel.setPreferredSize(size);
    //        }

    panel.setOpaque(false);

    CellConstraints cc = new CellConstraints();
    panel.add(titleLabel, cc.xyw(2, 2, 2));
    panel.add(descriptionArea, cc.xy(3, 4));
    panel.add(iconLabel, cc.xywh(5, 1, 1, 5));

    return panel;
}

From source file:com.salas.bb.utils.uif.ProgressPanel.java

License:Open Source License

/**
 * Create a new panel.//  ww w.java2s.c  o  m
 *
 * @param progressLabel a label to show above the progress bar.
 */
public ProgressPanel(String progressLabel) {
    setLayout(new FormLayout("5dlu, center:pref:grow, 5dlu", "5dlu:grow, pref, 5dlu, pref, 5dlu:grow"));

    JLabel label = new JLabel(progressLabel);
    label.setBackground(Color.WHITE);
    setBackground(Color.WHITE);

    progressBar = new JProgressBar(0, 99);
    progressBar.setPreferredSize(new Dimension(250, (int) progressBar.getPreferredSize().getHeight()));

    CellConstraints cc = new CellConstraints();
    add(label, cc.xy(2, 2));
    add(progressBar, cc.xy(2, 4));
}