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:fileCompare.gui.DisplayDuplicates.java

License:Open Source License

private JPanel buildPanel() {
    FormLayout layout = new FormLayout("50dlu, 4dlu, center:p:grow, 4dlu, 50dlu, 4dlu, 50dlu, 4dlu, 110dlu", //cols
            "p, 4dlu, p, 4dlu, p, 4dlu, p, 4dlu, bottom:m:grow(.3), 4dlu, p, 4dlu, p, 4dlu, m:grow(.7)"); //rows
    //layout.setRowGroups(new int[][]{ {9, 15}});
    //PanelBuilder builder = new PanelBuilder(new FormDebugPanel(),
    // layout);/* w w w  .j a va2s .  c  om*/
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    int y = 1;
    builder.addSeparator("Duplicate Files", cc.xywh(1, y++, 7, 1));
    y++;
    JScrollPane temp = new JScrollPane(currentDuplicates_);
    temp.getViewport().setBackground(Color.white);
    builder.add(temp, cc.xywh(1, y, 7, 7, "fill, fill"));
    builder.add(selectAll_, cc.xy(9, y++));
    y++;
    builder.add(deleteSelected_, cc.xy(9, y++));
    y++;
    builder.add(deleteFileDuplicates_, cc.xy(9, y++));
    y++;
    builder.add(openInSysEditor_, cc.xy(9, y++));
    y++;
    builder.add(previous_, cc.xy(1, y));
    builder.add(selected_, cc.xywh(3, y, 3, 1, "center, center"));
    builder.add(next_, cc.xy(7, y));
    builder.add(removeAll_, cc.xy(9, y++));
    y++;
    builder.addSeparator("File Preview", cc.xywh(1, y, 3, 1));
    builder.addSeparator("File Details", cc.xywh(5, y++, 5, 1));
    y++;
    builder.add(preview_, cc.xywh(1, y, 3, 1, "fill, fill"));
    JScrollPane temp2 = new JScrollPane(description_);
    builder.add(temp2, cc.xywh(5, y++, 5, 1, "fill, fill"));
    return builder.getPanel();
}

From source file:fileCompare.gui.FolderSelectionDialog.java

License:Open Source License

public JComponent buildPanel() {
    FormLayout layout = new FormLayout("pref:grow, 4dlu, pref",
            "pref, pref, 4dlu, pref, 4dlu, pref, 4dlu, pref, 4dlu:grow, pref, 4dlu, pref");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();/*from  ww  w.ja  va 2 s .co m*/
    CellConstraints cc = new CellConstraints();
    int y = 1;
    builder.addSeparator("Folders to search for duplicates in:", cc.xywh(1, y++, 3, 1));
    builder.add(new JScrollPane(folders), cc.xywh(1, y, 1, 11));
    builder.add(add, cc.xy(3, y++));
    y++;
    builder.add(remove, cc.xy(3, y++));
    y++;
    builder.add(recursive, cc.xy(3, y++));
    y++;
    builder.add(byteForByteCheck, cc.xy(3, y++));
    y++;
    builder.add(findDups, cc.xy(3, y++));
    y++;
    builder.add(exit, cc.xy(3, y++));
    return builder.getPanel();
}

From source file:gui.RecordSelectorList.java

License:Open Source License

public void createRecords() {
    FormLayout lay = new FormLayout("100dlu, 3dlu, pref, 3dlu, 100dlu", // columns
            "10dlu, p, 3dlu, p, 3dlu, p, 3dlu, p ,10dlu");// rows
    CellConstraints cc = new CellConstraints();
    PanelBuilder build = new PanelBuilder(lay);

    JScrollPane jcr = new JScrollPane(listBasicFull);
    listBasicFull.addListSelectionListener(this);
    JScrollPane jcr1 = new JScrollPane(listSelecFull);
    listSelecFull.addListSelectionListener(this);

    btnAgrU = new JButton();
    btnAgrU.setText(">");
    btnAgrU.addActionListener(this);

    btnAgrT = new JButton();
    btnAgrT.setText(">>");
    btnAgrT.addActionListener(this);

    btnQutU = new JButton();
    btnQutU.setText("<");
    btnQutU.addActionListener(this);

    btnQutT = new JButton();
    btnQutT.setText("<<");
    btnQutT.addActionListener(this);

    preValidate(null);/*from  w  w  w.  ja  v a2 s .co  m*/
    build.add(jcr, cc.xywh(1, 1, 1, 9));

    build.add(btnAgrU, cc.xy(3, 2));
    build.add(btnAgrT, cc.xy(3, 4));
    build.add(btnQutU, cc.xy(3, 6));
    build.add(btnQutT, cc.xy(3, 8));

    build.add(jcr1, cc.xywh(5, 1, 1, 9));
    add(build.getPanel());

    this.setVisible(true);
}

