private static JPanel makePane(String name, int choiceCount, Option... opts) {
    JPanel pane = new JPanel();
    pane.setBorder(BorderFactory.createTitledBorder(name));
    GroupLayout layout = new GroupLayout(pane);
    pane.setLayout(layout);

    Group g = layout.createSequentialGroup();
    Group g1 = layout.createParallelGroup();
    for (int i = 0; i < choiceCount; i++) {
      g1 = layout.createParallelGroup();
      for (Option o : opts) g1.addComponent(o.cChoices[i]);
      g.addGroup(g1);
    }
    layout.setHorizontalGroup(g);

    g = layout.createSequentialGroup();
    for (Option o : opts) {
      g1 = layout.createParallelGroup(Alignment.BASELINE);
      for (int i = 0; i < choiceCount; i++) g1.addComponent(o.cChoices[i]);
      g.addGroup(g1);
    }
    layout.setVerticalGroup(g);

    return pane;
  }
  private JPanel makeAPI() {
    JPanel p = new JPanel();
    GroupLayout layout = new GroupLayout(p);
    p.setLayout(layout);

    Group hg1 = layout.createParallelGroup();
    Group hg2 = layout.createParallelGroup();
    SequentialGroup vg = layout.createSequentialGroup();
    final int pref = GroupLayout.PREFERRED_SIZE;

    JComponent[] targs = initializeTargets();

    for (int i = 0; i < targs.length; i++) {
      JLabel label = new JLabel(labels[i]);

      hg1.addComponent(label);
      hg2.addComponent(targs[i]);

      vg.addGroup(
          layout
              .createParallelGroup(Alignment.BASELINE)
              /**/ .addComponent(label)
              /**/ .addComponent(targs[i], pref, pref, pref));
    }

    tfAuth = new JTextField(null);
    taDesc = new JTextArea();
    tfAuth.setEditable(false);
    taDesc.setEditable(false);
    taDesc.setLineWrap(true);
    taDesc.setWrapStyleWord(true);

    JLabel lAuth =
        new JLabel(Messages.getString("EnigmaSettingsFrame.LABEL_AUTHOR")); // $NON-NLS-1$
    JScrollPane desc = new JScrollPane(taDesc);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addGroup(hg1)
                    /*	*/ .addPreferredGap(ComponentPlacement.RELATED)
                    /*	*/ .addGroup(hg2))
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addComponent(lAuth)
                    /*	*/ .addPreferredGap(ComponentPlacement.RELATED)
                    /*	*/ .addComponent(tfAuth))
            /**/ .addComponent(desc));
    layout.setVerticalGroup(
        vg
            /**/ .addPreferredGap(ComponentPlacement.RELATED)
            /**/ .addGroup(
                layout
                    .createParallelGroup(Alignment.BASELINE)
                    /*	*/ .addComponent(lAuth)
                    /*	*/ .addComponent(tfAuth))
            /**/ .addPreferredGap(ComponentPlacement.RELATED)
            /**/ .addComponent(desc, 0, 0, Integer.MAX_VALUE));

    return p;
  }
  private JPanel makeSettings() {
    JPanel p = new JPanel();
    GroupLayout layout = new GroupLayout(p);
    p.setLayout(layout);

    List<JPanel> panels = generateOptionPanels();

    sDef = new SimpleCodeHolder(res.definitions);
    sGlobLoc = new SimpleCodeHolder(res.globalLocals);
    sInit = new SimpleCodeHolder(res.initialization);
    sClean = new SimpleCodeHolder(res.cleanup);

    bDef =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_DEFINITIONS"), CODE_ICON); // $NON-NLS-1$
    bGlobLoc =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_GLOBAL_LOCALS"),
            CODE_ICON); //$NON-NLS-1$
    bInit =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_INITIALIZATION"),
            CODE_ICON); //$NON-NLS-1$
    bClean =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_CLEANUP"), CODE_ICON); // $NON-NLS-1$

    bDef.addActionListener(this);
    bGlobLoc.addActionListener(this);
    bInit.addActionListener(this);
    bClean.addActionListener(this);

    Group gh = layout.createParallelGroup();
    SequentialGroup gv = layout.createSequentialGroup();
    if (panels != null)
      for (JPanel pp : panels) {
        gh.addComponent(pp);
        gv.addComponent(pp);
      }

    layout.setHorizontalGroup(
        gh
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addComponent(bDef)
                    /*	*/ .addComponent(bGlobLoc))
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addComponent(bInit)
                    /*	*/ .addComponent(bClean)));
    layout.setVerticalGroup(
        gv
            /**/ .addGroup(
                layout.createParallelGroup() /*	*/.addComponent(bDef) /*	*/.addComponent(bGlobLoc))
            /**/ .addGroup(
                layout.createParallelGroup() /*	*/.addComponent(bInit) /*	*/.addComponent(bClean))
            /**/ .addContainerGap());

    return p;
  }