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

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

Introduction

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

Prototype

public CellConstraints xywh(int col, int row, int colSpan, int rowSpan) 

Source Link

Document

Sets the column, row, width, and height; uses default alignments.

Examples:

 cc.xywh(1, 3, 2, 1); cc.xywh(1, 3, 7, 3); 

Usage

From source file:cz.vity.freerapid.gui.dialogs.userprefs.PluginDetailPanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    //ResourceBundle bundle = ResourceBundle.getBundle("PluginDetails");
    titleSeparator = new JXTitledSeparator();
    JLabel labelVersion = new JLabel();
    versionLabel = new JLabel();
    JLabel labelAuthor = new JLabel();
    authorLabel = new JLabel();
    JLabel labelServices = new JLabel();
    servicesLabel = new JLabel();
    checkboxPluginIsActive = new JCheckBox();
    checkboxUpdatePlugins = new JCheckBox();
    checkboxClipboardMonitoring = new JCheckBox();
    JLabel labelMaxConnections = new JLabel();
    labelMaxConnections.setPreferredSize(new Dimension(80, 20));
    labelMaxConnections.setMinimumSize(new Dimension(80, 20));
    spinnerMaxPluginConnections = new JSpinner();
    JLabel labelPriority = new JLabel();
    spinnerPluginPriority = new JSpinner();
    btnPriorityUp = new JButton();
    btnPriorityDown = new JButton();
    pluginHyperlink = new JXHyperlink();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setBorder(new EmptyBorder(3, 3, 0, 2));

    //---- titleSeparator ----
    titleSeparator.setTitle(" ");

    //---- labelVersion ----
    labelVersion.setName("labelVersion");

    //---- versionLabel ----
    versionLabel.setName("versionLabel");

    //---- labelAuthor ----
    labelAuthor.setName("labelAuthor");

    //---- authorLabel ----
    authorLabel.setName("authorLabel");

    //---- labelServices ----
    labelServices.setName("labelServices");

    //---- servicesLabel ----
    servicesLabel.setName("servicesLabel");

    //---- checkboxPluginIsActive ----
    checkboxPluginIsActive.setName("checkboxPluginIsActive");

    //---- checkboxUpdatePlugins ----
    checkboxUpdatePlugins.setName("checkboxUpdatePlugins");

    //---- checkboxClipboardMonitoring ----
    checkboxClipboardMonitoring.setName("checkboxClipboardMonitoring");

    //---- labelMaxConnections ----
    labelMaxConnections.setName("labelMaxConnections");
    labelMaxConnections.setPreferredSize(new Dimension(180, 14));

    //---- spinnerMaxPluginConnections ----
    spinnerMaxPluginConnections.setModel(new SpinnerNumberModel(1, 1, null, 1));

    //---- labelPriority ----
    labelPriority.setName("labelPriority");

    //---- spinnerPluginPriority ----
    spinnerPluginPriority.setModel(new SpinnerNumberModel(1, 1, 1000, 1));

    //---- btnPriorityUp ----
    btnPriorityUp.setName("btnPriorityUp");

    //---- btnPriorityDown ----
    btnPriorityDown.setName("btnPriorityDown");

    //---- pluginHyperlink ----
    pluginHyperlink.setName("pluginHyperlink");

    PanelBuilder builder = new PanelBuilder(new FormLayout(
            new ColumnSpec[] { FormSpecs.PREF_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                    ColumnSpec.decode("max(pref;30dlu)"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                    new ColumnSpec(ColumnSpec.FILL, Sizes.MINIMUM, FormSpec.DEFAULT_GROW) },
            new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                    new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }),
            this);
    ((FormLayout) getLayout()).setColumnGroups(new int[][] { { 7, 9 } });

    builder.add(titleSeparator, cc.xywh(1, 1, 11, 1));
    builder.add(labelVersion, cc.xy(1, 3));
    builder.add(versionLabel, cc.xywh(3, 3, 9, 1));
    builder.add(labelAuthor, cc.xy(1, 5));
    builder.add(authorLabel, cc.xywh(3, 5, 9, 1));
    builder.add(labelServices, cc.xy(1, 7));
    builder.add(servicesLabel, cc.xywh(3, 7, 7, 1));
    builder.add(checkboxPluginIsActive, cc.xywh(1, 9, 11, 1));
    builder.add(checkboxUpdatePlugins, cc.xywh(1, 11, 11, 1));
    builder.add(checkboxClipboardMonitoring, cc.xywh(1, 13, 11, 1));
    builder.add(labelMaxConnections, cc.xywh(1, 15, 3, 1));
    builder.add(spinnerMaxPluginConnections, cc.xy(5, 15));
    builder.add(labelPriority, cc.xywh(1, 17, 3, 1));
    builder.add(spinnerPluginPriority, cc.xy(5, 17));
    builder.add(btnPriorityUp, cc.xy(7, 17));
    builder.add(btnPriorityDown, cc.xy(9, 17));
    builder.add(pluginHyperlink, cc.xywh(1, 19, 9, 1));
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:de.atomfrede.tools.evalutation.ui.plant.PlantDataInputPanel.java

