Esempio n. 1
0
    private void PicButtonActionPerformed(ActionEvent evt) {
      OKButton.setEnabled(true);
      javax.swing.Icon test = PicButton.getIcon();
      if (test instanceof ImageIcon) {
        if (isBIFpic) {
          String BIFFILENAME = "po_" + tmpname + "l.tga";
          try {
            InfoText.setText(BIFFILENAME);

            File tempImage = RESFAC.TempImageFile(BIFFILENAME);
            if (tempImage != null) {
              TargaImage curtga = new TargaImage(tempImage);
              CurrentPortrait.setIcon(new ImageIcon(curtga.getImage()));
              BICPortraitname = "po_" + tmpname;
              CURRENTPORTRAIT = tempImage.getParent() + FileDelim + baseFilename;
              OKButton.setEnabled(true);
            }
          } catch (IOException err) {
            JOptionPane.showMessageDialog(
                null,
                "Fatal Error - " + BIFFILENAME + " not found. Your data files might be corrupt.",
                "Error",
                0);
            System.exit(0);
          }
        } else {
          String PORTRAIT = qualifiedName;
          if (qualifiedName.toUpperCase().endsWith("M.TGA")) {
            CURRENTPORTRAIT = PORTRAIT;
            PORTRAIT = qualifiedName.substring(0, qualifiedName.length() - 5) + "l.tga";
          }

          ImageIcon icon = null;
          try {
            icon = new ImageIcon(new TargaImage(new File(PORTRAIT)).getImage());
          } catch (IOException e) {
            System.out.println("Invalid Icon: " + PORTRAIT);
            icon = null;
          }

          CurrentPortrait.setIcon(icon);
          BICPortraitname = baseFilename.substring(0, baseFilename.length() - 4);
          InfoText.setText(PORTRAIT.substring(PORTRAIT.lastIndexOf(FileDelim) + 1));
          if (BICPortraitname.toLowerCase().endsWith("m")
              || BICPortraitname.toLowerCase().endsWith("l")
              || BICPortraitname.toLowerCase().endsWith("h")
              || BICPortraitname.toLowerCase().endsWith("s")
              || BICPortraitname.toLowerCase().endsWith("t")) {
            BICPortraitname = BICPortraitname.substring(0, BICPortraitname.length() - 1);
          }
          OKButton.setEnabled(true);
        }
      }
    }
  /** algorithm performed */
  public void algorithmPerformed(AlgorithmBase algorithm) {
    if (alg.isCompleted()) {
      alg = null;
      // if OKButton is not null, then the rest are not null
      // we don't want to do these if this algoritm was done via a script
      if (OKButton != null) {
        OKButton.setEnabled(true);
        dwiPathBrowseButton.setEnabled(true);
        gradFileRadio.setEnabled(true);
        bmtxtFileRadio.setEnabled(true);
        performRegistrationCheckbox.setEnabled(true);
        registrationSettingsButton.setEnabled(true);
        dwiLabel.setEnabled(true);
        dicomB0VolumeLabel.setEnabled(true);
        // interleavedCheckbox.setEnabled(true);
        if (gradFileRadio.isSelected()) {
          gradientFileBrowseButton.setEnabled(true);
        } else {
          bmtxtFileBrowseButton.setEnabled(true);
        }
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        outputTextArea.append("*** End DTI Sorting Process *** \n");
      }

      // insertScriptLine();
      Preferences.debug("*** End DTI Sorting Process *** \n", Preferences.DEBUG_ALGORITHM);
      // System.out.println("*** End DTI Sorting Process *** \n");
    }
  }
Esempio n. 3
0
 public void enterCancelButton(Event ev) {
   if (ev.key == TAB) {
     if (ev.shiftDown()) OKButton.requestFocus();
     else nameField.requestFocus();
   }
   if (ev.key == NEWLINE) {
     handleEvent(new Event(this, Event.WINDOW_DESTROY, null));
   }
 } // enterCancelButton
 private void RaceButtonActionPerformed(ActionEvent evt) {
   int tmp = (new Integer(InfoNum.getText())).intValue();
   descstr = racialmap[tmp][racialtypes.Description];
   int descnum = ChkHex.ChkHex(descstr);
   // int descnum = (new Integer((String)racialmap[tmp].get(new
   // Integer(racialtypes.Description)))).intValue();
   DescriptionText.setText(TLKFAC.getEntry(descnum));
   DescriptionContainer.scrollRectToVisible(new Rectangle(10, 10));
   DescriptionContainer.getViewport().setViewPosition(new Point(0, 0)); // @DUG
   RACENUM = tmp;
   OKButton.setEnabled(true);
 }
 private void RecommendedButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_RecommendedButtonActionPerformed
   // Add your handling code here:
   // HUMAN IS DEFAULT RACE (RACE 6)
   descstr = racialmap[6][racialtypes.Description];
   int descnum = ChkHex.ChkHex(descstr);
   // int descnum = (new Integer((String)racialmap[6].get(new
   // Integer(racialtypes.Description)))).intValue();
   RACENUM = 6;
   DescriptionText.setText(TLKFAC.getEntry(descnum));
   OKButton.setEnabled(true);
 } // GEN-LAST:event_RecommendedButtonActionPerformed
