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:imageviewer.ui.dialog.PreferencesMemoryPanel.java

License:Open Source License

public PreferencesMemoryPanel(PreferencesDialog pd) {

    super();/*from  ww w .  j a v  a2s  .  c o  m*/
    setPreferredSize(new Dimension(385, 360));

    JTextArea memoryDescription = DialogUtil.createTextArea(
            "Changes to these memory settings will not take place until the application is restarted.");
    JTextArea iCacheDescription = DialogUtil.createTextArea(
            "New images are loaded into memory on an as-needed basis, and old images unloaded from the local cache to save memory.  "
                    + "The size of the image cache determines the number of images that may be maintained in memory.  "
                    + "Increasing the size of the cache may improve performance, but will also require more "
                    + "heap space.");
    JTextArea purgerDescription = DialogUtil
            .createTextArea("The program attempts to clear memory by removing old images from its "
                    + "cache and performing garbage collection.  You can perform "
                    + "these tasks immediately to create extra space.  The entire image cache will be eliminated; "
                    + "image performance may suffer in the short term as images are re-read from disk into memory.");

    JButton garbageCollectionButton = new JButton("Clear memory now");
    garbageCollectionButton.setActionCommand("garbageCollect");
    garbageCollectionButton.addActionListener(this);

    JLabel memoryLabel = new JLabel("Initial heap threshold (%)", JLabel.TRAILING);
    JLabel maxMemoryLabel = new JLabel("Maximum heap threshold (%)", JLabel.TRAILING);
    JLabel cacheSizeLabel = new JLabel("Image cache size", JLabel.TRAILING);
    JSeparator separator1 = new JSeparator();
    JSeparator separator2 = new JSeparator();

    memoryThresholdSlider.setPaintTicks(true);
    memoryThresholdSlider.setPaintLabels(true);
    memoryThresholdSlider.setMajorTickSpacing(20);
    memoryThresholdSlider.setMinorTickSpacing(5);
    memoryThresholdSlider.addChangeListener(this);
    memoryThresholdSlider.setFont(SLIDER_FONT);
    setSliderFont(memoryThresholdSlider);

    Float mt = (Float) ApplicationContext.getContext().getProperty(ApplicationContext.MEMORY_THRESHOLD);
    if (mt != null)
        memoryThresholdSlider.setValue(new Integer((int) (mt.floatValue() * 100)));
    else
        memoryThresholdSlider.setEnabled(false);
    memoryThresholdSlider.addChangeListener(this);

    maxMemoryThresholdSlider.setPaintTicks(true);
    maxMemoryThresholdSlider.setPaintLabels(true);
    maxMemoryThresholdSlider.setMajorTickSpacing(20);
    maxMemoryThresholdSlider.setMinorTickSpacing(5);
    maxMemoryThresholdSlider.addChangeListener(this);
    maxMemoryThresholdSlider.setFont(SLIDER_FONT);
    setSliderFont(maxMemoryThresholdSlider);

    Float mmt = (Float) ApplicationContext.getContext()
            .getProperty(ApplicationContext.MAXIMUM_MEMORY_THRESHOLD);
    if (mmt != null)
        maxMemoryThresholdSlider.setValue(new Integer((int) (mmt.floatValue() * 100)));
    else
        maxMemoryThresholdSlider.setEnabled(false);
    maxMemoryThresholdSlider.addChangeListener(this);

    Integer cs = (Integer) ApplicationContext.getContext()
            .getProperty(ApplicationContext.DEFAULT_IMAGE_CACHE_SIZE);
    if (cs != null)
        cacheSpinner.setValue(cs);
    else
        cacheSpinner.setEnabled(false);
    cacheSpinner.addChangeListener(this);

    FormLayout fl = new FormLayout("10px,right:pref:grow,10px,pref,2dlu,pref,10px",
            "10px,pref,5px,center:pref,5px,center:pref,5px,center:pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,10px");
    setLayout(fl);

    CellConstraints cc = new CellConstraints();
    add(memoryDescription, cc.xywh(2, 2, 5, 1));
    add(memoryLabel, cc.xy(2, 4));
    add(memoryThresholdSlider, cc.xywh(4, 4, 3, 1));
    add(maxMemoryLabel, cc.xy(2, 6));
    add(maxMemoryThresholdSlider, cc.xywh(4, 6, 3, 1));
    add(separator1, cc.xywh(2, 8, 5, 1));
    add(iCacheDescription, cc.xywh(2, 10, 5, 1));
    add(cacheSizeLabel, cc.xy(2, 12));
    add(cacheSpinner, cc.xywh(4, 12, 1, 1));
    add(separator2, cc.xywh(2, 14, 5, 1));
    add(purgerDescription, cc.xywh(2, 16, 5, 1));
    add(garbageCollectionButton, cc.xy(6, 18));
    this.pd = pd;
}

