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.mebigfatguy.polycasso.SettingsDialog.java

License:Apache License

/**
 * creates the options (settings) panel//from  ww w. j  av a2s .  c o m
 * 
 * @return the options panel
 */
private JPanel createOptionsPanel() {
    JPanel optPanel = new JPanel();
    optPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(PolycassoBundle.getString(PolycassoBundle.Key.ImageOptions)),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    optPanel.setLayout(new FormLayout("pref, 3dlu, 100px, 5dlu, pref, 3dlu, 100px",
            "pref, 1dlu, pref, 15dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref"));
    CellConstraints cc = new CellConstraints();

    JLabel maxSizeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaxImageSize));
    optPanel.add(maxSizeLabel, cc.xyw(1, 1, 7));

    JLabel widthLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.Width));
    optPanel.add(widthLabel, cc.xy(1, 3));
    widthField = new JTextField(4);
    widthField.setDocument(new IntegerDocument());
    widthLabel.setLabelFor(widthField);
    optPanel.add(widthField, cc.xy(3, 3));
    widthField.addFocusListener(focuser);

    JLabel heightLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.Height));
    optPanel.add(heightLabel, cc.xy(5, 3));
    heightField = new JTextField(4);
    heightField.setDocument(new IntegerDocument());
    heightLabel.setLabelFor(heightField);
    optPanel.add(heightField, cc.xy(7, 3));
    heightField.addFocusListener(focuser);

    JLabel maxPolyLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPolygons));
    optPanel.add(maxPolyLabel, cc.xyw(1, 5, 5));
    maxPolygonField = new JTextField(4);
    maxPolygonField.setDocument(new IntegerDocument());
    maxPolyLabel.setLabelFor(maxPolygonField);
    optPanel.add(maxPolygonField, cc.xy(7, 5));
    maxPolygonField.addFocusListener(focuser);

    JLabel maxPolyPointLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPolygonPoints));
    optPanel.add(maxPolyPointLabel, cc.xyw(1, 7, 7));
    maxPolygonPointsField = new JTextField(4);
    maxPolygonPointsField.setDocument(new IntegerDocument());
    maxPolyPointLabel.setLabelFor(maxPolygonPointsField);
    optPanel.add(maxPolygonPointsField, cc.xy(7, 7));
    maxPolygonPointsField.addFocusListener(focuser);

    JLabel maxPtMoveLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPointMovement));
    optPanel.add(maxPtMoveLabel, cc.xyw(1, 9, 5));
    maxPtMoveField = new JTextField(4);
    maxPtMoveField.setDocument(new IntegerDocument());
    maxPtMoveLabel.setLabelFor(maxPtMoveField);
    optPanel.add(maxPtMoveField, cc.xy(7, 9));
    maxPtMoveField.addFocusListener(focuser);

    JLabel maxColorChangeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumColorChange));
    optPanel.add(maxColorChangeLabel, cc.xyw(1, 11, 5));
    maxColorChangeField = new JTextField(4);
    maxColorChangeField.setDocument(new IntegerDocument());
    maxColorChangeLabel.setLabelFor(maxColorChangeField);
    optPanel.add(maxColorChangeField, cc.xy(7, 11));
    maxColorChangeField.addFocusListener(focuser);

    populateValues();

    return optPanel;
}

From source file:com.mebigfatguy.polycasso.SettingsDialog.java

License:Apache License

