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

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

Introduction

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

Prototype

public CellConstraints xyw(int col, int row, int colSpan, Alignment colAlign, Alignment rowAlign) 

Source Link

Document

Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects.

Usage

From source file:fsart.diffTools.gui.DiffToolsMainPanel.java

License:CeCILL license

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it by your code!
 *
 * @noinspection ALL/*from   ww  w .j  ava 2s .c o m*/
 */
private void $$$setupUI$$$() {
    panel1 = new JPanel();
    panel1.setLayout(new BorderLayout(0, 0));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1, BorderLayout.WEST);
    final Spacer spacer2 = new Spacer();
    panel1.add(spacer2, BorderLayout.EAST);
    final Spacer spacer3 = new Spacer();
    panel1.add(spacer3, BorderLayout.SOUTH);
    final Spacer spacer4 = new Spacer();
    panel1.add(spacer4, BorderLayout.NORTH);
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FormLayout(
            "left:max(d;4px):noGrow,left:4dlu:noGrow,center:max(d;50px):grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:5dlu:noGrow,fill:max(d;4px):noGrow",
            "top:d:grow,top:4dlu:noGrow,top:d:noGrow,top:4dlu:noGrow,center:max(d;25px):noGrow,top:6dlu:noGrow,top:max(d;4px):noGrow,top:4dlu:noGrow,top:max(d;25px):noGrow,top:7dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,bottom:d:grow"));
    panel2.putClientProperty("html.disable", Boolean.FALSE);
    panel1.add(panel2, BorderLayout.CENTER);
    final Spacer spacer5 = new Spacer();
    CellConstraints cc = new CellConstraints();
    panel2.add(spacer5, cc.xy(3, 1, CellConstraints.DEFAULT, CellConstraints.FILL));
    browseButton = new JButton();
    browseButton.setText("Browse");
    panel2.add(browseButton, cc.xy(5, 5));
    comparedFileLabel = new JLabel();
    comparedFileLabel.setText("Compared file :");
    panel2.add(comparedFileLabel, cc.xy(3, 7, CellConstraints.LEFT, CellConstraints.TOP));
    browseButton1 = new JButton();
    browseButton1.setText("Browse");
    panel2.add(browseButton1, cc.xy(5, 9, CellConstraints.DEFAULT, CellConstraints.TOP));
    final Spacer spacer6 = new Spacer();
    panel2.add(spacer6, cc.xy(3, 13, CellConstraints.DEFAULT, CellConstraints.FILL));
    final Spacer spacer7 = new Spacer();
    panel2.add(spacer7, cc.xy(1, 9, CellConstraints.FILL, CellConstraints.DEFAULT));
    final Spacer spacer8 = new Spacer();
    panel2.add(spacer8, cc.xy(7, 7, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new FormLayout("fill:d:grow", "center:d:grow"));
    panel2.add(panel3, cc.xyw(3, 11, 3, CellConstraints.FILL, CellConstraints.FILL));
    compareButton = new JButton();
    compareButton.setPreferredSize(new Dimension(100, 29));
    compareButton.setText("Compare");
    panel3.add(compareButton, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.CENTER));
    baseFileLabel = new JLabel();
    baseFileLabel.setText("Base file :");
    panel2.add(baseFileLabel, cc.xy(3, 3, CellConstraints.FILL, CellConstraints.FILL));
    baseFileTxt = new JTextField();
    baseFileTxt.setMinimumSize(new Dimension(50, 27));
    baseFileTxt.setPreferredSize(new Dimension(50, 27));
    panel2.add(baseFileTxt, cc.xy(3, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    comparedFileTxt = new JTextField();
    comparedFileTxt.setMinimumSize(new Dimension(50, 27));
    comparedFileTxt.setPreferredSize(new Dimension(100, 27));
    panel2.add(comparedFileTxt, cc.xy(3, 9, CellConstraints.FILL, CellConstraints.DEFAULT));
    outputField = new JTextField();
    outputField.setMinimumSize(new Dimension(50, 27));
    outputField.setPreferredSize(new Dimension(100, 27));
    panel2.add(outputField, cc.xy(3, 15, CellConstraints.FILL, CellConstraints.DEFAULT));
}

From source file:loci.plugins.in.MainDialog.java

License:Open Source License

/**
 * Convenience method for creating a left-aligned,
 * vertically centered cell constraints object.
 *//*from   w w  w. j a  va  2 s . c  o  m*/
private CellConstraints xyw(CellConstraints cc, int x, int y, int w) {
    return cc.xyw(x, y, w, CellConstraints.LEFT, CellConstraints.CENTER);
}

From source file:loci.visbio.data.SpectralWidget.java

License:Open Source License

/** Creates a new spectral mapping widget with weighted sliders. */
public SpectralWidget(final SpectralTransform mapping, final String[] text) {
    super();/*from w ww.  j  a v a  2  s .com*/
    this.mapping = mapping;

    // create sliders, labels and auto-set buttons
    final RealType[] range = ((ImageTransform) mapping.getParent()).getRangeTypes();
    final int in = range.length;
    final int out = mapping.getRangeCount();
    weights = new JSlider[out][in];
    labels = new JLabel[out][in];

    final Hashtable labelHash = new Hashtable();
    labelHash.put(new Integer(-PRECISION), new JLabel("-1"));
    labelHash.put(new Integer(0), new JLabel("0"));
    labelHash.put(new Integer(PRECISION), new JLabel("1"));

    final JButton[] negOnes = new JButton[out];
    final JButton[] zeroes = new JButton[out];
    final JButton[] ones = new JButton[out];

    final double[][] w = mapping.getWeights();

    for (int o = 0; o < out; o++) {
        for (int i = 0; i < in; i++) {
            final int value = (int) (PRECISION * w[o][i]);
            final JSlider s = new JSlider(-PRECISION, PRECISION, value);
            if (i == in - 1) {
                s.setMajorTickSpacing(PRECISION);
                s.setMinorTickSpacing(PRECISION / 10);
                s.setLabelTable(labelHash);
                s.setPaintTicks(true);
                s.setPaintLabels(true);
            }

            final JLabel l = new JLabel(shortString(value));
            s.addChangeListener(new ChangeListener() {

                @Override
                public void stateChanged(final ChangeEvent e) {
                    l.setText(shortString(((JSlider) e.getSource()).getValue()));
                }
            });

            weights[o][i] = s;
            labels[o][i] = l;
        }

        negOnes[o] = new JButton("-1");
        negOnes[o].setActionCommand("-1:" + o);
        negOnes[o].addActionListener(this);

        zeroes[o] = new JButton("0");
        zeroes[o].setActionCommand("0:" + o);
        zeroes[o].addActionListener(this);

        ones[o] = new JButton("1");
        ones[o].setActionCommand("1:" + o);
        ones[o].addActionListener(this);
    }

    // apply button
    final JButton apply = new JButton("Apply");
    if (!LAFUtil.isMacLookAndFeel())
        apply.setMnemonic('a');
    apply.setActionCommand("apply");
    apply.addActionListener(this);

    // lay out components
    final String s = "pref, 3dlu:grow, pref, 3dlu:grow, pref";
    final StringBuffer cols = new StringBuffer("pref, 3dlu, " + s + ", 3dlu, pref");
    for (int o = 1; o < out; o++) {
        cols.append(", 9dlu, " + s + ", 3dlu, pref");
    }

    final StringBuffer rows = new StringBuffer("pref, 3dlu, pref");
    for (int i = 1; i < in; i++)
        rows.append(", 3dlu, pref");
    rows.append(", 3dlu, pref, 5dlu, pref");

    final PanelBuilder builder = new PanelBuilder(new FormLayout(cols.toString(), rows.toString()));
    final CellConstraints cc = new CellConstraints();

    for (int i = 0; i < in; i++) {
        final int row = 2 * i + 3;
        builder.addLabel(range[i].getName(), cc.xy(1, row, CellConstraints.RIGHT, CellConstraints.TOP));
    }

    for (int o = 0; o < out; o++) {
        final int col = 8 * o + 3;
        builder.addLabel(text[o], cc.xyw(col, 1, 5, CellConstraints.CENTER, CellConstraints.DEFAULT));
        for (int i = 0; i < in; i++) {
            final int row = 2 * i + 3;
            builder.add(weights[o][i], cc.xyw(col, row, 5));
            builder.add(labels[o][i], cc.xy(col + 6, row, CellConstraints.DEFAULT, CellConstraints.TOP));
        }

        final int row = 2 * in + 3;
        builder.add(negOnes[o], cc.xy(col, row));
        builder.add(zeroes[o], cc.xy(col + 2, row));
        builder.add(ones[o], cc.xy(col + 4, row));
    }

    builder.add(ButtonBarFactory.buildCenteredBar(apply), cc.xyw(1, 2 * in + 5, 8 * out + 1));

    setLayout(new BorderLayout());
    add(builder.getPanel());
}

From source file:net.pms.medialibrary.gui.dialogs.quicktagdialog.QuickTagEntriesPanel.java

License:Open Source License

private void refresh() {
    if (isInitializing) {
        return;/*from   www.  jav a2s  . c om*/
    }

    //create the rows string
    String rowsString = "5px, p, 5px, ";
    if (quickTagEntryPanels.size() > 0) {
        for (int i = 0; i < quickTagEntryPanels.size(); i++) {
            rowsString += "p, 3px, ";
        }
        rowsString = rowsString.substring(0, rowsString.length() - 5);
    }
    rowsString += "5px";

    FormLayout layout = new FormLayout("5px, 135, 5px, 135, 5px, f:210:g, 5px, p, 2px, p, 2px, p, 5px, p, 5px",
            rowsString);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setOpaque(true);

    CellConstraints cc = new CellConstraints();

    //add the headers
    int rowIndex = 2;
    builder.add(new JHeader(Messages.getString("ML.QuickTagDialog.Header.Name")),
            cc.xy(2, rowIndex, CellConstraints.CENTER, CellConstraints.DEFAULT));
    builder.add(new JHeader(Messages.getString("ML.QuickTagDialog.Header.TagName")),
            cc.xy(4, rowIndex, CellConstraints.CENTER, CellConstraints.DEFAULT));
    builder.add(new JHeader(Messages.getString("ML.QuickTagDialog.Header.TagValue")),
            cc.xy(6, rowIndex, CellConstraints.CENTER, CellConstraints.DEFAULT));
    builder.add(new JHeader(Messages.getString("ML.QuickTagDialog.Header.HotKey")),
            cc.xyw(8, rowIndex, 5, CellConstraints.CENTER, CellConstraints.DEFAULT));

    //add the entries
    for (QuickTagEntryPanel pEntry : quickTagEntryPanels) {
        rowIndex += 2;

        builder.add(pEntry.getTfName(), cc.xy(2, rowIndex));
        builder.add(pEntry.getCbTagName(), cc.xy(4, rowIndex));
        builder.add(pEntry.getCbTagValue(), cc.xy(6, rowIndex));
        builder.add(pEntry.getCbKeyCombination(), cc.xy(8, rowIndex));
        builder.addLabel("+", cc.xy(10, rowIndex));
        builder.add(pEntry.getCbVirtualKey(), cc.xy(12, rowIndex));
        builder.add(pEntry.getbDelete(), cc.xy(14, rowIndex));
    }

    removeAll();

    JScrollPane spMain = new JScrollPane(builder.getPanel());
    spMain.setBorder(BorderFactory.createEmptyBorder());

    add(spMain);

    validate();
    repaint();
}

From source file:net.pms.medialibrary.gui.shared.FilterEditor.java

License:Open Source License

private void refreshPanel() {
    PanelBuilder builder;/*from   w  w  w.j a  v a 2  s  .  c o  m*/
    CellConstraints cc = new CellConstraints();

    FormLayout layout = new FormLayout("3px, p, 3px, fill:50:grow, 3px, p, 3px", // columns
            "3px, fill:30:grow, 3px, p, p"); // rows
    builder = new PanelBuilder(layout);
    builder.setOpaque(true);

    PanelBuilder conBuilder;
    FormLayout conLayout = new FormLayout("3px, r:p, 3px, p, 3px, fill:p, 3px, fill:10:grow, 3px, p, 3px", // columns
            "p, p, p, p, p, p, p, p, p, p, " + "p, p, p, p, p, p, p, p, p, p, "
                    + "p, p, p, p, p, p, p, p, p, p, " + "p, p, p, p, p, p, p, p, p, p, fill:p:grow"); // rows
    conBuilder = new PanelBuilder(conLayout);
    conBuilder.setOpaque(true);

    // Conditions
    if (conditionPanelsList.size() > 0) {
        // Add conditions if we've got any
        for (int i = 0; i < conditionPanelsList.size(); i++) {
            conBuilder.add(conditionPanelsList.get(i).getlName(), cc.xy(2, i + 1));
            conBuilder.add(conditionPanelsList.get(i).getCbConditionType(), cc.xy(4, i + 1));
            conBuilder.add(conditionPanelsList.get(i).getConditionOperatorPanel(), cc.xy(6, i + 1));
            conBuilder.add(conditionPanelsList.get(i).getCCondtion(), cc.xy(8, i + 1));
            conBuilder.add(conditionPanelsList.get(i).getBRemove(), cc.xy(10, i + 1));
        }
    } else {
        // Show the 'no conditions set' label if there are none
        conBuilder.add(pNoConditionsSet, cc.xyw(2, 41, 9, CellConstraints.CENTER, CellConstraints.CENTER));
    }
    spConditions.setViewportView(conBuilder.getPanel());

    builder.add(spConditions, cc.xyw(2, 2, 5));
    builder.add(lEquation, cc.xy(2, 4));
    builder.add(tfEquation, cc.xy(4, 4));
    builder.add(cbEditEquation, cc.xy(6, 4));
    builder.add(pNewCondition, cc.xyw(2, 5, 5));

    removeAll();

    add(builder.getPanel());
    validate();
}

From source file:net.pms.medialibrary.gui.tab.ManagedFoldersPanel.java

License:Open Source License

private void applyLayout() {
    FormLayout layout = new FormLayout("fill:p:grow", // columns
            "fill:10:grow, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setOpaque(true);//from ww  w .j  av a  2s. c  o m

    CellConstraints cc = new CellConstraints();

    builder.add(bAddFolder, cc.xy(1, 2, CellConstraints.CENTER, CellConstraints.BOTTOM));

    FormLayout layout2 = new FormLayout(
            "center:p, 2px, 20:grow, 2px, p, 2px, p, 10px, center:p, 2px, center:p, 2px, center:p, 10px, p, 2px, p, 10px, p", // columns
            "p, p, p, p, p, p, p, p, p, p," + // rows (40)
                    "p, p, p, p, p, p, p, p, p, p," + "p, p, p, p, p, p, p, p, p, p,"
                    + "p, p, p, p, p, p, p, p, p, p");
    PanelBuilder builder2 = new PanelBuilder(layout2);

    // show folders if there are any
    JPanel pManagedFolders;
    if (managedFolders.size() > 0) {
        //create labels with tooltips
        JLabel lSubFolders = new JLabel(
                new ImageIcon(getClass().getResource("/resources/images/subfolders-16.png")));
        lSubFolders.setToolTipText(Messages.getString("ML.ManagedFoldersPanel.lSubfolders"));
        JLabel lVideo = new JLabel(
                new ImageIcon(getClass().getResource("/resources/images/videofolder-16.png")));
        lVideo.setToolTipText(Messages.getString("ML.ManagedFoldersPanel.lVideo"));
        JLabel lAudio = new JLabel(
                new ImageIcon(getClass().getResource("/resources/images/audiofolder-16.png")));
        lAudio.setToolTipText(Messages.getString("ML.ManagedFoldersPanel.lAudio"));
        JLabel lPictures = new JLabel(
                new ImageIcon(getClass().getResource("/resources/images/picturesfolder-16.png")));
        lPictures.setToolTipText(Messages.getString("ML.ManagedFoldersPanel.lPictures"));

        // set headers
        builder2.add(lSubFolders, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
        builder2.addLabel(Messages.getString("ML.ManagedFoldersPanel.lFolderPath"),
                cc.xy(3, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
        builder2.add(lVideo, cc.xy(9, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
        builder2.add(lAudio, cc.xy(11, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
        builder2.add(lPictures, cc.xy(13, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
        builder2.addLabel(Messages.getString("ML.ManagedFoldersPanel.lPlugins"),
                cc.xyw(15, 1, 3, CellConstraints.CENTER, CellConstraints.DEFAULT));

        int rowIndex = 2;
        for (ManagedFolderObj f : managedFolders) {
            f.setIndex(rowIndex - 2);
            builder2.add(f.getCbSubFolders(), cc.xy(1, rowIndex));
            builder2.add(f.getTfFolderPath(), cc.xy(3, rowIndex));
            builder2.add(f.getbBrowse(), cc.xy(5, rowIndex));
            builder2.add(f.getbDelete(), cc.xy(7, rowIndex));
            builder2.add(f.getCbVideo(), cc.xy(9, rowIndex));
            builder2.add(f.getCbAudio(), cc.xy(11, rowIndex));
            builder2.add(f.getCbPictures(), cc.xy(13, rowIndex));
            builder2.add(f.getCbEnablePlugins(), cc.xy(15, rowIndex));
            builder2.add(f.getbConfigureFileImportTemplate(), cc.xy(17, rowIndex));
            builder2.add(f.getbScan(), cc.xy(19, rowIndex));
            rowIndex++;
        }
        pManagedFolders = builder2.getPanel();
    } else {
        pManagedFolders = new JPanel(new GridLayout());
        pManagedFolders.add(
                new JLabel(Messages.getString("ML.ManagedFoldersPanel.pNoFoldersConfigures"), JLabel.CENTER));
    }

    JScrollPane sp = new JScrollPane(pManagedFolders);
    sp.setBorder(BorderFactory.createEmptyBorder());
    builder.add(sp, cc.xy(1, 1));

    removeAll();
    add(builder.getPanel());
    validate();
}