From source file:imageviewer.ui.dialog.ps.PSDialogPanel.java

License:Open Source License

private PSDialogPanel() {

    super();//from  w  w w .ja  va 2s  .  c  o m
    FormLayout fl = new FormLayout(
            "fill:pref:grow,2dlu,fill:pref:grow,4dlu,pref,2dlu,fill:pref:grow,2dlu,pref,2dlu,pref,2dlu,right:pref:grow",
            "pref,4px,pref,2px,pref,10px,fill:pref:grow,2px,pref,2px,pref,2px,top:pref");
    setLayout(fl);
    setBorder(new EmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(995, 675));
    setLocation(50, 50);

    JTextArea psPanelDescription = DialogUtil.createTextArea(
            "Click on the thumbnails to view the presentation state in full.  Drag images (ctrl-left-click drag) "
                    + "to rearrange thumbnails within a row.");
    JTextArea psViewDescription = DialogUtil.createTextArea(
            "Drag images (ctrl-left-click drag) into the panel below to capture presentation states.  "
                    + "You can enter additional descriptive information into associated the text fields.");

    JButton closeButton = new JButton("Close");
    closeButton.setActionCommand("close");
    closeButton.addActionListener(this);
    JLabel studyLabel = new JLabel("Collection navigation", JLabel.LEFT);
    JLabel viewLabel = new JLabel("Presentation state viewer", JLabel.LEFT);
    JSeparator separator1 = new JSeparator();
    separator1.setPreferredSize(new Dimension(415, 5));
    JSeparator separator2 = new JSeparator();
    separator2.setPreferredSize(new Dimension(525, 5));

    PSTableCellRenderer pstcr = new PSTableCellRenderer();
    PSTableCellEditor pstce = new PSTableCellEditor();
    TableHeaderRenderer thr = new TableHeaderRenderer(Color.black);

    collectionTable = new JXTable(pctm) {
        public void toggleSortOrder(int columnIndex) {
            pctm.toggleSort();
        }
    };
    collectionTable.setHorizontalScrollEnabled(true);
    collectionTable.setShowHorizontalLines(true);
    collectionTable.setShowVerticalLines(false);
    collectionTable.setColumnMargin(1);
    collectionTable.setColumnControlVisible(false);
    collectionTable.setRolloverEnabled(false);
    collectionTable.setRowSelectionAllowed(true);
    collectionTable.setColumnSelectionAllowed(false);
    collectionTable.setRowHeight(132);
    collectionTable.getTableHeader().setReorderingAllowed(false);
    collectionTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    for (int i = 0; i < COLUMN_WIDTH.length; i++) {
        TableColumn column = collectionTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(COLUMN_WIDTH[i]);
        column.setHeaderRenderer(thr);
        column.setCellRenderer(pstcr);
        column.setCellEditor(pstce);
    }

    // Mutilate the collectionTable and its model so that we can put
    // just the thumbnails into a scrollpane and freeze the first
    // column.  Support for fixed columns not forthcoming anytime soon
    // from swingx or sun...Override the togglesortorder so we know
    // when a sort even occurs, and then we can also sort the
    // collectionTable, too.

    fixedColumnTable = new JXTable(collectionTable.getModel()) {
        public void toggleSortOrder(int columnIndex) {
            pctm.toggleSort();
        }
    };
    fixedColumnTable.setFocusable(false);
    fixedColumnTable.setSelectionModel(collectionTable.getSelectionModel());
    fixedColumnTable.getTableHeader().setReorderingAllowed(false);
    fixedColumnTable.getTableHeader().setResizingAllowed(false);
    fixedColumnTable.getColumnModel().getColumn(0).setPreferredWidth(45);
    fixedColumnTable.getColumnModel().getColumn(0).setHeaderRenderer(thr);
    fixedColumnTable.getColumnModel().getColumn(0).setCellRenderer(pstcr);
    fixedColumnTable.setHorizontalScrollEnabled(true);
    fixedColumnTable.setShowHorizontalLines(true);
    fixedColumnTable.setShowVerticalLines(true);
    fixedColumnTable.setColumnMargin(1);
    fixedColumnTable.setColumnControlVisible(false);
    fixedColumnTable.setRolloverEnabled(false);
    fixedColumnTable.setRowSelectionAllowed(true);
    fixedColumnTable.setColumnSelectionAllowed(false);
    fixedColumnTable.setRowHeight(132);
    fixedColumnTable.setAutoscrolls(false);
    fixedColumnTable.getTableHeader().setReorderingAllowed(false);
    fixedColumnTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    fixedColumnTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    collectionTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    collectionTable.setDragEnabled(true);

    // Remove the first column from the main table

    TableColumnModel columnModel = collectionTable.getColumnModel();
    columnModel.removeColumn(columnModel.getColumn(0));

    // Remove the non-fixed columns from the fixed table

    while (fixedColumnTable.getColumnCount() > 1) {
        columnModel = fixedColumnTable.getColumnModel();
        columnModel.removeColumn(columnModel.getColumn(1));
    }

    // Add the fixed table to the scroll pane

    fixedColumnTable.setPreferredScrollableViewportSize(fixedColumnTable.getPreferredSize());

    studyScrollPane = new JScrollPane(collectionTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    studyScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    studyScrollPane.getViewport().setBackground(Color.black);
    studyScrollPane.setRowHeaderView(fixedColumnTable);
    studyScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, fixedColumnTable.getTableHeader());
    studyScrollPane.setPreferredSize(new Dimension(425, 525));

    // Use a containing JPanel so that the contents are centered in
    // the scrollPane. Grr...

    JPanel viewPanel = new JPanel(new GridBagLayout());
    viewPanel.add(psView, new GridBagConstraints());

    JScrollPane psScrollPane = new JScrollPane(viewPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    psScrollPane.getViewport().setBackground(Color.black);
    psScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    psScrollPane.setPreferredSize(new Dimension(525, 525));

    JComboBox groupByComboBox = new JComboBox(new String[] { "Series", "Study" });
    deleteListButton.setActionCommand("deleteList");
    deleteListButton.addActionListener(this);
    deleteListButton.setEnabled(false);
    deletePSButton.setActionCommand("deletePS");
    deletePSButton.addActionListener(this);
    deletePSButton.setEnabled(false);
    JLabel groupByLabel = new JLabel("Group collections by", JLabel.TRAILING);
    JLabel authorLabel = new JLabel("Author", JLabel.TRAILING);
    JLabel timestampLabel = new JLabel("Created on", JLabel.TRAILING);
    JLabel descriptionLabel = new JLabel("Description", JLabel.TRAILING);
    authorField.setEditable(false);
    timestampField.setEditable(false);

    CellConstraints cc = new CellConstraints();
    add(studyLabel, cc.xy(1, 1));
    add(viewLabel, cc.xywh(5, 1, 9, 1));
    add(separator1, cc.xywh(1, 3, 3, 1));
    add(psPanelDescription, cc.xywh(1, 5, 3, 1));
    add(separator2, cc.xywh(5, 3, 9, 1));
    add(psViewDescription, cc.xywh(5, 5, 9, 1));
    add(studyScrollPane, cc.xywh(1, 7, 3, 1));
    add(groupByLabel, cc.xy(1, 9));
    add(groupByComboBox, cc.xy(3, 9));
    add(deleteListButton, cc.xy(1, 11));
    add(deletePSButton, cc.xy(3, 11));
    add(psScrollPane, cc.xywh(5, 7, 9, 1));
    add(authorLabel, cc.xy(5, 9));
    add(authorField, cc.xy(7, 9));
    add(timestampLabel, cc.xy(9, 9));
    add(timestampField, cc.xywh(11, 9, 3, 1));
    add(descriptionLabel, cc.xy(5, 11));
    add(descriptionField, cc.xywh(7, 11, 7, 1));
    add(closeButton, cc.xy(13, 13));

    setBackgroundPainter((Painter) UIManager.get("FloatingPanel.backgroundPainter"));
    setDropTarget(psView.getDropTarget());

    descriptionField.addCaretListener(this);
    groupByComboBox.addItemListener(this);
}

From source file:imageviewer.ui.swing.FileChooserUI.java

License:Open Source License

public void installComponents(JFileChooser fc) {

    FormLayout fl = new FormLayout("right:pref,2dlu,pref:grow,2dlu,26px,2px,26px,5px,26px,5px,26px,2px,26px",
            "pref,5px,fill:pref:grow,5px,pref,5px,pref,5px,pref");
    CellConstraints cc = new CellConstraints();

    FileSystemView fsv = fc.getFileSystemView();
    fc.setBorder(new EmptyBorder(5, 5, 5, 5));
    fc.setLayout(fl);/*from  w w  w  . j a  v a 2s  . c o m*/
    filePane = new FilePane(new FileChooserUIAccessor());
    fc.addPropertyChangeListener(filePane);
    updateUseShellFolder();

    // Directory manipulation buttons

    JPanel topPanel = new JPanel(new BorderLayout(3, 0));
    lookInLabel = new JLabel(lookInLabelText);
    lookInLabel.setDisplayedMnemonic(lookInLabelMnemonic);
    topPanel.add(lookInLabel, BorderLayout.WEST);

    // CurrentDir ComboBox

    directoryComboBox = new JComboBox() {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width = 150;
            return d;
        }
    };

    directoryComboBox.setLightWeightPopupEnabled(false);
    directoryComboBox.getAccessibleContext().setAccessibleDescription(lookInLabelText);
    directoryComboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    lookInLabel.setLabelFor(directoryComboBox);
    directoryComboBoxModel = createDirectoryComboBoxModel(fc);
    directoryComboBox.setModel(directoryComboBoxModel);
    directoryComboBox.addActionListener(directoryComboBoxAction);
    directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc));
    directoryComboBox.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    directoryComboBox.setAlignmentY(JComponent.TOP_ALIGNMENT);
    directoryComboBox.setMaximumRowCount(8);
    topPanel.add(directoryComboBox, BorderLayout.CENTER);
    fc.add(topPanel, cc.xywh(1, 1, 3, 1));

    // Up Button

    JButton upFolderButton = new JButton(getChangeToParentDirectoryAction());
    upFolderButton.setText(null);
    upFolderButton.setIcon(upFolderIcon);
    upFolderButton.setToolTipText(upFolderToolTipText);
    upFolderButton.getAccessibleContext().setAccessibleName(upFolderAccessibleName);
    upFolderButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    upFolderButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    upFolderButton.setMargin(shrinkwrap);
    fc.add(upFolderButton, cc.xy(5, 1));

    // Home Button

    File homeDir = fsv.getHomeDirectory();
    String toolTipText = homeFolderToolTipText;
    if (fsv.isRoot(homeDir))
        toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop"

    JButton b = new JButton(homeFolderIcon);
    b.setToolTipText(toolTipText);
    b.getAccessibleContext().setAccessibleName(homeFolderAccessibleName);
    b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    b.setMargin(shrinkwrap);
    b.addActionListener(getGoHomeAction());
    fc.add(b, cc.xy(7, 1));

    // New Directory Button

    if (!UIManager.getBoolean("FileChooser.readOnly")) {
        b = new JButton(filePane.getNewFolderAction());
        b.setText(null);
        b.setIcon(newFolderIcon);
        b.setToolTipText(newFolderToolTipText);
        b.getAccessibleContext().setAccessibleName(newFolderAccessibleName);
        b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
        b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
        b.setMargin(shrinkwrap);
        fc.add(b, cc.xy(9, 1));
    }

    // View button group

    ButtonGroup viewButtonGroup = new ButtonGroup();

    // List Button

    listViewButton = new JToggleButton(listViewIcon);
    listViewButton.setToolTipText(listViewButtonToolTipText);
    listViewButton.getAccessibleContext().setAccessibleName(listViewButtonAccessibleName);
    listViewButton.setSelected(true);
    listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    listViewButton.setMargin(shrinkwrap);
    listViewButton.setBorderPainted(false);
    listViewButton.setRolloverEnabled(true);
    listViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_LIST));
    viewButtonGroup.add(listViewButton);
    fc.add(listViewButton, cc.xy(11, 1));

    // Details Button

    detailsViewButton = new JToggleButton(detailsViewIcon);
    detailsViewButton.setToolTipText(detailsViewButtonToolTipText);
    detailsViewButton.getAccessibleContext().setAccessibleName(detailsViewButtonAccessibleName);
    detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    detailsViewButton.setBorderPainted(false);
    detailsViewButton.setRolloverEnabled(true);
    detailsViewButton.setMargin(shrinkwrap);
    detailsViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_DETAILS));
    viewButtonGroup.add(detailsViewButton);
    fc.add(detailsViewButton, cc.xy(13, 1));

    filePane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            if ("viewType".equals(e.getPropertyName())) {
                int viewType = filePane.getViewType();
                switch (viewType) {
                case FilePane.VIEWTYPE_LIST:
                    listViewButton.setSelected(true);
                    break;
                case FilePane.VIEWTYPE_DETAILS:
                    detailsViewButton.setSelected(true);
                    break;
                }
            }
        }
    });

    filePane.setPreferredSize(LIST_PREF_SIZE);
    if (getAccessoryPanel() != null) {
        JPanel midPanel = new JPanel(new BorderLayout(0, 0));
        midPanel.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS);
        JComponent accessory = fc.getAccessory();
        if (accessory != null)
            getAccessoryPanel().add(accessory);
        midPanel.add(filePane, BorderLayout.CENTER);
        fc.add(midPanel, cc.xywh(1, 3, 13, 1));
    } else {
        fc.add(filePane, cc.xywh(1, 3, 13, 1));
    }

    // FileName label and textfield

    AlignedLabel fileNameLabel = new AlignedLabel(fileNameLabelText);
    fileNameLabel.setDisplayedMnemonic(fileNameLabelMnemonic);
    fc.add(fileNameLabel, cc.xy(1, 5));

    fileNameTextField = new JTextField(35) {
        public Dimension getMaximumSize() {
            return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
        }
    };
    fc.add(fileNameTextField, cc.xywh(3, 5, 11, 1));
    fileNameLabel.setLabelFor(fileNameTextField);
    fileNameTextField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            if (!getFileChooser().isMultiSelectionEnabled()) {
                filePane.clearSelection();
            }
        }
    });

    setFileName((fc.isMultiSelectionEnabled()) ? fileNameString(fc.getSelectedFiles())
            : fileNameString(fc.getSelectedFile()));

    // Filetype label and combobox

    AlignedLabel filesOfTypeLabel = new AlignedLabel(filesOfTypeLabelText);
    filesOfTypeLabel.setDisplayedMnemonic(filesOfTypeLabelMnemonic);
    fc.add(filesOfTypeLabel, cc.xy(1, 7));

    filterComboBoxModel = createFilterComboBoxModel();
    fc.addPropertyChangeListener(filterComboBoxModel);
    filterComboBox = new JComboBox(filterComboBoxModel);
    filterComboBox.getAccessibleContext().setAccessibleDescription(filesOfTypeLabelText);
    filterComboBox.setLightWeightPopupEnabled(false);
    filesOfTypeLabel.setLabelFor(filterComboBox);
    filterComboBox.setRenderer(createFilterComboBoxRenderer());
    fc.add(filterComboBox, cc.xywh(3, 7, 11, 1));

    // Buttons

    approveButton = new JButton(getApproveButtonText(fc));
    approveButton.addActionListener(getApproveSelectionAction());
    approveButton.setToolTipText(getApproveButtonToolTipText(fc));
    cancelButton = new JButton(cancelButtonText);
    cancelButton.setToolTipText(cancelButtonToolTipText);
    cancelButton.addActionListener(getCancelSelectionAction());

    getButtonPanel().add(approveButton);
    getButtonPanel().add(Box.createHorizontalStrut(5));
    getButtonPanel().add(cancelButton);
    getBottomPanel().add(getButtonPanel());
    fc.add(getBottomPanel(), cc.xywh(1, 9, 13, 1));

    if (fc.getControlButtonsAreShown())
        addControlButtons();
    groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel });
}