From source file:hu.pagavcs.client.gui.ApplyPatchGui.java

License:Open Source License

public void display() throws SVNException {
    FormLayout layout = new FormLayout("right:p, 2dlu,p:g, p",
            "p,2dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,4dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();

    Label lblWorkingCopy = new Label("Path:");
    sfWorkingCopy = new EditField(other.getPath());
    sfWorkingCopy.setEditable(false);/*from w ww  .  ja  va 2  s  . c  om*/
    Label lblRepo = new Label("Repository:");
    sfRepo = new EditField();
    sfRepo.setEditable(false);
    btnShowLog = new JButton(new ShowLogAction());

    btnApplyPatch = new JButton(new ApplyPatchAction());

    lblStatus = new Label(" ");
    prgBusy = new ProgressBar(this);

    pnlMain.add(lblWorkingCopy, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfWorkingCopy, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblRepo, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfRepo, cc.xywh(3, 3, 2, 1));
    pnlMain.add(btnShowLog, cc.xywh(4, 5, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 6, 4, 1));
    pnlMain.add(btnApplyPatch, cc.xywh(4, 7, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 8, 4, 1));
    pnlMain.add(prgBusy, cc.xywh(1, 9, 3, 1));
    pnlMain.add(lblStatus, cc.xywh(4, 9, 1, 1));

    frame = GuiHelper.createAndShowFrame(pnlMain, "Other", "other-app-icon.png");
    frame.setTitlePrefix(other.getPath());
}

From source file:hu.pagavcs.client.gui.BlameGui.java

License:Open Source License

public void display() {

    FormLayout layout = new FormLayout("p, 2dlu,p:g,2dlu, p", "p,2dlu,p,2dlu,fill:4dlu:g,2dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();

    tableModel = new TableModel<BlameListItem>(new BlameListItem());

    tblBlame = new Table<BlameListItem>(tableModel);
    tblBlame.addMouseListener(new PopupupMouseListener());
    new BlameCellRenderer(tblBlame);
    JScrollPane scrollPane = new JScrollPane(tblBlame);

    btnStop = new JButton("Stop");
    btnStop.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            try {
                if (prgBusy.isWorking()) {
                    btnStop.setEnabled(false);
                    blameOperation.setCancel(true);
                } else {
                    frame.setVisible(false);
                    frame.dispose();/*from   w  ww .j  av a2  s. co  m*/
                }
            } catch (Exception e1) {
                Manager.handle(e1);
            }
        }
    });

    btnBlame = new JButton("Blame");
    btnBlame.setEnabled(false);
    btnBlame.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            try {
                prgBusy.startProgress();
                tblBlame.hideMessage();
                new Thread(new Runnable() {

                    public void run() {
                        try {
                            try {
                                final List<BlameListItem> lstBlame = blameOperation
                                        .doBlame(blameOperation.getPath(), sfRevision.getText());
                                new OnSwing() {

                                    protected void process() throws Exception {
                                        setStatus(GeneralStatus.COMPLETED);
                                        tableModel.clear();
                                        tableModel.addLines(lstBlame);
                                        prgBusy.stopProgress();
                                    }

                                }.run();
                            } catch (SVNCancelException ex) {
                                new OnSwing() {

                                    protected void process() throws Exception {
                                        btnStop.setEnabled(true);
                                        prgBusy.stopProgress();
                                    }
                                }.run();
                            }

                        } catch (Exception e1) {
                            Manager.handle(e1);
                        }
                    }
                }).start();

            } catch (Exception e1) {
                Manager.handle(e1);
            }
        }
    });

    prgBusy = new ProgressBar(this);

    Label lblRepo = new Label("Repository:");
    sfRepo = new EditField();
    sfRepo.setEditable(false);
    lblStatus = new Label(" ");
    Label lblRevision = new Label("Revision:");
    sfRevision = new EditField();
    sfRevision.setColumns(10);

    pnlMain.add(lblRepo, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfRepo, cc.xywh(3, 1, 3, 1));
    pnlMain.add(lblRevision, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfRevision, cc.xywh(3, 3, 1, 1));
    pnlMain.add(btnBlame, cc.xywh(5, 3, 1, 1));

    pnlMain.add(scrollPane, cc.xywh(1, 5, 5, 1));
    pnlMain.add(prgBusy, cc.xywh(1, 7, 3, 1));
    pnlMain.add(btnStop, cc.xywh(5, 7, 1, 1));

    tblBlame.showMessage("Click the \"Blame\" button", Manager.getIconInformation());

    frame = GuiHelper.createAndShowFrame(pnlMain, "Blame", "other-app-icon.png");

}