License:Open Source License

private void initialize() {
    NumberFormat nf = NumberFormat.getIntegerInstance();
    nf.setMinimumIntegerDigits(2);//w  w w.  j a  v  a2  s  .  c o m

    setLayout(new BorderLayout());

    FormLayout layout = new FormLayout(
            "pref, 4dlu, fill:pref:grow, 4dlu, pref, 4dlu, fill:pref:grow, 4dlu, pref"); //$NON-NLS-1$
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    CellConstraints cc = new CellConstraints();

    builder.append(Messages.getString("PlantDataInputPanel.2"), getStartPicker()); //$NON-NLS-1$
    builder.append(Messages.getString("PlantDataInputPanel.3"), getEndPicker()); //$NON-NLS-1$
    // builder.append(getDeleteButton());
    builder.nextLine();

    builder.append(Messages.getString("PlantDataInputPanel.0")); //$NON-NLS-1$
    builder.append(getStartDayPressureSpinner());

    builder.append(Messages.getString("PlantDataInputPanel.1")); //$NON-NLS-1$
    builder.append(getEndDayPressureSpinner());
    builder.nextLine();

    builder.append(Messages.getString("PlantDataInputPanel.4")); //$NON-NLS-1$
    builder.append(getLowerLeafAreaSpinner());

    builder.append(Messages.getString("PlantDataInputPanel.5")); //$NON-NLS-1$
    builder.append(getUpperLeafAreaSpinner());

    builder.add(getDeleteButton(), cc.xywh(9, 1, 1, 5));
    add(builder.getPanel(), BorderLayout.CENTER);

}

From source file:de.dal33t.powerfolder.net.DynDnsManager.java

License:Open Source License

/**
 * Setups the UI for the wait message box
 *
 * @param dyndns/*from w w w. j  a  v a 2  s .c  o m*/
 * @return
 */
protected final JDialog getUIComponent(String dyndns) {
    if (uiComponent == null) {
        logFiner("Building ui component for " + this);
        uiComponent = new JDialog(getController().getUIController().getMainFrame().getUIComponent(),
                getTitle());
        uiComponent.setResizable(false);

        uiComponent.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

        FormLayout layout = new FormLayout("pref, 14dlu, pref:grow", "pref, pref:grow, 6dlu, pref");
        PanelBuilder builder = new PanelBuilder(layout);
        builder.setBorder(Borders.DLU14_BORDER);

        CellConstraints cc = new CellConstraints();

        // Build
        int xpos = 1;
        int ypos = 1;
        int wpos = 1;
        int hpos = 1;
        builder.add(new JLabel(Translation.getTranslation("exp.preferences.dyn_dns.status_wait", dyndns)),
                cc.xywh(xpos, ypos, wpos, hpos));

        // Add panel to component
        uiComponent.getContentPane().add(builder.getPanel());

        uiComponent.pack();
        Component parent = uiComponent.getOwner();
        int x = parent.getX() + (parent.getWidth() - uiComponent.getWidth()) / 2;
        int y = parent.getY() + (parent.getHeight() - uiComponent.getHeight()) / 2;
        uiComponent.setLocation(x, y);
    }
    return uiComponent;
}

