0 Replies Latest reply on Oct 8, 2009 8:49 PM by 807575

    passing value from JDialog screen to calling...HELP

      Ok I am kinda new to Java. I have minimal experience with Java and Netbeans. I am trying to capture some input results and pass them back to the calling program when I hit OK on the screen. I am not sure what to do. I got a lot of parts for my bigger program but I am not sure how to put it all together since they are not interacting as I expect them to. The part I am talking about is a critical part to the function of the rest.

      Thank you for all of the help

      Here is teh code that I have for the JDialog component.
      import java.awt.Color;
      public class IPAddressAdd extends javax.swing.JDialog {
          String ipport = null;
          public static final int RET_CANCEL = 0;
          public static final int RET_OK = 1;
          public IPAddressAdd(java.awt.Frame parent, boolean modal) {
              super(parent, modal);
          public int getReturnStatus() {
              return returnStatus;
             private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {                                         
              String id1 = new String(jTextField1.getText());
              String port1 = new String(jTextField2.getText());
              String blank = "";
              if (id1.equals(blank)){
                  jLabel3.setText("Error: IP Address Need to be Entered");
                  System.out.println("IP address needs to be entered.");
                  return ;
              if (jRadioButton1.isSelected() == true){
                  ipport = id1+"/"+port1;
                  ipport = id1+" "+port1;
          private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             
          private void closeDialog(java.awt.event.WindowEvent evt) {                             
          private void doClose(int retStatus) {
              returnStatus = retStatus;
          public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      IPAddressAdd dialog = new IPAddressAdd(new javax.swing.JFrame(), true);
                      dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                          public void windowClosing(java.awt.event.WindowEvent e) {
          private javax.swing.ButtonGroup buttonGroup1;
          private javax.swing.JButton cancelButton;
          private javax.swing.JLabel jLabel1;
          private javax.swing.JLabel jLabel2;
          private javax.swing.JLabel jLabel3;
          private javax.swing.JRadioButton jRadioButton1;
          private javax.swing.JRadioButton jRadioButton2;
          private javax.swing.JTextField jTextField1;
          private javax.swing.JTextField jTextField2;
          private javax.swing.JButton okButton;
          private String pgm2Run;
          private int returnStatus = RET_CANCEL;