Perry Smith

Java Questions & Answers

Home / Java Q & A Page 2 / Java Q & A Archive Main Page

Dialog Box
 Thursday, 22-Oct-98 12:18:08

      202.141.24.2 writes:

      I have got a frame from which I create a Dialog box.I have some textfields in the Dialog box into which I enter some
      values.
      How do I get those values entered into the textfields inside the Dialog box
      Thank you
      vidya shankar

      Vidya Shankar

Responses
 Re: Dialog Box
 Sunday, 25-Oct-98 18:09:54

      152.175.197.37 writes:

      What is the problem? If you have a textArea then all you do is click and type....

      MikeD


Re: Dialog Box
 Wednesday, 28-Oct-98 19:28:37

      199.228.142.5 writes:

      If you are trying to capture those textfield values for use in the main application frame (I think this is what you are
      doing...pls clarify q if not) all you need to do is call the getText() method on your textbox from inside the dialog box,
      probably when user performs a specific action like presses a button, or any exits the frame, etc. Remember that if you
      want to capture events from inside the dialog box you need to add an event listener to a component, like a button or
      textbox, or the dialog box itself, depending upon what you are doing) and then the values will be available to you for
      any method calls etc. See example below, where the ActionListener is added to the dialog box.:

      public class myDialog extends Dialog implements ActionListener
      {
      ... (more stuff goes here)

      public void actionPerformed(ActionEvent ae)
      {
      ...
      info = myText.getText();
      ...
      }

      ew

Home / Java Q & A Page 2 / Java Q & A Archive Main Page