From source file:de.dal33t.powerfolder.ui.computers.ExpandableComputerView.java

License:Open Source License

/**
 * Builds the ui component.//from  ww  w.j a  v  a2s .co  m
 */
private void buildUI() {

    initComponent();

    // Build ui
    FormLayout upperLayout = new FormLayout("pref, 3dlu, pref, pref:grow, 3dlu, pref", "pref");
    PanelBuilder upperBuilder = new PanelBuilder(upperLayout);
    CellConstraints cc = new CellConstraints();

    upperBuilder.add(pictoLabel, cc.xy(1, 1));
    upperBuilder.add(infoLabel, cc.xy(3, 1));

    upperPanel = upperBuilder.getPanel();
    upperPanel.setOpaque(false);
    upperPanel.setToolTipText(Translation.getTranslation("exp.exp_computer_view.expand"));
    MouseAdapter ma = new MyMouseAdapter();
    upperPanel.addMouseListener(ma);
    CursorUtils.setHandCursor(upperPanel);
    pictoLabel.addActionListener(new PrimaryButtonActionListener());

    // Build lower details with line border.
    // last, qual rmve recon
    FormLayout lowerLayout = new FormLayout("pref, pref:grow, 3dlu, pref, 2dlu, pref, 2dlu, pref",
            "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref");
    // sep, last
    PanelBuilder lowerBuilder = new PanelBuilder(lowerLayout);
    lowerBuilder.setBorder(Borders.createEmptyBorder("0, 3dlu, 0, 3dlu"));

    lowerBuilder.addSeparator(null, cc.xyw(1, 1, 8));

    lowerBuilder.add(usernameLabel, cc.xy(1, 3));
    lowerBuilder.add(addRemoveButton, cc.xywh(6, 3, 1, 3));
    lowerBuilder.add(reconnectButton, cc.xywh(8, 3, 1, 3));
    lowerBuilder.add(lastSeenLabel, cc.xy(1, 5));
    if (getController().isVerbose()) {
        lowerBuilder.appendRow("3dlu");
        lowerBuilder.appendRow("pref");
        lowerBuilder.add(versionLabel, cc.xy(1, 7));
    }

    JPanel lowerPanel = lowerBuilder.getPanel();
    lowerPanel.setOpaque(false);

    // Build spacer then lower outer with lower panel
    FormLayout lowerOuterLayout = new FormLayout("pref:grow", "3dlu, pref");
    PanelBuilder lowerOuterBuilder = new PanelBuilder(lowerOuterLayout);
    lowerOuterPanel = lowerOuterBuilder.getPanel();
    lowerOuterPanel.setOpaque(false);
    lowerOuterPanel.setVisible(false);
    lowerOuterBuilder.add(lowerPanel, cc.xy(1, 2));

    // Build border around upper and lower
    FormLayout borderLayout = new FormLayout("3dlu, pref:grow, 3dlu", "3dlu, pref, pref, 3dlu");
    PanelBuilder borderBuilder = new PanelBuilder(borderLayout);
    borderBuilder.add(upperPanel, cc.xy(2, 2));
    JPanel panel = lowerOuterBuilder.getPanel();
    panel.setOpaque(false);
    borderBuilder.add(panel, cc.xy(2, 3));
    borderPanel = borderBuilder.getPanel();
    borderPanel.setOpaque(false);

    // Build ui with vertical space before the next one.
    FormLayout outerLayout = new FormLayout("3dlu, pref:grow, 3dlu", "pref, 3dlu");
    PanelBuilder outerBuilder = new PanelBuilder(outerLayout);
    outerBuilder.add(borderPanel, cc.xy(2, 1));

    uiComponent = outerBuilder.getPanel();
    uiComponent.setOpaque(false);

    uiComponent.setTransferHandler(new MyTransferHandler());
}

From source file:de.dal33t.powerfolder.ui.dialog.AboutDialog.java

License:Open Source License