From source file:jgnash.ui.reconcile.ReconcileDialog.java

License:Open Source License

private void layoutMainPanel() {
    initComponents();//www .j  a va  2s. com

    FormLayout layout = new FormLayout("min:grow(0.5), 7dlu, min:grow(0.5)", "fill:min:g, 7dlu, p, 14dlu, p");
    layout.addGroupedColumn(1);
    layout.addGroupedColumn(3);

    CellConstraints cc = new CellConstraints();

    String[] columnNames = RegisterFactory.getCreditDebitTabNames(account);

    FormLayout dLayout = new FormLayout("fill:min:g(1.0)", "fill:min:g, 4dlu, p");
    JPanel dPanel = new JPanel(dLayout);
    dPanel.add(buildTablePanel(columnNames[1], debitTotalLabel, debitTable), cc.xy(1, 1));
    dPanel.add(ButtonBarFactory.buildLeftAlignedBar(debitSelectAllButton, debitClearAllButton), cc.xy(1, 3));

    FormLayout cLayout = new FormLayout("fill:min:g(1.0)", "fill:min:g, 4dlu, p");
    JPanel cPanel = new JPanel(cLayout);
    cPanel.add(buildTablePanel(columnNames[0], creditTotalLabel, creditTable), cc.xy(1, 1));
    cPanel.add(ButtonBarFactory.buildLeftAlignedBar(creditSelectAllButton, creditClearAllButton), cc.xy(1, 3));

    JPanel p = new JPanel(layout);
    p.setBorder(Borders.DIALOG_BORDER);
    p.add(dPanel, cc.xywh(1, 1, 1, 3));
    p.add(cPanel, cc.xy(3, 1));
    p.add(buildStatPanel(), cc.xy(3, 3));
    p.add(ButtonBarFactory.buildRightAlignedBar(cancelButton, finishLaterButton, finishButton),
            cc.xywh(1, 5, 3, 1));
    getContentPane().add(p);
    pack();

    setMinimumSize(getSize());

    DialogUtils.addBoundsListener(this); // this will size and locate the dialog
}