From source file:hu.pagavcs.client.gui.CheckoutGui.java

License:Open Source License

public void display() throws SVNException {

    CellConstraints cc = new CellConstraints();
    JPanel pnlMain = new JPanel(new FormLayout("r:p,2dlu,p:g,p", "p,2dlu,p,2dlu,p,2dlu,p,2dlu,p"));

    frame = GuiHelper.createFrame(pnlMain, "Checkout Settings", null);

    Label lblUrl = new Label("URL:");
    cboUrl = new JComboBox();
    cboUrl.setEditable(true);/*from w ww  . ja  v  a  2s . com*/
    if (checkout.getUrl() != null) {
        cboUrl.setSelectedItem(checkout.getUrl());
    }

    Label lblDir = new Label("Dir:");
    sfDir = new EditField(20);
    if (checkout.getPath() != null) {
        sfDir.setText(checkout.getPath());
    }
    Label lblRevison = new Label("Revision (empty for head):");
    sfRevision = new EditField(20);
    btnCheckout = new JButton("Checkout");
    btnCheckout.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            new Thread(new Runnable() {

                public void run() {
                    try {
                        checkout();
                    } catch (Exception e) {
                        Manager.handle(e);
                    }
                }
            }).start();
        }
    });
    JButton btnClose = new JButton(new CloseAction(frame));

    pnlMain.add(lblUrl, cc.xy(1, 1));
    pnlMain.add(cboUrl, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblDir, cc.xy(1, 3));
    pnlMain.add(sfDir, cc.xywh(3, 3, 2, 1));
    pnlMain.add(lblRevison, cc.xy(1, 5));
    pnlMain.add(sfRevision, cc.xywh(3, 5, 2, 1));
    pnlMain.add(btnCheckout, cc.xy(4, 7));
    pnlMain.add(btnClose, cc.xy(4, 9));

    frame.execute();
}

From source file:hu.pagavcs.client.gui.CopyMoveRenameGui.java

License:Open Source License

