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

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

Introduction

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

Prototype

public CellConstraints xy(int col, int row) 

Source Link

Document

Sets column and row origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1); cc.xy(1, 3); 

Usage

From source file:com.audiveris.installer.BasicCompanionView.java

License:Open Source License

private JPanel defineLayout() {
    // Prepare layout elements
    final boolean optional = companion.getNeed() != Need.MANDATORY;
    final CellConstraints cst = new CellConstraints();
    final String colSpec = optional ? "pref,1dlu,center:pref" : "center:pref";
    final FormLayout layout = new FormLayout(colSpec, "center:20dlu");
    final JPanel panel = new MyPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);

    // Now add the desired components, using provided order
    if (optional) {
        builder.add(needBox, cst.xy(1, 1));
        builder.add(titleLabel, cst.xy(3, 1));
    } else {/*from  w  w w.  j  a  v  a  2 s  .  co m*/
        builder.add(titleLabel, cst.xy(1, 1));
    }

    panel.setPreferredSize(new Dimension(width, HEIGHT));
    panel.setOpaque(true);

    return panel;
}

From source file:com.audiveris.installer.BundleView.java

License:Open Source License

/**
 * Build the sub-panel that displays the sequence of companions.
 *
 * @return the companion panel//w  w  w .j  a v a  2 s.  c o m
 */
private JPanel buildCompPanel() {
    // Prepare layout elements
    final String hGap = "$lcgap";
    final StringBuilder sbcol = new StringBuilder();

    for (Companion companion : bundle.getCompanions()) {
        sbcol.append("pref,").append(hGap).append(",");
    }

    final CellConstraints cst = new CellConstraints();
    final FormLayout layout = new FormLayout(sbcol.toString(), "pref");
    final JPanel panel = new JPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);

    // Now add the desired components, using provided order
    int col = 1;

    for (Companion companion : bundle.getCompanions()) {
        CompanionView view = companion.getView();
        builder.add(view.getComponent(), cst.xy(col, 1));
        col += 2;
    }

    return panel;
}

From source file:com.audiveris.installer.BundleView.java

License:Open Source License

/**
 * Build the top panel that displays the sequence of companions,
 * the language selector and the install folder selector.
 *
 * @return the top panel/*from ww  w.  j a v a2 s. co m*/
 */
private JPanel buildNorthPanel() {
    // Prepare layout elements
    final FormLayout layout = new FormLayout("$lcgap, fill:0:grow, $lcgap", "$rgap, pref, $rgap, pref, $rgap");
    final JPanel panel = new JPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);
    final CellConstraints cst = new CellConstraints();

    int iRow = 0;

    // FolderSelector is currently disabled
    //        iRow +=2;
    //        // Add the folder selector
    //        FolderSelector dirSelector = new FolderSelector(bundle);
    //        builder.add(dirSelector.getComponent(), cst.xy(2, iRow));

    // Add the languages component
    iRow += 2;

    LangSelector langSelector = bundle.getOcrCompanion().getSelector();
    builder.add(langSelector.getComponent(), cst.xy(2, iRow));

    // Add the companions component
    iRow += 2;
    builder.add(buildCompPanel(), cst.xy(2, iRow));

    return panel;
}

From source file:com.audiveris.installer.FolderSelector.java

License:Open Source License

private JComponent defineLayout() {
    final JPanel comp = new JPanel();
    final FormLayout layout = new FormLayout("right:36dlu, $lcgap, fill:0:grow, $lcgap, 31dlu", "pref");
    final CellConstraints cst = new CellConstraints();
    final PanelBuilder builder = new PanelBuilder(layout, comp);

    // Label on left side
    builder.addROLabel("Folder", cst.xy(1, 1));

    // Path to folder
    builder.add(path, cst.xy(3, 1));//from  ww  w . j  a  v a 2 s .c  om

    // "Select" button on left side
    builder.add(new JButton(new BrowseAction()), cst.xy(5, 1));

    return comp;
}

From source file:com.audiveris.installer.LangSelector.java

License:Open Source License