From source file:jgnash.ui.recurring.DayTab.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:p, $lcgap, f:p, 2dlu, max(48dlu;min), 2dlu, f:p",
            "f:p, $lgap, f:p, $lgap, f:p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    setLayout(layout);//from  w  ww  . j a  va  2  s  .  c o  m
    setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    noEndButton = new JRadioButton(rb.getString("Button.NoEndDate"));
    endButton = new JRadioButton();
    endDateField = new DatePanel();

    group.add(noEndButton);
    group.add(endButton);

    numberSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 365, 1));

    add(new JLabel(rb.getString("Label.Every")), cc.xy(1, 1));
    add(numberSpinner, cc.xywh(3, 1, 3, 1));
    add(new JLabel(rb.getString("Tab.Day")), cc.xy(7, 1));

    add(new JLabel(rb.getString("Label.EndOn")), cc.xy(1, 3));
    add(noEndButton, cc.xywh(3, 3, 5, 1));

    add(endButton, cc.xy(3, 5));
    add(endDateField, cc.xy(5, 5));
}

From source file:jgnash.ui.recurring.MonthTab.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout(
            "right:p, $lcgap, f:p, 2dlu, max(48dlu;min), 2dlu, f:p, 10dlu, right:p, 4dlu, max(48dlu;min)",
            "f:p, $lgap, f:p, $lgap, f:p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    setLayout(layout);//  www .jav a  2  s  .  c o  m
    setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    noEndButton = new JRadioButton(rb.getString("Button.NoEndDate"));
    endButton = new JRadioButton();
    endDateField = new DatePanel();

    group.add(noEndButton);
    group.add(endButton);

    numberSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 24, 1));
    typeComboBox = new JComboBox<>();

    typeComboBox.setModel(new DefaultComboBoxModel<>(
            new String[] { rb.getString("Column.Date"), rb.getString("Column.Day") }));

    add(new JLabel(rb.getString("Label.Every")), cc.xy(1, 1));
    add(numberSpinner, cc.xywh(3, 1, 3, 1));
    add(new JLabel(rb.getString("Tab.Month")), cc.xy(7, 1));

    add(new JLabel(rb.getString("Label.By")), cc.xy(9, 1));
    add(typeComboBox, cc.xy(11, 1));

    add(new JLabel(rb.getString("Label.EndOn")), cc.xy(1, 3));
    add(noEndButton, cc.xyw(3, 3, 5));

    add(endButton, cc.xy(3, 5));
    add(endDateField, cc.xy(5, 5));

}

