示例#1
0
  private void layoutMainPanel() {
    FormLayout layout = new FormLayout("fill:p:g", "f:p:g, $ugap, f:p");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.border(Borders.DIALOG);

    closeButton = new JButton(rb.getString("Button.Close"));

    builder.append(component);
    builder.nextLine();
    builder.nextLine();
    builder.append(StaticUIMethods.buildCloseBar(closeButton));

    getContentPane().add(builder.getPanel());
    pack();

    closeButton.addActionListener(this);
  }
  private void buildPanel() {
    initComponents();

    FormLayout layout =
        new FormLayout("max(20dlu;d), 4dlu, 75dlu:grow(1.0)", "f:d, 3dlu, f:d, 10dlu, f:d");
    CellConstraints cc = new CellConstraints();

    layout.setRowGroups(new int[][] {{1, 3, 5}});

    JPanel p = new JPanel(layout);

    p.setBorder(Borders.DIALOG);
    p.add(new JLabel(rb.getString("Label.Date")), cc.xy(1, 1));
    p.add(datePanel, cc.xy(3, 1));
    p.add(new JLabel(rb.getString("Label.Number")), cc.xy(1, 3));
    p.add(numberCombo, cc.xy(3, 3));
    p.add(StaticUIMethods.buildOKCancelBar(okButton, cancelButton), cc.xyw(1, 5, 3));

    getContentPane().add(p, BorderLayout.CENTER);
  }
  private void layoutDialog() {

    final FormLayout layout = new FormLayout("p:g", "f:p:g(1.0)");

    final DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.border(Borders.DIALOG);

    builder.append(layoutPanel());
    builder.nextLine();

    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();
    builder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton));

    getContentPane().add(builder.getPanel(), BorderLayout.CENTER);

    pack();

    setMinimumSize(getSize());
  }
  private void layoutMainPanel() {
    initComponents();

    FormLayout layout = new FormLayout("p, 4dlu, fill:70dlu:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.border(Borders.DIALOG);

    builder.append(rb.getString("Label.DatabaseServer"), hostField);
    builder.append(rb.getString("Label.Port"), portField);
    builder.append(rb.getString("Label.Password"), passwordField);

    builder.nextLine();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();
    builder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton), 3);

    getContentPane().add(builder.getPanel());

    pack();

    setResizable(false);
  }