private JPanel createGeneticsPanel() {

    JPanel geneticsPanel = new JPanel();
    geneticsPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(PolycassoBundle.getString(PolycassoBundle.Key.GeneticsOptions)),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));

    geneticsPanel.setLayout(new FormLayout("6dlu, pref, 3dlu, 100px, 3dlu",
            "pref, 1dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref"));
    CellConstraints cc = new CellConstraints();

    JLabel generationSizeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.GenerationSize));
    geneticsPanel.add(generationSizeLabel, cc.xyw(1, 1, 2));

    generationSizeField = new JTextField(4);
    generationSizeField.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.GenerationSizeToolTip));
    generationSizeField.setDocument(new IntegerDocument());
    generationSizeLabel.setLabelFor(generationSizeField);
    geneticsPanel.add(generationSizeField, cc.xy(4, 1));
    generationSizeField.addFocusListener(focuser);

    JLabel eliteSizeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.EliteSize));
    geneticsPanel.add(eliteSizeLabel, cc.xyw(1, 3, 2));

    eliteSizeField = new JTextField(4);
    eliteSizeField.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.EliteSizeToolTip));
    eliteSizeField.setDocument(new IntegerDocument());
    eliteSizeLabel.setLabelFor(eliteSizeField);
    geneticsPanel.add(eliteSizeField, cc.xy(4, 3));
    eliteSizeField.addFocusListener(focuser);

    useAnnealingButton = new JCheckBox(PolycassoBundle.getString(PolycassoBundle.Key.UseAnnealing));
    useAnnealingButton.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.UseAnnealingToolTip));
    geneticsPanel.add(useAnnealingButton, cc.xyw(1, 5, 5));

    JLabel startTemperatureLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.StartTemperature));
    geneticsPanel.add(startTemperatureLabel, cc.xy(2, 7));

    startTemperatureField = new JTextField(4);
    startTemperatureField//from  w w  w .  jav  a 2s .co m
            .setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.StartTemperatureToolTip));
    startTemperatureField.setDocument(new DoubleDocument());
    startTemperatureLabel.setLabelFor(startTemperatureField);
    geneticsPanel.add(startTemperatureField, cc.xy(4, 7));
    startTemperatureField.addFocusListener(focuser);

    JLabel coolingRateLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.CoolingRate));
    geneticsPanel.add(coolingRateLabel, cc.xy(2, 9));

    coolingRateField = new JTextField(4);
    coolingRateField.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.CoolingRateToolTip));
    coolingRateField.setDocument(new DoubleDocument());
    coolingRateLabel.setLabelFor(coolingRateField);
    geneticsPanel.add(coolingRateField, cc.xy(4, 9));
    coolingRateField.addFocusListener(focuser);

    return geneticsPanel;
}

From source file:com.mrfeinberg.babelizer.app.BabelizerMain.java

License:Apache License

public BabelizerMain() {
    phrase.addKeyListener(new TextAreaActionProvider(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            goButton.doClick();/*from  w w w. j  a  va  2  s  .co  m*/
        }
    }));
    goButton.addActionListener(this);

    phrase.setLineWrap(true);
    phrase.setRows(4);
    cycleCheckbox.setSelected(true);

    final JFrame f = getFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setJMenuBar(createMenuBar(f));

    final Container cp = f.getContentPane();
    cp.setLayout(new BorderLayout());

    final FormLayout layout = new FormLayout(//
            "right:p, 4dlu, p:g, p", //
            "p, 3dlu, p, 8dlu, p, 2dlu, t:p, 8dlu, f:d:g");
    final PanelBuilder builder = new PanelBuilder(layout);

    final CellConstraints cc = new CellConstraints();
    builder.setDefaultDialogBorder();

    builder.addLabel("From", cc.xy(1, 1));
    builder.add(fromMenu, cc.xywh(3, 1, 2, 1));
    builder.addLabel("To", cc.xy(1, 3));
    builder.add(toMenu, cc.xywh(3, 3, 2, 1));

    {
        final JScrollPane scrollPane = new JScrollPane(phrase);
        scrollPane.getVerticalScrollBar().setFocusable(false);
        builder.add(scrollPane, cc.xywh(1, 5, 4, 1));
    }

    builder.add(cycleCheckbox, cc.xywh(1, 7, 3, 1));
    builder.add(goButton, cc.xy(4, 7));

    {
        final JScrollPane scrollPane = new JScrollPane(textPane);
        scrollPane.getVerticalScrollBar().setFocusable(false);
        builder.add(scrollPane, cc.xywh(1, 9, 4, 1));
    }

    cp.add(builder.getContainer());
    cp.add(status, BorderLayout.SOUTH);

    factoryChosen(new com.mrfeinberg.translation.plugin.altavista.AltavistaTranslationServiceFactory());
    f.setVisible(true);
    phrase.grabFocus();
    phrase.selectAll();
}

From source file:com.mrfeinberg.proxyprefs.ProxyPrefsDialog.java

License:Apache License