From source file:jgnash.ui.recurring.RecurringEntryDialog.java

License:Open Source License

private JPanel createTransactionPanel() {
    FormLayout layout = new FormLayout("left:p, 4dlu, p:g, 4dlu, p",
            "f:p, 3dlu, f:p, 3dlu, f:p, 3dlu, f:40dlu:g");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });

    CellConstraints cc = new CellConstraints();

    JPanel p = new JPanel(layout);
    descriptionField = new JTextFieldEx();

    accountCombo = new AccountListComboBox();

    notesArea = new JTextArea(5, 20);
    notesArea.setLineWrap(true);/*from  w  ww  .  jav a  2  s.com*/
    notesArea.setAutoscrolls(true);

    JScrollPane pane = new JScrollPane(notesArea);
    pane.setAutoscrolls(true);

    transactionField = new JTextFieldEx();
    transactionField.setEditable(false);
    editButton = new JButton(rb.getString("Button.Edit"));

    deleteButton = new JButton(rb.getString("Button.Delete"));

    p.add(new JLabel(rb.getString("Label.Account")), cc.xy(1, 1));
    p.add(accountCombo, cc.xywh(3, 1, 3, 1));

    p.add(new JLabel(rb.getString("Label.Description")), cc.xy(1, 3));
    p.add(descriptionField, cc.xywh(3, 3, 3, 1));

    p.add(new JLabel(rb.getString("Label.Transaction")), cc.xy(1, 5));
    p.add(transactionField, cc.xy(3, 5));
    p.add(ButtonBarFactory.buildLeftAlignedBar(editButton, deleteButton), cc.xy(5, 5));

    p.add(new JLabel(rb.getString("Label.Notes")), cc.xy(1, 7));
    p.add(pane, cc.xywh(3, 7, 3, 1));

    return p;
}