Esempio n. 6
0
  public LogonAppDemo() {

    super("LogonAppDemo window");
    setLayout(null); // added from the version 1.02 program
    name = "";
    password = "";

    addNotify();
    resize(insets().left + insets().right + 333, insets().top + insets().bottom + 222);
    nameField = new TextField(20);
    add(nameField);
    nameField.reshape(insets().left + 117, insets().top + 68, 167, 25);
    logonLabel = new Label("Identification and Logon");
    logonLabel.setFont(new Font("Helvetica", Font.BOLD, 14));
    add(logonLabel);
    logonLabel.reshape(insets().left + 72, insets().top + 23, 186, 18);
    nameLabel = new Label("Name:");
    nameLabel.setFont(new Font("Dialog", Font.BOLD, 12));
    add(nameLabel);
    nameLabel.reshape(insets().left + 39, insets().top + 73, 47, 18);
    passwordField = new TextField(20);
    add(passwordField);
    passwordField.reshape(insets().left + 117, insets().top + 107, 168, 25);
    OKButton = new Button("OK");
    OKButton.setFont(new Font("Dialog", Font.BOLD, 12));
    add(OKButton);
    OKButton.reshape(insets().left + 72, insets().top + 158, 75, 27);
    passwordLabel = new Label("Password:"******"Dialog", Font.BOLD, 12));
    add(passwordLabel);
    passwordLabel.reshape(insets().left + 39, insets().top + 112, 69, 16);
    cancelButton = new Button("Cancel");
    cancelButton.setFont(new Font("Dialog", Font.BOLD, 12));
    add(cancelButton);
    cancelButton.reshape(insets().left + 186, insets().top + 156, 75, 29);

    show();
  } // LogonAppDemo
  /** Creates new form RaceMenu1 */
  public RaceMenu() {
    RACENUM = 6;
    initComponents();
    OKButton.setEnabled(false);
    DescriptionContainer.setViewportView(DescriptionText);

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    if ((screenSize.getWidth() > getContentPane().getWidth())
        && (screenSize.getHeight() > getContentPane().getHeight())) {
      int intwidth =
          new Double(((screenSize.getWidth() - getContentPane().getWidth()) / 2)).intValue();
      int intheight =
          new Double(((screenSize.getHeight() - getContentPane().getHeight()) / 2)).intValue();
      setLocation(intwidth, intheight);
    } else {
      setLocation(0, 0);
    }

    menucreate = TLKFactory.getCreateMenu();
    menucreate.BlockWindow(true);
    TLKFAC = menucreate.getTLKFactory();
    RESFAC = menucreate.getResourceFactory();
    String imagestring = "";
    DescriptionText.setText(TLKFAC.getEntry(485));
    try {
      racialmap = RESFAC.getResourceAs2DA("racialtypes");
    } catch (IOException err) {
      JOptionPane.showMessageDialog(
          null,
          "Fatal Error - racialtypes.2da not found. Your data files might be corrupt.",
          "Error",
          0);
      System.exit(0);
    }
    for (int i = 0; i < racialmap.length; i++) {
      String tempispc = racialmap[i][racialtypes.PlayerRace];
      if (tempispc != null && tempispc.equalsIgnoreCase("1")) {
        RaceButton racebutton = new RaceButton();
        descstr = racialmap[i][racialtypes.Name];
        int descnum = ChkHex.ChkHex(descstr);
        racebutton.RaceButton.setText(TLKFAC.getEntry(descnum));
        racebutton.setSize(240, 52);
        racebutton.InfoNum.setText(Integer.toString(i));
        RaceButtonList.add(racebutton, -1);
      }
    }

    pack();
  }
Esempio n. 8
0
  /** Creates new form PortraitMenu1 */
  public PortraitMenu() {
    menucreate = TLKFactory.getCreateMenu();
    TLKFAC = menucreate.getTLKFactory();
    RESFAC = menucreate.getResourceFactory();
    Preferences prefs = Preferences.userRoot().node("/CharacterCreator");
    String NWNDir = prefs.get("GameDir", null);
    FileDelim = prefs.get("FileDelim", null);
    directory = NWNDir + "portraits" + FileDelim;
    menucreate.BlockWindow(true);
    initComponents();
    PortraitScrollPane.setViewportView(PortraitsWindow);
    OKButton.setEnabled(false);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    if ((screenSize.getWidth() > getContentPane().getWidth())
        && (screenSize.getHeight() > getContentPane().getHeight())) {
      int intwidth =
          new Double(((screenSize.getWidth() - getContentPane().getWidth()) / 2)).intValue();
      int intheight =
          new Double(((screenSize.getHeight() - getContentPane().getHeight()) / 2)).intValue();
      setLocation(intwidth, intheight);
    } else setLocation(0, 0);

    try {
      portraitmap = RESFAC.getResourceAs2DA("portraits");
    } catch (IOException err) {
      JOptionPane.showMessageDialog(
          null,
          "Fatal Error - portraits.2da not found. Your data files might be corrupt.",
          "Error",
          0);
      System.exit(0);
    }

    CURRENTPORTRAIT = "resource/portrait.jpg";
    java.net.URL targurl = getClass().getResource(CURRENTPORTRAIT);
    CurrentPortrait.setIcon(new ImageIcon(targurl));
    menucreate = TLKFactory.getCreateMenu();
    sexlock = true;
    racelock = true;

    RedoPortraits(-1);

    pack();
  }
Esempio n. 9
0
  public void keyPressPasswordField(Event ev) {

    String tmp = "";
    char ch = (char) ev.key;
    if ((EXCLAMATION <= ev.key) && (ev.key <= TILDE)) {
      password += ch;
      passwordField.setText(passwordField.getText() + "*");
    }
    if (ev.key == BACKSPACE) {
      if (password.length() > 0) {
        tmp += password.substring(0, password.length() - 1);
        password = tmp;
        tmp = "";
        for (int index = 0; index < password.length(); index++) tmp += "*";
        passwordField.setText(tmp);
        tmp = "";
      }
    }
    if ((ev.key == TAB) || (ev.key == NEWLINE)) {
      if (ev.shiftDown()) nameField.requestFocus();
      else OKButton.requestFocus();
    }
  } // keyPressPasswordField