private JComponent buildContentPane() {
    final FormLayout layout = new FormLayout("fill:pref", "fill:pref, pref");
    final PanelBuilder builder = new PanelBuilder(layout);
    builder.getPanel().setBorder(new EmptyBorder(12, 10, 10, 10));
    final CellConstraints cc = new CellConstraints();
    builder.add(buildEditorPanel(), cc.xy(1, 1));
    builder.add(buildButtonBar(), cc.xy(1, 2));
    return builder.getPanel();
}

From source file:com.mrfeinberg.proxyprefs.ProxyPrefsEditorBuilder.java

License:Apache License

public JComponent build() {
    initComponents();/*from   w w  w. ja  v  a2s  .  c  o m*/

    final FormLayout layout = new FormLayout( //
            "right:pref, 3dlu, 200dlu:grow", //
            "p, 3dlu, p, 3dlu, p");

    final PanelBuilder builder = new PanelBuilder(layout);
    final CellConstraints cc = new CellConstraints();

    builder.add(useProxyCheckbox, cc.xywh(1, 1, 3, 1));
    builder.addLabel("Host", cc.xy(1, 3));
    builder.add(hostField, cc.xy(3, 3));
    builder.addLabel("Port", cc.xy(1, 5));
    builder.add(portField, cc.xy(3, 5));

    return builder.getPanel();
}

From source file:com.od.jtimeseries.ui.visualizer.chart.ChartControlPanel.java

License:Open Source License

private void layoutPanel() {
    FormLayout l = new FormLayout("10px, pref:grow, 10px",
            "10px, pref, 5px, pref, 5px, pref, 5px, pref, 10px:grow");
    setLayout(l);//from   ww w  . j a  va 2 s  .com
    CellConstraints cc = new CellConstraints();
    add(createWidgetBox(createDisplayControls(), "Display"), cc.xy(2, 2));
    add(createWidgetBox(rangeModeCombo, "Range"), cc.xy(2, 4));
    add(createWidgetBox(timeSelector, "Time"), cc.xy(2, 6));
    add(createWidgetBox(dataFilterCombo, "Filters"), cc.xy(2, 8));
}

From source file:com.od.jtimeseries.ui.visualizer.chart.ChartControlPanel.java

License:Open Source License

private JComponent createDisplayControls() {
    FormLayout f = new FormLayout("pref:grow", "pref, 10px, pref, 10px, pref, 10px");
    JPanel p = new JPanel();
    p.setLayout(f);/*  w  w w  .  j  a va  2  s .  com*/
    CellConstraints cc = new CellConstraints();
    p.add(colorComboBox, cc.xy(1, 1));
    p.add(chartTypeCombo, cc.xy(1, 3));
    p.add(showLegendCheckbox, cc.xy(1, 5));
    return p;
}

From source file:com.od.jtimeseries.ui.visualizer.chart.ChartControlPanel.java

License:Open Source License

private JComponent createWidgetBox(JComponent widget, String title) {

    FormLayout f = new FormLayout("10px, max(175px;pref), 10px:grow", "5px,pref,5px");
    JPanel p = new JPanel();
    p.setLayout(f);/*from w w w.  ja  v  a  2s.  co  m*/
    CellConstraints cc = new CellConstraints();
    p.add(widget, cc.xy(2, 2));

    TitledBorder border = new TitledBorder(title);
    border.setTitleFont(border.getTitleFont());
    p.setBorder(border);
    return p;
}

From source file:com.pari.license.ui.LicenseGenDialog.java

License:Open Source License