From source file:jgnash.ui.recurring.RecurringEntryDialog.java

License:Open Source License

private JPanel createFreqPanel() {
    FormLayout layout = new FormLayout("right:p, 4dlu, max(48dlu;min), 6dlu, p, f:p:g", "f:p, 3dlu, min");

    CellConstraints cc = new CellConstraints();

    JPanel p = new JPanel(layout);
    startDateField = new DatePanel();
    enabledCheckBox = new JCheckBox(rb.getString("Button.Enabled"));

    freqTab = new JTabbedPane();

    freqTab.add(rb.getString("Tab.None"), new NoneTab());
    freqTab.add(rb.getString("Tab.Day"), new DayTab());
    freqTab.add(rb.getString("Tab.Week"), new WeekTab());
    freqTab.add(rb.getString("Tab.Month"), new MonthTab());
    freqTab.add(rb.getString("Tab.Year"), new YearTab());

    tabMap.put(OneTimeReminder.class, 0);
    tabMap.put(DailyReminder.class, 1);
    tabMap.put(WeeklyReminder.class, 2);
    tabMap.put(MonthlyReminder.class, 3);
    tabMap.put(YearlyReminder.class, 4);

    p.add(new JLabel(rb.getString("Label.FirstPayDate")), cc.xy(1, 1));
    p.add(startDateField, cc.xy(3, 1));/*ww  w.ja  v  a 2 s. co  m*/
    p.add(enabledCheckBox, cc.xy(5, 1));
    p.add(freqTab, cc.xywh(1, 3, 6, 1));

    return p;
}