Esempio n. 10
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    imageInfoLabel = new javax.swing.JLabel();
    imgNameLabel = new javax.swing.JLabel();
    imgTypeLabel = new javax.swing.JLabel();
    imgSectorSizeLabel = new javax.swing.JLabel();
    imgNameValue = new javax.swing.JLabel();
    imgTypeValue = new javax.swing.JLabel();
    imgSectorSizeValue = new javax.swing.JLabel();
    OKButton = new javax.swing.JButton();
    imgTotalSizeLabel = new javax.swing.JLabel();
    imgTotalSizeValue = new javax.swing.JLabel();
    imgHashLabel = new javax.swing.JLabel();
    imgHashValue = new javax.swing.JLabel();

    imageInfoLabel.setFont(imageInfoLabel.getFont().deriveFont(Font.BOLD, 18));
    imageInfoLabel.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imageInfoLabel.text")); // NOI18N

    imgNameLabel.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgNameLabel.text")); // NOI18N

    imgTypeLabel.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgTypeLabel.text")); // NOI18N

    imgSectorSizeLabel.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgSectorSizeLabel.text")); // NOI18N

    imgNameValue.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgNameValue.text")); // NOI18N

    imgTypeValue.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgTypeValue.text")); // NOI18N

    imgSectorSizeValue.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgSectorSizeValue.text")); // NOI18N

    OKButton.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.OKButton.text")); // NOI18N

    imgTotalSizeLabel.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgTotalSizeLabel.text")); // NOI18N

    imgTotalSizeValue.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgTotalSizeValue.text")); // NOI18N

    imgHashLabel.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgHashLabel.text")); // NOI18N

    imgHashValue.setText(
        org.openide.util.NbBundle.getMessage(
            ImageDetailsPanel.class, "ImageDetailsPanel.imgHashValue.text")); // NOI18N

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(0, 68, Short.MAX_VALUE)
                    .addComponent(imageInfoLabel)
                    .addContainerGap(78, Short.MAX_VALUE))
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(imgNameLabel)
                            .addComponent(imgTypeLabel)
                            .addComponent(imgSectorSizeLabel)
                            .addComponent(imgTotalSizeLabel)
                            .addComponent(imgHashLabel))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(imgNameValue)
                            .addComponent(imgTypeValue)
                            .addComponent(imgSectorSizeValue)
                            .addComponent(imgTotalSizeValue)
                            .addComponent(imgHashValue))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(
                        OKButton,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        80,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(38, 38, 38)
                    .addComponent(imageInfoLabel)
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(imgNameValue)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(imgTypeValue)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(imgSectorSizeValue)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(imgTotalSizeValue)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(imgHashValue))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(imgNameLabel)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .UNRELATED)
                                                    .addComponent(imgTypeLabel)
                                                    .addGap(25, 25, 25))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(50, 50, 50)
                                                    .addComponent(imgSectorSizeLabel)))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(imgTotalSizeLabel)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(imgHashLabel)))
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                    .addComponent(OKButton)
                    .addContainerGap()));
  } // </editor-fold>//GEN-END:initComponents