@Override
public JComponent createContentPanel() {
    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new BorderLayout());
    contentPanel.setBackground(Color.white);

    seedTextArea = new AutoResizingTextArea(100, 100);
    seedTextArea.addMouseListener(new TextFieldMenu(seedTextArea));
    seedTextArea.setEditable(true);/*  w  w w.jav  a 2  s.co  m*/

    evaluationCheckBox = new JCheckBox("Evaluation License Only");
    evaluationCheckBox.setOpaque(false);
    evaluationCheckBox.setMargin(new Insets(0, 0, 0, 0));

    evaluationCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            enableControls();
        }
    });

    allowDeviceBeyondLicenseCheck = new JCheckBox("Allow to add devices beyond Maximum Devices");
    allowDeviceBeyondLicenseCheck.setOpaque(false);
    allowDeviceBeyondLicenseCheck.setMargin(new Insets(0, 0, 0, 0));

    allowDeviceBeyondLicenseCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
        }
    });

    JPanel optionsPane = new JPanel();
    optionsPane.setOpaque(false);

    String columnSpecs = "5dlu, pref, 5dlu, 175dlu, 5dlu, 30dlu";
    String rowSpecs = "pref, 4dlu, top:100dlu, 8dlu, pref, 4dlu, pref, 5dlu, pref, 5dlu, pref, 8dlu, pref, 6dlu, pref, 8dlu, pref";
    FormLayout formLayout = new FormLayout(columnSpecs, rowSpecs);
    DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, optionsPane);
    builder.setDefaultDialogBorder();

    evaluationPeriod = new NumericTextField();
    evaluationPeriod.addMouseListener(new TextFieldMenu(evaluationPeriod));

    maxDevices = new NumericTextField();
    maxDevices.addMouseListener(new TextFieldMenu(maxDevices));

    JLabel seedLabel = ControlFactory.createLabelFor("License Seed", true, seedTextArea, 'S');
    JLabel evalPeriodLabel = ControlFactory.createLabelFor("Evaluation Period", false, evaluationPeriod, 'E');
    JLabel maxDevicesLabel = ControlFactory.createLabelFor("Maximum Devices", true, maxDevices, 'M');

    CellConstraints cc = new CellConstraints();

    int rowIndex = 1;
    builder.addSeparator("License Seed Information", cc.xyw(1, rowIndex, 6));

    rowIndex += 2;
    builder.add(seedLabel, cc.xy(2, rowIndex));
    builder.add(new JScrollPane(seedTextArea), cc.xyw(4, rowIndex, 3));

    rowIndex += 2;
    builder.addSeparator("License Details", cc.xyw(1, rowIndex, 6));

    rowIndex += 2;
    builder.add(evaluationCheckBox, cc.xyw(2, rowIndex, 4));

    rowIndex += 2;
    builder.add(evalPeriodLabel, cc.xy(2, rowIndex));
    builder.add(evaluationPeriod, cc.xy(4, rowIndex));
    builder.add(new JLabel("(days)"), cc.xy(6, rowIndex));

    rowIndex += 2;
    builder.add(maxDevicesLabel, cc.xy(2, rowIndex));
    builder.add(maxDevices, cc.xy(4, rowIndex));

    rowIndex += 2;

    builder.add(allowDeviceBeyondLicenseCheck, cc.xyw(2, rowIndex, 4));

    contentPanel.add(optionsPane, BorderLayout.CENTER);

    licensedComponentsList = new CheckBoxList(getAllComponentNames());
    licensedComponentsList.setPreferredSize(new Dimension(350, 175));
    SearchableUtils.installSearchable(licensedComponentsList);

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3),
            BorderFactory.createTitledBorder("Select Licensed Components")));

    panel.setOpaque(false);
    panel.setLayout(new BorderLayout());
    panel.add(new JScrollPane(licensedComponentsList), BorderLayout.CENTER);

    contentPanel.add(panel, BorderLayout.SOUTH);

    contentPanel.setBackground(Color.white);
    setResizable(true);
    enableControls();
    return contentPanel;
}

From source file:com.projity.pm.graphic.chart.ChartLegend.java

License:Common Public License

public JComponent createContentPanel() {
    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    initControls();/*from   ww  w .j  a v  a  2s  .com*/
    FormLayout layout = new FormLayout("p:grow, 3dlu,100dlu:grow,5dlu, default, 5dlu", // cols //$NON-NLS-1$
            "p, 3dlu, p, 3dlu, p, 3dlu, " + (simple ? "" : "fill:") + "p:grow, 5dlu"); // rows       //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    CellConstraints cc = new CellConstraints();

    builder.addLabel(Messages.getString("ChartLegend.ResourceFilter"), cc.xy(1, 1)); //$NON-NLS-1$
    builder.add(filterComboBox, cc.xy(3, 1));
    builder.add(treeScrollPane, cc.xywh(1, 3, 3, 5));
    builder.add(tracesScrollPane, cc.xy(5, 7));
    if (simple) {
        builder.add(selectedOnTop, cc.xy(5, 1));
    } else {
        builder.add(cumulative, cc.xy(5, 1));
        builder.add(histogram, cc.xy(5, 3));
        builder.add(workCostRadioPanel(), cc.xy(5, 5));
    }
    return builder.getPanel();
}