private JPanel createRightPanel() {
    FormLayout layout = new FormLayout("pref:grow, pref:grow, pref:grow, pref:grow",
            "fill:pref:grow, fill:pref:grow");
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();
    builder.add(createGeneralPanel(), cc.xywh(1, 1, 2, 1));
    builder.add(powerFolder, cc.xy(1, 2));
    builder.add(system, cc.xy(2, 2));//  ww w. j  av  a  2 s  .c  om
    builder.add(team, cc.xy(3, 1));

    builder.add(translators, cc.xy(3, 2));
    builder.add(contributers, cc.xywh(4, 1, 1, 2));

    JPanel rightPanel = builder.getPanel();
    rightPanel.setBackground(Color.WHITE);
    return rightPanel;

}

From source file:de.dal33t.powerfolder.ui.dialog.ConnectDialog.java

License:Open Source License

private void initComponents() {
    // General dialog initalization
    uiComponent = new JDialog(owner, Translation.getTranslation("dialog.connect.connecting"),
            Dialog.ModalityType.MODELESS);

    // Cancel connect
    uiComponent.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            canceled = true;/*from   ww w  .ja  va  2  s .  c  om*/
            close();
        }
    });

    uiComponent.setResizable(false);

    JProgressBar bar = new JProgressBar();
    bar.setIndeterminate(true);
    infoText = new JLabel(Translation.getTranslation("dialog.connect.connecting"));

    // Cancel buttons
    JButton cancelButton = new JButton(Translation.getTranslation("general.cancel"));
    cancelButton.setMnemonic(Translation.getTranslation("general.cancel.key").charAt(0));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            canceled = true;
            close();
        }
    });
    JComponent buttonBar = ButtonBarFactory.buildCenteredBar(cancelButton);

    // Layout
    FormLayout layout = new FormLayout("20dlu, max(70dlu;pref):grow, max(70dlu;pref):grow, 20dlu",
            "pref, 14dlu, pref, 14dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.DLU14_BORDER);

    CellConstraints cc = new CellConstraints();

    // Add components
    builder.add(infoText, cc.xywh(1, 1, 4, 1));
    builder.add(bar, cc.xywh(2, 3, 2, 1));
    builder.add(buttonBar, cc.xywh(2, 5, 2, 1));

    uiComponent.getContentPane().add(builder.getPanel());
    uiComponent.pack();

    // Orientation
    Component parent = uiComponent.getOwner();
    if (parent != null) {
        int x = parent.getX() + (parent.getWidth() - uiComponent.getWidth()) / 2;
        int y = parent.getY() + (parent.getHeight() - uiComponent.getHeight()) / 2;
        uiComponent.setLocation(x, y);
    }
}

From source file:de.dal33t.powerfolder.ui.dialog.DownloadUpdateDialog.java

License:Open Source License

/**
 * Initalizes / builds all ui elements/*ww w.ja v  a 2s . c o m*/
 */
public void initComponents() {
    // General dialog initalization
    uiComponent = new JDialog(getUIController().getMainFrame().getUIComponent(),
            Translation.getTranslation("dialog.update.updating"), false);

    uiComponent.setResizable(false);
    uiComponent.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    uiComponent.addWindowListener(new WindowAdapter() {
        public void windowClosed(WindowEvent e) {
            canceled = true;
        }
    });

    // Cancel buttons
    JButton cancelButton = new JButton(Translation.getTranslation("general.cancel"));
    cancelButton.setMnemonic(Translation.getTranslation("general.cancel").charAt(0));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // Callback call to cancel
            cancelPressed();
        }
    });
    JComponent buttonBar = ButtonBarFactory.buildCenteredBar(cancelButton);

    // Progress bar
    processBar = new JProgressBar(SwingConstants.HORIZONTAL, 0, 100);

    // Layout
    FormLayout layout = new FormLayout("20dlu, max(70dlu;pref):grow, max(70dlu;pref):grow, 20dlu",
            "pref, 14dlu, pref, 14dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.DLU14_BORDER);
    CellConstraints cc = new CellConstraints();

    // Add components
    builder.addLabel(Translation.getTranslation("dialog.update.updating.text", version), cc.xywh(1, 1, 4, 1));
    builder.add(processBar, cc.xywh(2, 3, 2, 1));
    builder.add(buttonBar, cc.xywh(2, 5, 2, 1));

    uiComponent.getContentPane().add(builder.getPanel());
    uiComponent.pack();

    // Orientation
    Component parent = uiComponent.getOwner();
    if (parent != null) {
        int x = parent.getX() + (parent.getWidth() - uiComponent.getWidth()) / 2;
        int y = parent.getY() + (parent.getHeight() - uiComponent.getHeight()) / 2;
        uiComponent.setLocation(x, y);
    }
}

