コード例 #1
0
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    } catch (Exception exception) {
      exception.printStackTrace();
    }

    GoodiesForm form = new GoodiesForm();
    form.pack();
    form.setVisible(true);
  }
コード例 #2
0
  private void initialise(GoodiesForm goodiesForm) {
    System.out.println("GoodiesBlit running...");

    // 1. Create the layout
    FormLayout layout =
        new FormLayout(
            "right:pref, 3dlu, pref:grow, 7dlu, right:pref, 3dlu, pref:grow", // 7 columns
            "p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p, 9dlu, p"); // 13 rows

    // 2. Specify column and row groups
    layout.setColumnGroups(new int[][] {{1, 5}, {3, 7}});

    // 3. Create and configure builder
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();

    // 4. Add components
    CellConstraints cc = new CellConstraints();
    builder.addSeparator("General", cc.xyw(1, 1, 7));
    builder.addLabel("Company", cc.xy(1, 3));
    builder.add(new JTextField(), cc.xyw(3, 3, 5));
    builder.addLabel("Contact", cc.xy(1, 5));
    builder.add(new JTextField(), cc.xyw(3, 5, 5));
    builder.addSeparator("Propeller", cc.xyw(1, 7, 7));
    builder.addLabel("PTI [kW]", cc.xy(1, 9));
    builder.add(new JTextField(), cc.xy(3, 9));
    builder.addLabel("Power [kW]", cc.xy(5, 9));
    builder.add(new JTextField(), cc.xy(7, 9));
    builder.addLabel("R [mm]", cc.xy(1, 11));
    builder.add(new JTextField(), cc.xy(3, 11));
    builder.addLabel("D [mm]", cc.xy(5, 11));
    builder.add(new JTextField(), cc.xy(7, 11));
    builder.add(
        ButtonBarFactory.buildCenteredBar(new JButton("Ignite"), new JButton("Explode")),
        cc.xyw(1, 13, builder.getColumnCount()));

    JPanel goodiesPanel = builder.getPanel();
    goodiesPanel.setPreferredSize(new Dimension(400, 250));
    goodiesForm.getContentPane().add(goodiesPanel);
  }