public void display() throws SVNException {
    FormLayout layout = new FormLayout("right:p, 2dlu,p:g, p", "p,2dlu,p,2dlu,4dlu,p,2dlu,p,4dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();

    Label lblWorkingCopy = new Label("Path:");
    sfWorkingCopy = new EditField(other.getPath());
    sfWorkingCopy.setEditable(false);/*  www.jav a2 s  .c o  m*/
    Label lblRepo = new Label("Repository:");
    sfRepo = new EditField();
    sfRepo.setEditable(false);

    sfNewPath = new EditField();
    cbCopy = new JCheckBox("Copy");
    btnCopyMoveRename = new JButton("Copy/move/rename");
    btnCopyMoveRename.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            new Thread(new Runnable() {

                public void run() {
                    try {
                        copyMoveRename();
                    } catch (Exception e) {
                        Manager.handle(e);
                    }
                }
            }).start();
        }
    });

    sfNewPath.getDocument().addDocumentListener(new DocumentListener() {

        public void changedUpdate(DocumentEvent e) {
            changeButtonLabel();
        }

        public void removeUpdate(DocumentEvent e) {
            changeButtonLabel();
        }

        public void insertUpdate(DocumentEvent e) {
            changeButtonLabel();
        }

        private void changeButtonLabel() {
            String origPath = other.getPath();
            String newPath = sfNewPath.getText();

            File origFile = new File(origPath);
            File newFile = new File(newPath);

            if (other.getPath().equals(sfNewPath.getText())) {
                btnCopyMoveRename.setEnabled(false);
                btnCopyMoveRename.setText("Nothing to do");
            } else {
                btnCopyMoveRename.setEnabled(true);
                if (newFile.exists()) {
                    btnCopyMoveRename.setEnabled(false);
                    btnCopyMoveRename.setText("Already exists");
                } else {
                    if (!cbCopy.isSelected()) {
                        if (origFile.getParent().equals(newFile.getParent())) {
                            btnCopyMoveRename.setText("Rename");
                        } else {
                            btnCopyMoveRename.setText("Move");
                        }
                    } else {
                        btnCopyMoveRename.setText("Copy");
                    }
                }

            }
        }
    });

    sfNewPath.setText(other.getPath());

    lblStatus = new Label(" ");
    prgBusy = new ProgressBar(this);

    pnlMain.add(lblWorkingCopy, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfWorkingCopy, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblRepo, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfRepo, cc.xywh(3, 3, 2, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 5, 4, 1));
    pnlMain.add(new JLabel("Copy/move/rename"), cc.xywh(1, 6, 1, 1));
    pnlMain.add(sfNewPath, cc.xywh(3, 6, 2, 1));
    pnlMain.add(cbCopy, cc.xywh(3, 8, 1, 1));
    pnlMain.add(btnCopyMoveRename, cc.xywh(4, 8, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 9, 4, 1));
    pnlMain.add(prgBusy, cc.xywh(1, 10, 3, 1));
    pnlMain.add(lblStatus, cc.xywh(4, 10, 1, 1));

    frame = GuiHelper.createAndShowFrame(pnlMain, "Copy-Move-Rename", "other-app-icon.png");
    frame.setTitlePrefix(other.getPath());
}

From source file:hu.pagavcs.client.gui.ExportGui.java

License:Open Source License