Esempio n. 11
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() { // GEN-BEGIN:initComponents
    java.awt.GridBagConstraints gridBagConstraints;

    CurrentPortrait = new javax.swing.JLabel();
    RaceCheck = new javax.swing.JCheckBox();
    SexCheck = new javax.swing.JCheckBox();
    PortraitScrollPane = new javax.swing.JScrollPane();
    PortraitsWindow = new javax.swing.JPanel();
    OKButton = new javax.swing.JButton();
    CancelButton = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    InfoText = new javax.swing.JTextField();
    FirstButton = new javax.swing.JButton();
    BackButton = new javax.swing.JButton();
    ForwardButton = new javax.swing.JButton();
    LastButton = new javax.swing.JButton();
    jPanel8 = new javax.swing.JPanel();
    jPanel9 = new javax.swing.JPanel();

    getContentPane().setLayout(new java.awt.GridBagLayout());

    setTitle("Portraits");
    setName("PortFrame");
    setResizable(false);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
          }
        });

    CurrentPortrait.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/CharacterCreator/resource/portrait.jpg")));
    CurrentPortrait.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    CurrentPortrait.setMaximumSize(new java.awt.Dimension(128, 200));
    CurrentPortrait.setMinimumSize(new java.awt.Dimension(128, 200));
    CurrentPortrait.setPreferredSize(new java.awt.Dimension(128, 200));
    CurrentPortrait.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    getContentPane().add(CurrentPortrait, gridBagConstraints);

    RaceCheck.setSelected(true);
    RaceCheck.setText("Lock To Race");
    RaceCheck.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            RaceCheckActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    getContentPane().add(RaceCheck, gridBagConstraints);

    SexCheck.setSelected(true);
    SexCheck.setText("Lock to Gender");
    SexCheck.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SexCheckActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    getContentPane().add(SexCheck, gridBagConstraints);

    PortraitScrollPane.setHorizontalScrollBarPolicy(
        javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    PortraitScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    PortraitScrollPane.setMinimumSize(new java.awt.Dimension(640, 500));
    PortraitScrollPane.setPreferredSize(new java.awt.Dimension(658, 500));
    PortraitScrollPane.setAutoscrolls(true);
    PortraitsWindow.setLayout(new java.awt.GridLayout(0, 10));

    PortraitsWindow.setMaximumSize(new java.awt.Dimension(640, 500));
    PortraitsWindow.setMinimumSize(new java.awt.Dimension(640, 500));
    PortraitScrollPane.setViewportView(PortraitsWindow);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 6;
    gridBagConstraints.gridheight = 9;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(PortraitScrollPane, gridBagConstraints);

    OKButton.setText("OK");
    OKButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
    getContentPane().add(OKButton, gridBagConstraints);

    CancelButton.setText("Cancel");
    CancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(CancelButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    getContentPane().add(jPanel1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    getContentPane().add(jPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 12;
    getContentPane().add(jPanel3, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    getContentPane().add(jPanel4, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    getContentPane().add(jPanel5, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    getContentPane().add(jPanel6, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 7;
    getContentPane().add(jPanel7, gridBagConstraints);

    InfoText.setBackground(new java.awt.Color(204, 204, 204));
    InfoText.setFont(new java.awt.Font("Dialog", 0, 10));
    InfoText.setForeground(new java.awt.Color(255, 0, 0));
    InfoText.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    InfoText.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
    getContentPane().add(InfoText, gridBagConstraints);

    FirstButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/CharacterCreator/resource/first.gif")));
    FirstButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            FirstButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 11;
    getContentPane().add(FirstButton, gridBagConstraints);

    BackButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/CharacterCreator/resource/back.gif")));
    BackButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            BackButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 11;
    getContentPane().add(BackButton, gridBagConstraints);

    ForwardButton.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/CharacterCreator/resource/forward.gif")));
    ForwardButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ForwardButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 7;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    getContentPane().add(ForwardButton, gridBagConstraints);

    LastButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/CharacterCreator/resource/last.gif")));
    LastButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            LastButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 8;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    getContentPane().add(LastButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.ipadx = 4;
    gridBagConstraints.insets = new java.awt.Insets(0, 85, 0, 85);
    getContentPane().add(jPanel8, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 6;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.insets = new java.awt.Insets(0, 25, 0, 25);
    getContentPane().add(jPanel9, gridBagConstraints);

    pack();
  } // GEN-END:initComponents
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLayeredPane1 = new javax.swing.JLayeredPane();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    fieldNameLabel = new javax.swing.JLabel();
    widthTextField = new javax.swing.JTextField();
    OKButton = new javax.swing.JButton();
    CancelButton = new javax.swing.JButton();

    setResizable(false);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    jPanel1.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            null,
            "Set Column Width",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            new java.awt.Font("Dialog", 0, 10))); // NOI18N

    jLabel1.setFont(new java.awt.Font("Dialog", 0, 10));
    jLabel1.setText("Width");

    jLabel2.setFont(new java.awt.Font("Dialog", 0, 10));
    jLabel2.setText("Column");

    fieldNameLabel.setFont(new java.awt.Font("Dialog", 0, 10));
    fieldNameLabel.setText("jLabel3");

    widthTextField.setFont(new java.awt.Font("SansSerif", 0, 10));
    widthTextField.setText("jTextField1");

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel1Layout
                    .createSequentialGroup()
                    .add(9, 9, 9)
                    .add(
                        jLabel2,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        70,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(45, 45, 45)
                    .add(
                        jLabel1,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        70,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(
                jPanel1Layout
                    .createSequentialGroup()
                    .add(9, 9, 9)
                    .add(
                        fieldNameLabel,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        80,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(35, 35, 35)
                    .add(
                        widthTextField,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        90,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel1Layout
                    .createSequentialGroup()
                    .add(5, 5, 5)
                    .add(
                        jPanel1Layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(
                                jLabel2,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                20,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(
                                jLabel1,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                20,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(5, 5, 5)
                    .add(
                        jPanel1Layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(
                                fieldNameLabel,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                20,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(
                                widthTextField,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))));

    jPanel1.setBounds(5, 5, 245, 93);
    jLayeredPane1.add(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

    OKButton.setFont(new java.awt.Font("Dialog", 0, 10));
    OKButton.setText("Ok");
    OKButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKButtonActionPerformed(evt);
          }
        });
    OKButton.setBounds(90, 100, 80, 25);
    jLayeredPane1.add(OKButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

    CancelButton.setFont(new java.awt.Font("Dialog", 0, 10));
    CancelButton.setText("Cancel");
    CancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelButtonActionPerformed(evt);
          }
        });
    CancelButton.setBounds(170, 100, 80, 25);
    jLayeredPane1.add(CancelButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jLayeredPane1,
                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                340,
                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jLayeredPane1,
                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                160,
                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE));
  } // </editor-fold>//GEN-END:initComponents
  public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();

    if (command.equalsIgnoreCase("dwiPathBrowse")) {
      JFileChooser chooser = new JFileChooser();
      if (currDir != null) {
        chooser.setCurrentDirectory(new File(currDir));
      }
      chooser.setDialogTitle("Choose dicom study directory or rec file");
      chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
      int returnValue = chooser.showOpenDialog(this);
      if (returnValue == JFileChooser.APPROVE_OPTION) {
        if (chooser.getSelectedFile().isDirectory()) {
          prFileName = "";
          prFileDir = "";
          dwiPathTextField.setText(chooser.getSelectedFile().getAbsolutePath());
          currDir = chooser.getSelectedFile().getAbsolutePath();
          studyName = chooser.getSelectedFile().getName();
          setStudyPath(dwiPathTextField.getText().trim());
          performRegistrationCheckbox.setEnabled(true);
          isDICOM = true;
          regOptions = new JDialogDTICreateListFileRegOAR35DOptions(isDICOM);
          regOptions.setVariables();
        } else {
          String absolutePath = chooser.getSelectedFile().getAbsolutePath();
          String extension = FileUtility.getExtension(absolutePath);
          if (extension.equalsIgnoreCase(".rec") || extension.equalsIgnoreCase(".frec")) {
            dwiPathTextField.setText(absolutePath);
            prFileDir = chooser.getSelectedFile().getParent();
            prFileName = chooser.getSelectedFile().getName();
            currDir = chooser.getSelectedFile().getParentFile().getAbsolutePath();
            performRegistrationCheckbox.setEnabled(true);
            isDICOM = false;
            regOptions = new JDialogDTICreateListFileRegOAR35DOptions(isDICOM);
            regOptions.setVariables();
          } else {
            MipavUtil.displayError(
                "A proper Par/Rec data file was not chosen...file must be either .rec or .frec");
            return;
          }
        }
      }
    } else if (command.equalsIgnoreCase("gradientFileBrowse")) {
      JFileChooser chooser = new JFileChooser();
      if (currDir != null) {
        chooser.setCurrentDirectory(new File(currDir));
      }
      chooser.setDialogTitle("Choose gradient file");
      int returnValue = chooser.showOpenDialog(this);
      if (returnValue == JFileChooser.APPROVE_OPTION) {
        gradientFilePathTextField.setText(chooser.getSelectedFile().getAbsolutePath());
        currDir = chooser.getSelectedFile().getParentFile().getAbsolutePath();
      }
    } else if (command.equalsIgnoreCase("bmtxtFileBrowse")) {
      JFileChooser chooser = new JFileChooser();
      if (currDir != null) {
        chooser.setCurrentDirectory(new File(currDir));
      }
      chooser.setDialogTitle("Choose b matrix file");
      int returnValue = chooser.showOpenDialog(this);
      if (returnValue == JFileChooser.APPROVE_OPTION) {
        bmtxtFilePathTextField.setText(chooser.getSelectedFile().getAbsolutePath());
        currDir = chooser.getSelectedFile().getParentFile().getAbsolutePath();
      }
    } else if (command.equalsIgnoreCase("dicomB0VolumeBrowse")) {
      JFileChooser chooser = new JFileChooser();
      if (currDir != null) {
        chooser.setCurrentDirectory(new File(currDir));
      }
      chooser.setDialogTitle("Choose B0 volume");
      int returnValue = chooser.showOpenDialog(this);
      if (returnValue == JFileChooser.APPROVE_OPTION) {
        dicomB0VolumeTextField.setText(chooser.getSelectedFile().getAbsolutePath());
        dicomB0VolumePath = dicomB0VolumeTextField.getText().trim();
        currDir = chooser.getSelectedFile().getParentFile().getAbsolutePath();
      }

    } else if (command.equalsIgnoreCase("gradFileRadio")) {
      bmtxtFilePathTextField.setText("");
      bmtxtFilePathTextField.setEnabled(false);
      // bmtxtFilePathTextField.setBackground(Color.lightGray);
      bmtxtFilePathTextField.setBorder(new LineBorder(Color.gray));
      bmtxtFileBrowseButton.setEnabled(false);
      gradientFilePathTextField.setEnabled(true);
      gradientFileBrowseButton.setEnabled(true);
      // gradientFilePathTextField.setBackground(Color.white);
      gradientFilePathTextField.setBorder(new LineBorder(Color.black));

    } else if (command.equalsIgnoreCase("bmtxtFileRadio")) {
      gradientFilePathTextField.setText("");
      gradientFilePathTextField.setEnabled(false);
      // gradientFilePathTextField.setBackground(Color.lightGray);
      gradientFilePathTextField.setBorder(new LineBorder(Color.gray));
      gradientFileBrowseButton.setEnabled(false);
      bmtxtFilePathTextField.setEnabled(true);
      bmtxtFileBrowseButton.setEnabled(true);
      // bmtxtFilePathTextField.setBackground(Color.white);
      bmtxtFilePathTextField.setBorder(new LineBorder(Color.black));
    } else if (command.equalsIgnoreCase("ok")) {
      outputTextArea.setText("");
      if (prFileName.equals("")) {
        if (dwiPathTextField.getText().trim().equals("")
            || (gradientFilePathTextField.getText().trim().equals("")
                && bmtxtFilePathTextField.getText().trim().equals(""))) {
          MipavUtil.displayError("DWI data and either gradient file or b matrix file are required");
          return;
        }
      }
      /*if(interleavedCheckbox.isSelected()) {
      	if(bmtxtFilePathTextField.getText().trim().equals("")) {
      		MipavUtil.displayError("For interleaved datasets, b-matrix file is required");
      		gradientFilePathTextField.setText("");
      		bmtxtFilePathTextField.setText("");
      		return;
      	}
      }*/
      boolean success = validateFilePaths();
      if (!success) {
        MipavUtil.displayError("One or both of the paths provided is not accurate");
        dwiPathTextField.setText("");
        gradientFilePathTextField.setText("");
        bmtxtFilePathTextField.setText("");
        return;
      }

      OKButton.setEnabled(false);
      dwiPathBrowseButton.setEnabled(false);
      gradientFileBrowseButton.setEnabled(false);
      bmtxtFileBrowseButton.setEnabled(false);
      gradFileRadio.setEnabled(false);
      bmtxtFileRadio.setEnabled(false);
      performRegistrationCheckbox.setEnabled(false);
      registrationSettingsButton.setEnabled(false);
      dwiLabel.setEnabled(false);
      dicomB0VolumeLabel.setEnabled(false);

      // setStudyPath(studyPathTextField.getText().trim());
      setGradientPath(gradientFilePathTextField.getText().trim());
      setBmtxtPath(bmtxtFilePathTextField.getText().trim());
      setCursor(new Cursor(Cursor.WAIT_CURSOR));
      // setInterleaved(interleavedCheckbox.isSelected());
      // interleavedCheckbox.setEnabled(false);
      callAlgorithm();
    } else if (command.equalsIgnoreCase("performRegistrationCheckbox")) {
      if (performRegistrationCheckbox.isSelected()) {
        registrationSettingsButton.setEnabled(true);
        if (isDICOM) {
          dicomB0VolumeLabel.setEnabled(true);
          dicomB0VolumeTextField.setEnabled(true);
          dicomB0VolumeTextField.setBorder(new LineBorder(Color.black));
          dicomB0VolumeBrowseButton.setEnabled(true);
        }
      } else {
        registrationSettingsButton.setEnabled(false);
        dicomB0VolumeLabel.setEnabled(false);
        dicomB0VolumeTextField.setText("");
        dicomB0VolumeTextField.setEnabled(false);
        dicomB0VolumeTextField.setBorder(new LineBorder(Color.gray));
        dicomB0VolumeBrowseButton.setEnabled(false);
      }
    } else if (command.equalsIgnoreCase("registrationSettingsButton")) {
      regOptions.setVisible(true);
    } else if (command.equalsIgnoreCase("cancel")) {
      regOptions.dispose();
      dispose();
    } else if (command.equalsIgnoreCase("help")) {
      // MipavUtil.showHelp("DTI00010");
      MipavUtil.showWebHelp("DTI:_Create_List_File");
    } else {
      super.actionPerformed(e);
    }
  }
  public void init() {
    setForeground(Color.black);
    setTitle("DTI Create List File " + " v1.0");

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints mainPanelConstraints = new GridBagConstraints();
    JPanel mainPanel = new JPanel(gbl);

    performRegistrationCheckbox = new JCheckBox("Register first");
    performRegistrationCheckbox.setFont(serif12B);
    performRegistrationCheckbox.setSelected(false);
    performRegistrationCheckbox.addActionListener(this);
    performRegistrationCheckbox.setActionCommand("performRegistrationCheckbox");
    performRegistrationCheckbox.setEnabled(false);
    registrationSettingsButton = new JButton("Registration Settings");
    registrationSettingsButton.setFont(serif12B);
    registrationSettingsButton.setEnabled(false);
    registrationSettingsButton.addActionListener(this);
    registrationSettingsButton.setActionCommand("registrationSettingsButton");
    dicomB0VolumeLabel = new JLabel("DICOM B0 volume: ");
    dicomB0VolumeLabel.setFont(serif12B);
    dicomB0VolumeLabel.setEnabled(false);
    dicomB0VolumeTextField = new JTextField(55);
    dicomB0VolumeTextField.setEditable(false);
    dicomB0VolumeTextField.setEnabled(false);
    dicomB0VolumeTextField.setBorder(new LineBorder(Color.gray));
    dicomB0VolumeBrowseButton = new JButton("Browse");
    dicomB0VolumeBrowseButton.setFont(serif12B);
    dicomB0VolumeBrowseButton.addActionListener(this);
    dicomB0VolumeBrowseButton.setActionCommand("dicomB0VolumeBrowse");
    dicomB0VolumeBrowseButton.setEnabled(false);
    JLabel dicomB0InfoLabel = new JLabel("Select the first image slice in the volume");
    dicomB0InfoLabel.setFont(serif12B);
    dicomB0InfoLabel.setEnabled(false);

    JPanel regPanel = new JPanel(gbl);
    regPanel.setBorder(buildTitledBorder("Registration"));
    GridBagConstraints regPanelConstraints = new GridBagConstraints();
    regPanelConstraints.gridx = 0;
    regPanelConstraints.gridy = 0;
    regPanelConstraints.anchor = GridBagConstraints.WEST;
    regPanelConstraints.insets = new Insets(0, 5, 15, 5);
    regPanel.add(performRegistrationCheckbox, regPanelConstraints);
    regPanelConstraints.gridx = 1;
    regPanelConstraints.gridy = 0;
    regPanelConstraints.insets = new Insets(0, 5, 15, 5);
    regPanel.add(registrationSettingsButton, regPanelConstraints);
    regPanelConstraints.gridx = 0;
    regPanelConstraints.gridy = 1;
    regPanelConstraints.insets = new Insets(0, 5, 5, 5);
    regPanel.add(dicomB0VolumeLabel, regPanelConstraints);
    regPanelConstraints.gridx = 1;
    regPanelConstraints.gridy = 1;
    regPanelConstraints.insets = new Insets(0, 5, 5, 5);
    regPanel.add(dicomB0VolumeTextField, regPanelConstraints);
    regPanelConstraints.gridx = 2;
    regPanelConstraints.gridy = 1;
    regPanelConstraints.insets = new Insets(0, 5, 5, 5);
    regPanel.add(dicomB0VolumeBrowseButton, regPanelConstraints);
    regPanelConstraints.gridx = 1;
    regPanelConstraints.gridy = 2;
    regPanelConstraints.gridwidth = 3;
    regPanelConstraints.anchor = GridBagConstraints.CENTER;
    regPanelConstraints.insets = new Insets(0, 5, 15, 5);
    regPanel.add(dicomB0InfoLabel, regPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.insets = new Insets(15, 5, 5, 0);
    mainPanelConstraints.gridwidth = 1;
    mainPanelConstraints.anchor = GridBagConstraints.WEST;
    dwiLabel = new JLabel(" DWI data : ");
    dwiLabel.setFont(serif12B);
    mainPanel.add(dwiLabel, mainPanelConstraints);

    mainPanelConstraints.gridx = 1;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.insets = new Insets(15, 5, 5, 0);
    dwiPathTextField = new JTextField(55);
    dwiPathTextField.setEditable(false);
    // dwiPathTextField.setBackground(Color.white);
    dwiPathTextField.setBorder(new LineBorder(Color.black));
    mainPanel.add(dwiPathTextField, mainPanelConstraints);

    mainPanelConstraints.gridx = 2;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.insets = new Insets(15, 5, 5, 5);
    dwiPathBrowseButton = new JButton("Browse");
    dwiPathBrowseButton.setFont(serif12B);
    dwiPathBrowseButton.addActionListener(this);
    dwiPathBrowseButton.setActionCommand("dwiPathBrowse");
    mainPanel.add(dwiPathBrowseButton, mainPanelConstraints);

    // mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    // interleavedCheckbox = new JCheckBox("  interleaved dataset");
    // mainPanelConstraints.gridx = 1;
    // mainPanelConstraints.gridy = 1;
    // mainPanelConstraints.insets = new Insets(0,5,55,5);
    // mainPanel.add(interleavedCheckbox, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    JLabel dwiDataInfoLabel =
        new JLabel(
            "For DICOM datasets, select the top level study directory.  For Par/Rec datasets, select the .rec file");
    dwiDataInfoLabel.setFont(serif12B);
    dwiDataInfoLabel.setEnabled(false);
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 1;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 70, 5);
    mainPanel.add(dwiDataInfoLabel, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.WEST;
    optionsGroup = new ButtonGroup();

    gradFileRadio = new JRadioButton(" gradient file : ");
    gradFileRadio.setFont(serif12B);
    gradFileRadio.setSelected(true);
    gradFileRadio.addActionListener(this);
    gradFileRadio.setActionCommand("gradFileRadio");
    optionsGroup.add(gradFileRadio);
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 2;
    mainPanelConstraints.gridwidth = 1;
    mainPanelConstraints.insets = new Insets(0, 5, 15, 0);
    mainPanel.add(gradFileRadio, mainPanelConstraints);

    mainPanelConstraints.gridx = 1;
    mainPanelConstraints.gridy = 2;
    mainPanelConstraints.insets = new Insets(0, 5, 15, 0);
    gradientFilePathTextField = new JTextField(55);
    gradientFilePathTextField.setEditable(false);
    gradientFilePathTextField.setBorder(new LineBorder(Color.black));
    // gradientFilePathTextField.setBackground(Color.white);
    mainPanel.add(gradientFilePathTextField, mainPanelConstraints);

    mainPanelConstraints.gridx = 2;
    mainPanelConstraints.gridy = 2;
    mainPanelConstraints.insets = new Insets(0, 5, 15, 5);
    gradientFileBrowseButton = new JButton("Browse");
    gradientFileBrowseButton.setFont(serif12B);
    gradientFileBrowseButton.addActionListener(this);
    gradientFileBrowseButton.setActionCommand("gradientFileBrowse");
    mainPanel.add(gradientFileBrowseButton, mainPanelConstraints);

    bmtxtFileRadio = new JRadioButton(" b-matrix file : ");
    bmtxtFileRadio.setFont(serif12B);
    bmtxtFileRadio.setSelected(false);
    bmtxtFileRadio.addActionListener(this);
    bmtxtFileRadio.setActionCommand("bmtxtFileRadio");
    optionsGroup.add(bmtxtFileRadio);
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 5, 0);
    mainPanel.add(bmtxtFileRadio, mainPanelConstraints);

    mainPanelConstraints.gridx = 1;
    mainPanelConstraints.gridy = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 5, 0);
    bmtxtFilePathTextField = new JTextField(55);
    bmtxtFilePathTextField.setText("");
    bmtxtFilePathTextField.setEnabled(false);
    bmtxtFilePathTextField.setEditable(false);
    bmtxtFilePathTextField.setBorder(new LineBorder(Color.gray));
    // bmtxtFilePathTextField.setBackground(Color.lightGray);
    mainPanel.add(bmtxtFilePathTextField, mainPanelConstraints);

    mainPanelConstraints.gridx = 2;
    mainPanelConstraints.gridy = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 5, 5);
    bmtxtFileBrowseButton = new JButton("Browse");
    bmtxtFileBrowseButton.setFont(serif12B);
    bmtxtFileBrowseButton.addActionListener(this);
    bmtxtFileBrowseButton.setActionCommand("bmtxtFileBrowse");
    bmtxtFileBrowseButton.setEnabled(false);
    mainPanel.add(bmtxtFileBrowseButton, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 4;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 30, 5);
    JLabel parRecInfoLabel =
        new JLabel(
            "Gradient file or b-matrix file must be provided for all DICOM study directories and for versions 4.0 and earlier of Par/Rec");
    parRecInfoLabel.setFont(serif12B);
    parRecInfoLabel.setEnabled(false);
    mainPanel.add(parRecInfoLabel, mainPanelConstraints);

    // mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    // mainPanelConstraints.gridx = 1;
    // mainPanelConstraints.gridy = 4;
    // mainPanelConstraints.insets = new Insets(10,5,5,5);
    // JLabel interleavedLabel = new JLabel("* for interleaved datasets, b-matrix file is
    // required");
    // mainPanel.add(interleavedLabel, mainPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 5;
    mainPanelConstraints.insets = new Insets(15, 5, 15, 0);
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    mainPanel.add(regPanel, mainPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 6;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(15, 5, 15, 5);
    outputTextArea = new JTextArea(15, 70);
    outputTextArea.setEditable(false);
    outputTextArea.setBackground(Color.lightGray);
    outputTextArea.setBorder(new LineBorder(Color.black));
    outputTextArea.setForeground(Color.black);
    scrollPane =
        new JScrollPane(
            outputTextArea,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    mainPanel.add(scrollPane, mainPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 7;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(15, 5, 15, 5);
    JLabel refLabel =
        new JLabel(
            "Developed in concert with Dr. Lin-Ching Chang D.Sc.,  Dr. Carlo Pierpaoli MD Ph.D.,  and Lindsay Walker MS from the NIH/NICHD/LIMB/STBB group");
    refLabel.setFont(serif12B);
    mainPanel.add(refLabel, mainPanelConstraints);

    JPanel OKCancelPanel = new JPanel();
    buildOKButton();
    OKButton.setActionCommand("ok");
    OKButton.setFont(serif12B);
    OKCancelPanel.add(OKButton);
    buildCancelButton();
    cancelButton.setActionCommand("cancel");
    cancelButton.setFont(serif12B);
    OKCancelPanel.add(cancelButton);
    buildHelpButton();
    helpButton.setActionCommand("help");
    helpButton.setFont(serif12B);
    OKCancelPanel.add(helpButton);

    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(OKCancelPanel, BorderLayout.SOUTH);

    pack();
    setResizable(false);
    setVisible(true);
  }
  /** Constructor. */
  public JDialogEditUserDefinedFileTypes() {

    setTitle("Edit User Defined Filter");

    // get the user defined file types preferences
    if (Preferences.getProperty(Preferences.PREF_USER_FILETYPES) != null) {
      if (!Preferences.getProperty(Preferences.PREF_USER_FILETYPES).trim().equals("")) {
        preferencesFileTypes = Preferences.getProperty(Preferences.PREF_USER_FILETYPES).split("; ");
      }
    }

    displayPanel = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    displayPanel.setLayout(gbl);

    int x = 0;
    int y = 0;
    Iterator<String> iter = fileExtensionsTS.iterator();
    while (iter.hasNext()) {
      String extensionLabel = (String) "*" + iter.next();
      JCheckBox checkBox = new JCheckBox(extensionLabel);
      checkBoxArrList.add(checkBox);
      checkboxNames.add(extensionLabel);
      if (checkPreference(extensionLabel)) {
        checkBox.setSelected(true);
      }
      renderCheckBox(checkBox, gbl, gbc, x, y);
      if (x < 4) {
        x++;
      } else {
        x = 0;
        y++;
      }
    }

    gbc.gridx = 0;
    gbc.gridy = ++y;
    gbc.gridwidth = 5;
    gbc.insets = new Insets(10, 5, 10, 5);
    JLabel label1 =
        new JLabel("Enter additional file extensions below. ( format: *.abc;*.def;*.ghi )");
    gbl.setConstraints(label1, gbc);
    displayPanel.add(label1);

    gbc.gridx = 0;
    gbc.gridy = ++y;
    gbc.gridwidth = 5;
    gbc.insets = new Insets(10, 5, 10, 5);
    userInput = new JTextField(30);

    if (Preferences.getProperty(Preferences.PREF_USER_FILETYPES_TEXTFIELDS) != null) {
      userInput.setText(Preferences.getProperty(Preferences.PREF_USER_FILETYPES_TEXTFIELDS));
    }
    gbl.setConstraints(userInput, gbc);
    displayPanel.add(userInput);

    applyClosePanel = new JPanel();
    buildOKButton();
    OKButton.setText("Apply");
    applyClosePanel.add(OKButton, BorderLayout.WEST);
    buildCancelButton();
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand("close");
    applyClosePanel.add(cancelButton, BorderLayout.CENTER);

    this.getContentPane().add(displayPanel, BorderLayout.CENTER);
    this.getContentPane().add(applyClosePanel, BorderLayout.SOUTH);

    pack();
    this.setResizable(false);
    setVisible(true);
  }
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() { // GEN-BEGIN:initComponents
    java.awt.GridBagConstraints gridBagConstraints;

    RaceButtonContainer = new javax.swing.JScrollPane();
    RaceButtonBak = new javax.swing.JPanel();
    RaceButtonList = new javax.swing.JPanel();
    RecommendedButton = new javax.swing.JButton();
    OKButton = new javax.swing.JButton();
    CancelButton = new javax.swing.JButton();
    DescriptionContainer = new javax.swing.JScrollPane();
    DescriptionText = new javax.swing.JTextArea();
    PadPanel = new javax.swing.JPanel();
    PadPanel2 = new javax.swing.JPanel();
    PadPanel3 = new javax.swing.JPanel();
    PadPanel4 = new javax.swing.JPanel();
    jPanel16 = new javax.swing.JPanel();
    jPanel17 = new javax.swing.JPanel();

    getContentPane().setLayout(new java.awt.GridBagLayout());

    setTitle("Choose a Race for your character.");
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
          }
        });

    RaceButtonContainer.setHorizontalScrollBarPolicy(
        javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    RaceButtonContainer.setVerticalScrollBarPolicy(
        javax.swing.JScrollPane
            .VERTICAL_SCROLLBAR_ALWAYS); // was that weird green color on the menus
    RaceButtonContainer.setViewportBorder(
        new javax.swing.border.MatteBorder(
            new java.awt.Insets(10, 10, 10, 10), new java.awt.Color(0, 0, 0)));
    RaceButtonContainer.setMaximumSize(new java.awt.Dimension(32767, 300));
    RaceButtonContainer.setPreferredSize(new java.awt.Dimension(283, 300));
    RaceButtonContainer.setAutoscrolls(true);
    RaceButtonContainer.getVerticalScrollBar().setUnitIncrement(52);
    RaceButtonContainer.getVerticalScrollBar().setBlockIncrement(52);

    RaceButtonBak.setLayout(new java.awt.GridBagLayout());
    RaceButtonBak.setBackground(new java.awt.Color(0, 0, 0));
    RaceButtonBak.setForeground(new java.awt.Color(255, 255, 255)); // color not seen
    RaceButtonBak.setAlignmentX(0.0F);
    RaceButtonBak.setAlignmentY(0.0F);
    RaceButtonBak.setAutoscrolls(true);

    RaceButtonList.setLayout(new java.awt.GridLayout(0, 1));
    RaceButtonList.setBackground(new java.awt.Color(0, 0, 0)); // outline behind buttons
    RaceButtonList.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(3, 3, 3, 3)));

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    RaceButtonBak.add(RaceButtonList, gridBagConstraints);

    RaceButtonContainer.setViewportView(RaceButtonBak);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(RaceButtonContainer, gridBagConstraints);

    RecommendedButton.setText("Recommended");
    RecommendedButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            RecommendedButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 8;
    getContentPane().add(RecommendedButton, gridBagConstraints);

    OKButton.setText("OK");
    OKButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 8;
    getContentPane().add(OKButton, gridBagConstraints);

    CancelButton.setText("Cancel");
    CancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 8;
    getContentPane().add(CancelButton, gridBagConstraints);

    DescriptionContainer.setHorizontalScrollBarPolicy(
        javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    DescriptionContainer.setVerticalScrollBarPolicy(
        javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // behind text description
    DescriptionContainer.setViewportBorder(
        new javax.swing.border.MatteBorder(
            new java.awt.Insets(10, 10, 10, 10), new java.awt.Color(0, 0, 0)));
    DescriptionContainer.setPreferredSize(new java.awt.Dimension(400, 300));
    DescriptionText.setBackground(new java.awt.Color(0, 0, 0));
    DescriptionText.setForeground(new java.awt.Color(240, 216, 130)); // text for description
    DescriptionText.setLineWrap(true);
    DescriptionText.setWrapStyleWord(true);
    DescriptionText.setPreferredSize(new java.awt.Dimension(400, 800));
    DescriptionText.setAutoscrolls(false);
    DescriptionContainer.setViewportView(DescriptionText);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(DescriptionContainer, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(PadPanel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(PadPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(PadPanel3, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(PadPanel4, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(jPanel16, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(jPanel17, gridBagConstraints);

    pack();
  } // GEN-END:initComponents