From source file:de.dal33t.powerfolder.ui.dialog.ErrorDialog.java

License:Open Source License

/**
 * Build the ui error details panel//  w  w w  .java 2s .  c o m
 */
private JPanel createErrorPanel() {
    FormLayout layout = new FormLayout("max(0;pref):grow,pref,pref", "max(0;pref):grow, pref, pref, pref");
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();
    builder.add(errorsField, cc.xywh(1, 1, 2, 3));
    JPanel panel = builder.getPanel();
    if (kindOfError == ErrorManager.ERROR) {
        title = BorderFactory.createTitledBorder("Error Details");
    }
    if (kindOfError == ErrorManager.WARN) {
        title = BorderFactory.createTitledBorder("Warning Details");
    }
    panel.setBorder(title);
    return panel;
}

From source file:de.dal33t.powerfolder.ui.dialog.ErrorDialog.java

License:Open Source License

/**
 * Build the ui general panel/* w w w.  j a v  a2s  .  c  o m*/
 */
private JPanel createGeneralPanel() {
    FormLayout layout = new FormLayout("max(0;pref):grow, pref", "pref, 3dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();
    if (kindOfError == ErrorManager.WARN) {
        builder.add(
                new JLabel(Translation.getTranslation("exp.preferences.dyn_dns_update_warning") + "  "
                        + getController().getDynDnsManager().activeDynDns.getErrorShortText() + "  "),
                cc.xywh(1, 1, 1, 1));

    }
    if (kindOfError == ErrorManager.ERROR) {
        builder.add(
                new JLabel(Translation.getTranslation("exp.preferences.dyn_dns.update_error") + "  "
                        + getController().getDynDnsManager().activeDynDns.getErrorShortText() + "  "),
                cc.xywh(1, 1, 1, 1));
    }
    JPanel panel = builder.getPanel();
    return panel;
}

From source file:de.dal33t.powerfolder.ui.dialog.ErrorDialog.java

License:Open Source License

/**
 * Build the ui component//from  w w  w.j  a v a 2  s .c  om
 *
 * @return
 */
protected final JDialog getUIComponent() {
    initComponents();

    if (uiComponent == null) {
        logFiner("Building ui component for " + this);
        uiComponent = new JDialog(getUIController().getMainFrame().getUIComponent(), getTitle(), modal);
        uiComponent.setResizable(false);
        uiComponent.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

        FormLayout layout = new FormLayout("max(0;pref):grow, 15dlu, pref, 6dlu, pref, pref", // max(0;pref):grow,
                // pref,
                // pref,pref,pref",
                "pref, 25dlu, pref, 25dlu, pref, 25dlu, pref, 25dlu, pref");

        PanelBuilder builder = new PanelBuilder(layout);
        builder.setBorder(Borders.DLU7_BORDER);

        final CellConstraints cc = new CellConstraints();

        // Build
        builder.add(getContent(), cc.xywh(1, 1, 4, 1));
        builder.add(getButtonBar(), cc.xywh(1, 2, 4, 1));
        builder.add(getErrorContent(), cc.xywh(1, 4, 4, 5));
        setDetailsPanelVisible(false);

        // Add panel to component
        uiComponent.getContentPane().add(builder.getPanel());

        uiComponent.pack();
        Component parent = uiComponent.getOwner();
        int x = parent.getX() + (parent.getWidth() - uiComponent.getWidth()) / 2;
        int y = parent.getY() + (parent.getHeight() - uiComponent.getHeight()) / 2;

        uiComponent.setSize(setPrefferedSize(uiComponent.getWidth(), h));
        uiComponent.setLocation(x, y);
    }
    return uiComponent;
}