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

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

Introduction

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

Prototype

public CellConstraints() 

Source Link

Document

Constructs a default instance of CellConstraints .

Usage

From source file:com.mebigfatguy.mongobrowser.dialogs.ConnectionDialog.java

License:Apache License

/**
 * create the panel that houses the input form
 * /*from ww  w .ja v  a2s  . co  m*/
 * @return the form panel
 */
private JPanel createFormPanel() {
    JPanel p = new JPanel();
    p.setLayout(new FormLayout("6dlu, pref, 5dlu, 200px, 6dlu", "6dlu, pref, 2dlu, pref, 6dlu"));
    CellConstraints cc = new CellConstraints();

    JLabel serverLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Server));
    p.add(serverLabel, cc.xy(2, 2));

    serverField = new JTextField();
    p.add(serverField, cc.xy(4, 2));
    serverField.setText("localhost");

    serverLabel.setLabelFor(serverField);

    JLabel portLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Port));
    p.add(portLabel, cc.xy(2, 4));

    portField = new JTextField();
    portField.setDocument(new IntegerDocument());
    p.add(portField, cc.xy(4, 4));
    portField.setText("27017");

    portLabel.setLabelFor(portField);

    return p;
}

From source file:com.mebigfatguy.mongobrowser.dialogs.ManageIndicesDialog.java

License:Apache License

private JPanel createIndicesListPanel(List<IndexDescription> indices) {
    JPanel p = new JPanel();
    p.setLayout(new FormLayout("6dlu, pref:grow, 5dlu, pref, 6dlu",
            "6dlu, 12dlu:grow, pref, 3dlu, pref, 12dlu:grow, 6dlu, pref, 6dlu"));
    CellConstraints cc = new CellConstraints();

    ManageIndicesModel model = new ManageIndicesModel(indices);

    indicesTable = new JTable(model);
    indicesTable.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()));
    indicesTable.setDefaultEditor(IndexFieldList.class, new IndexFieldListCellEditor());
    indicesTable.setDefaultRenderer(IndexFieldList.class, new IndexFieldListCellRenderer());
    p.add(new JScrollPane(indicesTable), cc.xywh(2, 2, 1, 5));

    addIndexButton = new JButton(MongoBundle.getString(MongoBundle.Key.AddIndex));
    p.add(addIndexButton, cc.xy(4, 3));//  w  ww .  j  a  v  a2  s.co m

    removeIndexButton = new JButton(MongoBundle.getString(MongoBundle.Key.RemoveIndex));
    p.add(removeIndexButton, cc.xy(4, 5));

    return p;
}

From source file:com.mebigfatguy.mongobrowser.dialogs.MongoControlPanel.java

License:Apache License

private void initComponents() {
    setBorder(BorderFactory.createLineBorder(Color.BLACK));
    setLayout(//from   w  ww  .  ja  v  a 2  s.  c o m
            new FormLayout("3dlu, pref, 1dlu, 150px, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref", "pref"));
    CellConstraints cc = new CellConstraints();

    JLabel dbLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Database));
    dbComboBox = new JComboBox(new DefaultComboBoxModel());
    dbComboBox.setEnabled(false);
    dbLabel.setLabelFor(dbComboBox);
    add(dbLabel, cc.xy(2, 1));
    add(dbComboBox, cc.xy(4, 1));

    dbNewCollectionButton = new JButton(new NewCollectionAction(context));
    ImageIcon icon = new ImageIcon(
            MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newcollection.png"));
    dbNewCollectionButton.setIcon(icon);
    dbNewCollectionButton.setText("");
    dbNewCollectionButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
    dbNewCollectionButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewCollection));
    add(dbNewCollectionButton, cc.xy(6, 1));
    dbNewCollectionButton.setEnabled(false);

    dbNewObjectButton = new JButton(new NewObjectAction(context));
    icon = new ImageIcon(
            MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newobject.png"));
    dbNewObjectButton.setIcon(icon);
    dbNewObjectButton.setText("");
    dbNewObjectButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
    dbNewObjectButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewObject));
    add(dbNewObjectButton, cc.xy(8, 1));
    dbNewObjectButton.setEnabled(false);

    dbNewKeyValueButton = new JButton(new NewKeyValueAction(context));
    icon = new ImageIcon(
            MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newkeyvalue.png"));
    dbNewKeyValueButton.setIcon(icon);
    dbNewKeyValueButton.setText("");
    dbNewKeyValueButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
    dbNewKeyValueButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewKeyValue));
    add(dbNewKeyValueButton, cc.xy(10, 1));
    dbNewKeyValueButton.setEnabled(false);

    dbDeleteButton = new JButton(new DeleteAction(context));
    icon = new ImageIcon(
            MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/delete.png"));
    dbDeleteButton.setIcon(icon);
    dbDeleteButton.setText(null);
    dbDeleteButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
    dbDeleteButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.Delete));
    add(dbDeleteButton, cc.xy(12, 1));
    dbDeleteButton.setEnabled(false);
}

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

License:Apache License

/**
 * creates the proxy settings panel//from   ww w  .  j a v  a2 s .c o  m
 * 
 * @return the proxy panel
 */
private JPanel createProxyPanel() {
    JPanel proxyPanel = new JPanel();
    proxyPanel.setLayout(new FormLayout("6dlu, pref, 3dlu, 200px:grow, 6dlu", "5dlu, pref, 3dlu, pref, 5dlu"));
    CellConstraints cc = new CellConstraints();

    JLabel hostLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.ProxyHost));
    proxyPanel.add(hostLabel, cc.xy(2, 2));
    proxyHostField = new JTextField();
    proxyPanel.add(proxyHostField, cc.xy(4, 2));
    hostLabel.setLabelFor(proxyHostField);

    JLabel portLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.ProxyPort));
    proxyPanel.add(portLabel, cc.xy(2, 4));
    proxyPortField = new JTextField();
    proxyPortField.setDocument(new IntegerDocument());
    proxyPanel.add(proxyPortField, cc.xy(4, 4));
    portLabel.setLabelFor(proxyPortField);

    populateValues();

    return proxyPanel;
}

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

License:Apache License

/**
 * creates the options (settings) panel//ww w . j  a  v  a 2s.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 ww . ja  va 2 s .  c o 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();/*  ww  w.  j  a v a2s  .  c o 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  ww w.ja va  2 s  . co  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);/*  w w w  .ja v  a  2  s  .  co m*/
    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));
}