public void display() throws SVNException {
    FormLayout layout = new FormLayout("right:p, 2dlu,p:g, p",
            "p,2dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,4dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();

    Label lblWorkingCopy = new Label("Path:");
    sfWorkingCopy = new EditField(other.getPath());
    sfWorkingCopy.setEditable(false);/*from w  w w.ja v  a  2  s  .c  o  m*/
    Label lblRepo = new Label("Repository:");
    sfRepo = new EditField();
    sfRepo.setEditable(false);
    btnShowLog = new JButton(new ShowLogAction());

    sfExportTo = new EditField();
    btnExportTo = new JButton(new ExportAction());

    lblStatus = new Label(" ");
    prgBusy = new ProgressBar(this);

    pnlMain.add(lblWorkingCopy, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfWorkingCopy, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblRepo, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfRepo, cc.xywh(3, 3, 2, 1));
    pnlMain.add(btnShowLog, cc.xywh(4, 5, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 6, 4, 1));
    pnlMain.add(new JLabel("Export to:"), cc.xywh(1, 7, 1, 1));
    pnlMain.add(sfExportTo, cc.xywh(3, 7, 2, 1));
    pnlMain.add(btnExportTo, cc.xywh(4, 9, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 10, 4, 1));
    pnlMain.add(prgBusy, cc.xywh(1, 11, 3, 1));
    pnlMain.add(lblStatus, cc.xywh(4, 11, 1, 1));

    frame = GuiHelper.createAndShowFrame(pnlMain, "Export", "actions/pagavcs-export.png");
    frame.setTitlePrefix(other.getPath());
}

From source file:hu.pagavcs.client.gui.LoginGui.java

License:Open Source License

public void display() {
    JPanel pnlMain = new JPanel(new FormLayout("r:p,2dlu, p:g,p", "p,2dlu,p,2dlu,p,2dlu,p"));
    CellConstraints cc = new CellConstraints();

    cbRemember = new JCheckBox();
    cbRemember.setMnemonic('r');
    cbRemember.setToolTipText("Remember username and password (ALT+R)");
    cbRemember.setFocusable(false);/*  ww w .j  a v a 2 s .  c o  m*/
    Label lblUsername = new Label("Username:");
    lblUsername.setToolTipText("Remember username and password (ALT+R)");
    sfUsername = new EditField(predefinedUsername, 20);
    sfUsername.setToolTipText("Leave it empty if username is not required");

    Label lblPassword = new Label("Password:");
    sfPassword = new JPasswordField(predefinedPassword, 20);

    Label lblRemember = new Label("Remember");
    lblRemember.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
                cbRemember.setSelected(!cbRemember.isSelected());
            }
        }
    });

    btnLogin = new JButton("Login");
    btnLogin.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            loginButtonPressed = true;

            SettingsStore settings = Manager.getSettings();
            settings.setRememberUsername(cbRemember.isSelected());

            synchronized (logMeIn) {
                logMeIn.notifyAll();
            }
        }
    });

    pnlMain.add(lblUsername, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfUsername, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblPassword, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfPassword, cc.xywh(3, 3, 2, 1));
    pnlMain.add(cbRemember, cc.xywh(1, 5, 1, 1));
    pnlMain.add(lblRemember, cc.xywh(3, 5, 2, 1));
    pnlMain.add(btnLogin, cc.xywh(4, 7, 1, 1));

    SettingsStore settings = Manager.getSettings();
    cbRemember.setSelected(Boolean.TRUE.equals(settings.getRememberPassword()));

    sfUsername.addKeyListener(new KeyAdapter() {

        public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == '\n') {
                sfPassword.requestFocus();
                e.consume();
            }
        }
    });

    sfPassword.addKeyListener(new KeyAdapter() {

        public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == '\n') {
                btnLogin.doClick();
                e.consume();
            }
        }
    });

    window = GuiHelper.createAndShowFrame(pnlMain, "Login");
    window.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {

            synchronized (logMeIn) {
                logMeIn.notifyAll();
            }
        }
    });

}

From source file:hu.pagavcs.client.gui.repobrowser.CreateFolderDialog.java

License:Open Source License

public void display(Window parent) {
    JPanel pnlMain = new JPanel(new FormLayout("p,2dlu,p:g,p,2dlu,p", "p,2dlu,p,2dlu,p"));
    CellConstraints cc = new CellConstraints();

    Label lblUsername = new Label("New folder name:");
    sfFolderName = new EditField(20);

    Label lblLogMessage = new Label("Log message:");
    sfLogMessage = new EditField(20);

    btnCreate = new JButton("Create");
    btnCreate.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            doCreate = true;//  ww w  . j  av  a2 s . c o  m

            window.setVisible(false);
        }
    });

    btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            doCreate = false;
            window.setVisible(false);
        }
    });

    pnlMain.add(lblUsername, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfFolderName, cc.xywh(3, 1, 4, 1));
    pnlMain.add(lblLogMessage, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfLogMessage, cc.xywh(3, 3, 4, 1));
    pnlMain.add(btnCreate, cc.xywh(4, 5, 1, 1));
    pnlMain.add(btnCancel, cc.xywh(6, 5, 1, 1));

    sfFolderName.addKeyListener(new KeyAdapter() {

        public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == '\n') {
                sfLogMessage.requestFocus();
                e.consume();
            }
        }
    });

    sfLogMessage.addKeyListener(new KeyAdapter() {

        public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == '\n') {
                btnCreate.doClick();
                e.consume();
            }
        }
    });

    window = GuiHelper.createDialog(parent, pnlMain, "Create Folder");

    window.setModalityType(ModalityType.DOCUMENT_MODAL);
    window.setVisible(true);
    window.dispose();
}