private JPanel defineLayout() {
    final JPanel comp = new JPanel();
    final FormLayout layout = new FormLayout("right:40dlu, $lcgap, fill:0:grow, $lcgap, 33dlu", "pref");
    final CellConstraints cst = new CellConstraints();
    final PanelBuilder builder = new PanelBuilder(layout, comp);

    // Label on left side
    builder.addROLabel("Languages", cst.xy(1, 1));

    // "Banner" for the center of the line
    banner = new Banner();
    builder.add(banner.getComponent(), cst.xy(3, 1));

    // "Add" button on right side
    JButton button = new JButton(new AddAction());
    builder.add(button, cst.xy(5, 1));//  w ww.  j a va2 s.c  o m

    return comp;
}

From source file:com.aw.swing.mvp.cmp.pick.FrmPickDocVenta.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from w  ww  .  j a v a2 s.c  o  m*/
 */
private void $$$setupUI$$$() {
    createUIComponents();
    pnlMain = new JPanel();
    pnlMain.setLayout(new FormLayout(
            "left:25dlu:noGrow,fill:52dlu:noGrow,left:8dlu:noGrow,fill:56dlu:noGrow,left:4dlu:noGrow,fill:36px:noGrow,fill:max(d;4px):noGrow,left:57dlu:noGrow,fill:10px:noGrow,fill:54dlu:noGrow,left:16dlu:noGrow",
            "center:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,top:6dlu:noGrow,top:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:146dlu:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:max(d;4dlu):noGrow,center:12dlu:noGrow"));
    pnlMain.setMinimumSize(new Dimension(501, 425));
    pnlMain.setOpaque(true);
    pnlMain.setPreferredSize(new Dimension(501, 425));
    lblSearch = new JLabel();
    lblSearch.setHorizontalAlignment(4);
    lblSearch.setText("Descripcin");
    lblSearch.setDisplayedMnemonic('D');
    lblSearch.setDisplayedMnemonicIndex(0);
    CellConstraints cc = new CellConstraints();
    pnlMain.add(lblSearch, cc.xyw(1, 3, 2, CellConstraints.FILL, CellConstraints.DEFAULT));
    btnSearch = new JButton();
    btnSearch.setText("Buscar");
    btnSearch.setMnemonic('B');
    btnSearch.setDisplayedMnemonicIndex(0);
    pnlMain.add(btnSearch, cc.xy(10, 3));
    footerPanel.setLayout(
            new FormLayout("fill:73dlu:noGrow,left:191dlu:noGrow,fill:48dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(footerPanel, cc.xyw(1, 15, 11, CellConstraints.DEFAULT, CellConstraints.FILL));
    lblF10 = new JLabel();
    lblF10.setText(" [F10] Aceptar");
    footerPanel.add(lblF10, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    lblEsc = new JLabel();
    lblEsc.setText(" [Esc] Salir");
    footerPanel.add(lblEsc, cc.xy(3, 1));
    sepCriterioBusqueda.setSeparatorTitle("Criterio de Bsqueda");
    pnlMain.add(sepCriterioBusqueda, cc.xyw(1, 1, 11, CellConstraints.FILL, CellConstraints.FILL));
    pnlTitGrid.setLayout(
            new FormLayout("fill:204dlu:noGrow,left:88dlu:noGrow,fill:15dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(pnlTitGrid, cc.xyw(1, 10, 11, CellConstraints.FILL, CellConstraints.FILL));
    lblTitGrid = new JLabel();
    lblTitGrid.setText(" Relacin :");
    lblTitGrid.setDisplayedMnemonic('R');
    lblTitGrid.setDisplayedMnemonicIndex(1);
    pnlTitGrid.add(lblTitGrid, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    chkSel = new JCheckBox();
    chkSel.setBackground(new Color(-16747105));
    chkSel.setText("");
    pnlTitGrid.add(chkSel, cc.xy(3, 1));
    final JScrollPane scrollPane1 = new JScrollPane();
    scrollPane1.setMinimumSize(new Dimension(454, 418));
    pnlMain.add(scrollPane1, cc.xyw(1, 11, 11, CellConstraints.FILL, CellConstraints.FILL));
    tblGrid = new JTable();
    tblGrid.setMinimumSize(new Dimension(450, 400));
    scrollPane1.setViewportView(tblGrid);
    final JLabel label1 = new JLabel();
    label1.setText(" Nmero de Registros:");
    pnlMain.add(label1, cc.xyw(1, 13, 3));
    lblNumRegistros = new JLabel();
    lblNumRegistros.setText("Label");
    pnlMain.add(lblNumRegistros, cc.xyw(4, 13, 6));
    txtSearch = new JTextField();
    pnlMain.add(txtSearch, cc.xyw(4, 3, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblFecIni = new JLabel();
    lblFecIni.setText("Fecha del");
    pnlMain.add(lblFecIni, cc.xy(2, 5, CellConstraints.RIGHT, CellConstraints.CENTER));
    lblFecFin = new JLabel();
    lblFecFin.setText("al");
    pnlMain.add(lblFecFin, cc.xy(6, 5, CellConstraints.RIGHT, CellConstraints.CENTER));
    txtFecIni = new JTextField();
    pnlMain.add(txtFecIni, cc.xy(4, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    txtFecFin = new JTextField();
    pnlMain.add(txtFecFin, cc.xy(8, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblEntInm = new JLabel();
    lblEntInm.setHorizontalAlignment(4);
    lblEntInm.setText("Entrega Inmediata");
    pnlMain.add(lblEntInm, cc.xyw(1, 7, 2, CellConstraints.FILL, CellConstraints.CENTER));
    cmbEntInm = new JComboBox();
    pnlMain.add(cmbEntInm, cc.xy(4, 7));
    lblSearch.setLabelFor(txtSearch);
    lblFecIni.setLabelFor(txtSearch);
    lblFecFin.setLabelFor(txtSearch);
    lblEntInm.setLabelFor(txtSearch);
}

From source file:com.aw.swing.mvp.cmp.pick.FrmPickMovAlm.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from   www. j a  v a  2 s.  co  m
 */
private void $$$setupUI$$$() {
    createUIComponents();
    pnlMain = new JPanel();
    pnlMain.setLayout(new FormLayout(
            "left:25dlu:noGrow,fill:52dlu:noGrow,left:8dlu:noGrow,fill:43dlu:noGrow,left:10dlu:noGrow,fill:13px:noGrow,left:19dlu:noGrow,fill:8px:noGrow,left:56dlu:noGrow,fill:10px:noGrow,fill:50dlu:noGrow,left:22dlu:noGrow",
            "center:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,top:5dlu:noGrow,center:12dlu:noGrow,top:3dlu:noGrow,center:18px:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:149dlu:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:max(d;4dlu):noGrow,center:12dlu:noGrow"));
    pnlMain.setMinimumSize(new Dimension(501, 425));
    pnlMain.setOpaque(true);
    pnlMain.setPreferredSize(new Dimension(501, 425));
    lblSearch = new JLabel();
    lblSearch.setText("Descripcin");
    lblSearch.setDisplayedMnemonic('D');
    lblSearch.setDisplayedMnemonicIndex(0);
    CellConstraints cc = new CellConstraints();
    pnlMain.add(lblSearch, cc.xyw(1, 3, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    btnSearch = new JButton();
    btnSearch.setText("Buscar");
    btnSearch.setMnemonic('B');
    btnSearch.setDisplayedMnemonicIndex(0);
    pnlMain.add(btnSearch, cc.xy(11, 3));
    footerPanel.setLayout(
            new FormLayout("fill:73dlu:noGrow,left:191dlu:noGrow,fill:48dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(footerPanel, cc.xyw(1, 14, 12, CellConstraints.DEFAULT, CellConstraints.FILL));
    lblF10 = new JLabel();
    lblF10.setText(" [F10] Aceptar");
    footerPanel.add(lblF10, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    lblEsc = new JLabel();
    lblEsc.setText(" [Esc] Salir");
    footerPanel.add(lblEsc, cc.xy(3, 1));
    sepCriterioBusqueda.setSeparatorTitle("Criterio de Bsqueda");
    pnlMain.add(sepCriterioBusqueda, cc.xyw(1, 1, 12, CellConstraints.FILL, CellConstraints.FILL));
    pnlTitGrid.setLayout(
            new FormLayout("fill:204dlu:noGrow,left:88dlu:noGrow,fill:15dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(pnlTitGrid, cc.xyw(1, 9, 12, CellConstraints.FILL, CellConstraints.FILL));
    lblTitGrid = new JLabel();
    lblTitGrid.setText(" Relacin :");
    lblTitGrid.setDisplayedMnemonic('R');
    lblTitGrid.setDisplayedMnemonicIndex(1);
    pnlTitGrid.add(lblTitGrid, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    chkSel = new JCheckBox();
    chkSel.setBackground(new Color(-16747105));
    chkSel.setText("");
    pnlTitGrid.add(chkSel, cc.xy(3, 1));
    final JScrollPane scrollPane1 = new JScrollPane();
    scrollPane1.setMinimumSize(new Dimension(454, 418));
    pnlMain.add(scrollPane1, cc.xyw(1, 10, 12, CellConstraints.FILL, CellConstraints.FILL));
    tblGrid = new JTable();
    tblGrid.setMinimumSize(new Dimension(450, 400));
    scrollPane1.setViewportView(tblGrid);
    final JLabel label1 = new JLabel();
    label1.setText(" Nmero de Registros:");
    pnlMain.add(label1, cc.xyw(1, 12, 3));
    lblNumRegistros = new JLabel();
    lblNumRegistros.setText("Label");
    pnlMain.add(lblNumRegistros, cc.xyw(4, 12, 7));
    txtSearch = new JTextField();
    pnlMain.add(txtSearch, cc.xyw(4, 3, 6, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblSearch2 = new JLabel();
    lblSearch2.setText("Descripcin2");
    lblSearch2.setDisplayedMnemonic('D');
    lblSearch2.setDisplayedMnemonicIndex(0);
    pnlMain.add(lblSearch2, cc.xyw(1, 7, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    cmbAlmacen = new JComboBox();
    pnlMain.add(cmbAlmacen, cc.xyw(4, 7, 6));
    lblFecIni = new JLabel();
    lblFecIni.setText("Fecha del");
    pnlMain.add(lblFecIni, cc.xyw(1, 5, 2, CellConstraints.RIGHT, CellConstraints.CENTER));
    txtFecIni = new JTextField();
    pnlMain.add(txtFecIni, cc.xyw(4, 5, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblFecFin = new JLabel();
    lblFecFin.setText("al");
    pnlMain.add(lblFecFin, cc.xy(7, 5, CellConstraints.RIGHT, CellConstraints.CENTER));
    txtFecFin = new JTextField();
    pnlMain.add(txtFecFin, cc.xy(9, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblSearch.setLabelFor(txtSearch);
    lblSearch2.setLabelFor(txtSearch);
    lblFecIni.setLabelFor(txtSearch);
    lblFecFin.setLabelFor(txtSearch);
}

From source file:com.aw.swing.mvp.grid.GridManager.java

License:Open Source License

private void configureGridTitleColor() {
    JPanel pnlGrid = ipView.getPnlGrid(gridIndex);
    pnlGrid.setBorder(BorderFactory.createLineBorder(new Color(131, 172, 219)));

    JPanel pnlTitGrid = ipView.getPnlTitGrid(gridIndex);
    pnlTitGrid.setBackground(new Color(131, 172, 219));
    pnlTitGrid.setLayout(/*  ww w  . j  ava2 s.c o  m*/
            new FormLayout("fill:16dlu:noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,right:pref:grow",
                    "center:16dlu:noGrow"));
    JLabel lblTitGrid = ipView.getLblTitGrid(gridIndex);
    lblTitGrid.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14));
    lblTitGrid.setForeground(Color.black);

    numRecords = new JLabel("");
    numRecords.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14));
    numRecords.setForeground(Color.black);
    numRecords.setVisible(showTotalRegistros);

    pnlTitGrid.remove(lblTitGrid);
    CellConstraints cc = new CellConstraints();
    pnlTitGrid.add(lblTitGrid, cc.xy(3, 1));
    pnlTitGrid.add(numRecords, cc.xy(5, 1));

}

From source file:com.aw.swing.mvp.ui.FormLayout.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from w ww.  ja  va2s  . co m
 */
private void $$$setupUI$$$() {
    createUIComponents();
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout(0, 0));
    mainPanel.setPreferredSize(new Dimension(600, 400));
    mainPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null));
    contentPanel = new JPanel();
    contentPanel.setLayout(new com.jgoodies.forms.layout.FormLayout(
            "fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow", "center:max(d;4px):noGrow"));
    mainPanel.add(contentPanel, BorderLayout.CENTER);
    contentPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10), null));
    headerPanel = new JPanel();
    headerPanel.setLayout(new com.jgoodies.forms.layout.FormLayout("fill:d:grow",
            "center:52px:noGrow,center:max(d;4px):noGrow"));
    headerPanel.setPreferredSize(new Dimension(0, 74));
    mainPanel.add(headerPanel, BorderLayout.NORTH);
    titlePanel.setLayout(new BorderLayout(0, 0));
    titlePanel.setBackground(new Color(-1));
    titlePanel.setMinimumSize(new Dimension(0, 50));
    titlePanel.setPreferredSize(new Dimension(0, 60));
    CellConstraints cc = new CellConstraints();
    headerPanel.add(titlePanel, cc.xy(1, 1));
    titlePanel.add(formTitle, BorderLayout.CENTER);
    errorPanel.setLayout(new com.jgoodies.forms.layout.FormLayout("fill:d:grow", "center:d:grow"));
    errorPanel.setBackground(new Color(-52378));
    errorPanel.setPreferredSize(new Dimension(0, 30));
    headerPanel.add(errorPanel, cc.xy(1, 2));
    lblErrorMessage.setFont(
            new Font(lblErrorMessage.getFont().getName(), Font.BOLD, lblErrorMessage.getFont().getSize()));
    lblErrorMessage.setForeground(new Color(-1));
    lblErrorMessage.setHorizontalAlignment(2);
    lblErrorMessage.setHorizontalTextPosition(11);
    lblErrorMessage.setMinimumSize(new Dimension(128, 18));
    lblErrorMessage.setText("El campo es requerido");
    errorPanel.add(lblErrorMessage, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
}

From source file:com.aw.swing.mvp.ui.painter.ErrorBorderPainter.java

License:Open Source License

public void paintError(List components) {
    clearError(components);/* w  w w . j  av a 2 s. com*/
    for (Iterator iterator = components.iterator(); iterator.hasNext();) {
        BindingComponent bindingComponent = (BindingComponent) iterator.next();
        JLabel label = (JLabel) ((JComponent) bindingComponent.getJComponent())
                .getClientProperty(BindingComponent.ATTR_ICONO);
        if (label != null) {
            return;
        }
        logger.debug("creating icon for " + bindingComponent.getFieldName());
        JComponent feedbackComponent = createFeedbackComponent();
        if (feedbackComponent == null) {
            return;
        }
        Container container = bindingComponent.getJComponent().getParent();
        // GMC Todo  ver q pasa cuando no se envia null ->  Ver como manejar este caso para los diferentes layouts       
        //            container.add(feedbackComponent, null);
        CellConstraints cc = new CellConstraints();
        container.add(feedbackComponent, cc.xy(1, 1));
        Point overlayPosition = getFeedbackComponentOrigin(feedbackComponent, bindingComponent.getJComponent());
        overlayPosition.translate(-3, +2);
        feedbackComponent.setLocation(overlayPosition);

        FormLayout layout = ((FormLayout) container.getLayout());
        CellConstraints cc1 = layout.getConstraints(bindingComponent.getJComponent());

        container.add(feedbackComponent,
                cc1.xy(cc1.gridX - 1, cc1.gridY + 1, CellConstraints.RIGHT, CellConstraints.BOTTOM));

        bindingComponent.getJComponent().putClientProperty(BindingComponent.ATTR_ICONO, feedbackComponent);
    }
}