From source file:jgnash.ui.recurring.WeekTab.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:p, $lcgap, f:p, 2dlu, max(48dlu;min), $lcgap, f:p, 2dlu, f:d",
            "f:p, $lgap, f:p, $lgap, f:p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    setLayout(layout);/*from   ww w .  j  a  v  a2s .co m*/
    setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    noEndButton = new JRadioButton(rb.getString("Button.NoEndDate"));
    endButton = new JRadioButton();
    endDateField = new DatePanel();

    group.add(noEndButton);
    group.add(endButton);

    numberSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 52, 1));

    add(new JLabel(rb.getString("Label.Every")), cc.xy(1, 1));
    add(numberSpinner, cc.xywh(3, 1, 3, 1));
    add(new JLabel(rb.getString("Tab.Week")), cc.xy(7, 1));

    add(new JLabel(rb.getString("Label.EndOn")), cc.xy(1, 3));
    add(noEndButton, cc.xywh(3, 3, 5, 1));

    add(endButton, cc.xy(3, 5));
    add(endDateField, cc.xy(5, 5));
}

From source file:jgnash.ui.recurring.YearTab.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:p, $lcgap, f:p, 2dlu, max(48dlu;min), 2dlu, f:p",
            "f:p, $lgap, f:p, $lgap, f:p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    setLayout(layout);/*from ww w  .j  a  v  a2s . com*/
    setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    noEndButton = new JRadioButton(rb.getString("Button.NoEndDate"));
    endButton = new JRadioButton();
    endDateField = new DatePanel();

    group.add(noEndButton);
    group.add(endButton);

    numberSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 100, 1));

    add(new JLabel(rb.getString("Label.Every")), cc.xy(1, 1));
    add(numberSpinner, cc.xywh(3, 1, 3, 1));
    add(new JLabel(rb.getString("Tab.Year")), cc.xy(7, 1));

    add(new JLabel(rb.getString("Label.EndOn")), cc.xy(1, 3));
    add(noEndButton, cc.xywh(3, 3, 5, 1));

    add(endButton, cc.xy(3, 5));
    add(endDateField, cc.xy(5, 5));
}