Dialog box  user input in AWT

Hey,
I need help implementing a dialog box for user input. I looked at the entry for dialog box on SUN website but i dont have a frame or any of the other components required to use the constructor. I am using an Applet.
Thank you in advance.

The first thing I saw on your code, I've not even looked through it yet, was you are using == to compare Strings... this will almost never work, and will definitely not work for how you are using it. Objects, like Strings, have methods for comparing, in the case you want it's myString.equals(otherString);
You have several options on getting the data from your second window, the easiest is probably just to make a public getter. Since your Window #1 has visibility to your second window, you can use the getter freely.
on the Window #1 side:
myPieceOfData = mySecondObjectRef.getMyDataValue();and on the Window #2 side:
public myDataType getMyDataValue(){
  return theReauestedData;
}Congratulations on getting going on Java. One thing about college, they usually do not care what language you are using, they are teaching concepts not tools--they usually leave the tool learning up to you.
Best of luck in your classes.

Similar Messages

  • Display dialog, await user input how to get no timeout?

    I have a script i run on login, it brings up a dialog that requests user input, how can I stop it timing out if nothing happens?

    Sorry long delay to get back to my question that I asked,
    Still having issues, original I used the timeout action, and that keeps the script working.... However it still times out and then when I use the
    giving up after 150
    I've not tested it to see if it prevents an early timeout, but clicking a the dialog and my script, just stops working there and does nothing else.
    --These files need to change on boot.
    --:Applications:Adobe Photoshop CS6:Presets:Scripts:SAVEAS.jsx
    --:Applications:Adobe Photoshop CS6:Presets:Scripts:SaveOnly.jsx
    --:Volumes:StudioC:Users:StudioC:Workflow:Folder Actions:0_HeliconHotFolder.scpt
    set CS6Applications to ((path to applications folder as text) & "Adobe Photoshop CS6:Presets:Scripts")
    set HeliconLabeler to ((path to home folder as text) & "Workflow:Folder Actions")
    set HeliconAbdul to ((path to me as text) & "Contents:Resources:Scripts:abdul:0_HeliconHotFolder.scpt")
    set HeliconMatt to ((path to me as text) & "Contents:Resources:Scripts:matt:0_HeliconHotFolder.scpt")
    set HeliconShah to ((path to me as text) & "Contents:Resources:Scripts:shah:0_HeliconHotFolder.scpt")
    set PS6SaveAsAbdul to ((path to me as text) & "Contents:Resources:Scripts:abdul:SAVEAS.jsx")
    set PS6SaveOnlyAbdul to ((path to me as text) & "Contents:Resources:Scripts:abdul:SaveOnly.jsx")
    set PS6SaveAsMatt to ((path to me as text) & "Contents:Resources:Scripts:matt:SAVEAS.jsx")
    set PS6SaveOnlyMatt to ((path to me as text) & "Contents:Resources:Scripts:matt:SaveOnly.jsx")
    set PS6SaveAsShah to ((path to me as text) & "Contents:Resources:Scripts:shah:SAVEAS.jsx")
    set PS6SaveOnlyShah to ((path to me as text) & "Contents:Resources:Scripts:shah:SaveOnly.jsx")
    tell application "System Events"
              if name of current user is equal to "StudioA" then ¬
                        set MacName to "true"
              if name of current user is not equal to "StudioA" then ¬
                        set MacName to "false"
    end tell
    with timeout of (60 * 61) seconds
              display dialog "Who is using the Computer?" buttons {"Abdul", "Matt", "Shah"} with icon caution
              if result = {button returned:"Abdul"} then
                        if MacName = "true" then
                                  tell application "Finder"
      duplicate file PS6SaveAsAbdul to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyAbdul to folder CS6Applications with replacing
                                  end tell
                        else if MacName = "false" then
                                  tell application "Finder"
      duplicate file HeliconAbdul to folder HeliconLabeler with replacing
      duplicate file PS6SaveAsAbdul to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyAbdul to folder CS6Applications with replacing
                                  end tell
                                  display alert "Turn Camera on"
                                  delay 1
                                  tell application id "breezesys.com.dslrremotepro" to activate
                                  menu_click({"DSLRRemotePro", "Camera", "Set date/time and owner string..."})
                                  delay 1
                                  tell application "System Events"
      keystroke "a" using command down
                                            delay 1.5
                                            keystroke "Shot_By_Abdul"
                                            delay 1.5
      keystroke return
                                  end tell
                        end if
              else if result = {button returned:"Matt"} then
                        if MacName = "true" then
                                  tell application "Finder"
      duplicate file PS6SaveAsMatt to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyMatt to folder CS6Applications with replacing
                                  end tell
                        else if MacName = "false" then
                                  tell application "Finder"
      duplicate file HeliconMatt to folder HeliconLabeler with replacing
      duplicate file PS6SaveAsMatt to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyMatt to folder CS6Applications with replacing
                                  end tell
                                  display alert "Turn Camera on"
                                  delay 1
                                  tell application id "breezesys.com.dslrremotepro" to activate
                                  menu_click({"DSLRRemotePro", "Camera", "Set date/time and owner string..."})
                                  delay 1
                                  tell application "System Events"
      keystroke "a" using command down
                                            delay 1.5
                                            keystroke "Shot_By_Matt
                                            delay 1.5
      keystroke return
                                  end tell
                        end if
              else if result = {button returned:"Shah"} then
                        if MacName = "true" then
                                  tell application "Finder"
      duplicate file PS6SaveAsShah to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyShah to folder CS6Applications with replacing
                                  end tell
                        else if MacName = "false" then
                                  tell application "Finder"
      duplicate file HeliconShah to folder HeliconLabeler with replacing
      duplicate file PS6SaveAsShah to folder CS6Applications with replacing
      duplicate file PS6SaveOnlyShah to folder CS6Applications with replacing
                                  end tell
                                  display alert "Turn Camera on"
                                  delay 1
                                  tell application id "breezesys.com.dslrremotepro" to activate
                                  menu_click({"DSLRRemotePro", "Camera", "Set date/time and owner string..."})
                                  delay 1
                                  tell application "System Events"
      keystroke "a" using command down
                                            delay 1.5
                                            keystroke "Shot_By_Shah"
                                            delay 1.5
      keystroke return
                                  end tell
                        end if
              end if
    end timeout
    --handlers
    on menu_click(mList)
              local appName, topMenu, r
      -- Validate our input
              if mList's length < 3 then error "Menu list is not long enough"
      -- Set these variables for clarity and brevity later on
              set {appName, topMenu} to (items 1 through 2 of mList)
              set r to (items 3 through (mList's length) of mList)
      -- This overly-long line calls the menu_recurse function with
      -- two arguments: r, and a reference to the top-level menu
              tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
                        (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
    end menu_click
    on menu_click_recurse(mList, parentObject)
              local f, r
      -- `f` = first item, `r` = rest of items
              set f to item 1 of mList
              if mList's length > 1 then set r to (items 2 through (mList's length) of mList)
      -- either actually click the menu item, or recurse again
              tell application "System Events"
                        if mList's length is 1 then
      click parentObject's menu item f
                        else
                                  my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
                        end if
              end tell
    end menu_click_recurse

  • Hex input using user dialog box.

    Hello
    I am trying to use the user dialog box to input data. I want to input the data as Hex. format. however as I select the input to be a number, it takes as a decimal number and there seems to be no option where I can change it to a hex format. Any suggesstions as how to make this possible..
    Thanks in advance.

    You made me look.    I had to try this on dialog controls for myself.
    Place your control and then right click on it and select a representation that works with Hex formats (say I32 or U32).
    Then right click on it again and select Format and Precision...
    Now you should be able to select Hexadecimal format.

  • Java Dialog Box

    How would you make a Data Input Dialog using Java? I am fairly new to Java and im used to programming with C# but for my school syllabus I have to use Java to make database... So how can I make an input dialog box to input like a set of data. I know how to use JOptionPane to input data one by one but how do I input a set of data using a dialog box?
    thx

    depends on how fancy you want to make it.
    you can still use a joptionpane for your 'multiple' input:
    (note: error handling seriously lacking)
    import javax.swing.*;
    import java.awt.*;
    class Testing
      public static void main(String[] args)
        JLabel nameLbl = new JLabel("Name:");
        JLabel addressLbl = new JLabel("Address:");
        JTextField nameTF = new JTextField(5);
        JTextField address1TF = new JTextField(5);
        JTextField address2TF = new JTextField(5);
        JPanel p = new JPanel(new GridLayout(3,2));
        p.add(nameLbl);p.add(nameTF);
        p.add(addressLbl);p.add(address1TF);
        p.add(new JLabel());p.add(address2TF);
        JOptionPane.showMessageDialog(null,p);
        System.out.println("Your name is "+nameTF.getText());
        System.out.println("Your address is:\n"+address1TF.getText()+"\n"+address2TF.getText());
        System.exit(0);
    }

  • Display a  message in dialog box  while creating PO

    Hi Experts,
    i want to dispaly a popup message while creating PO(me21n),pop up should be trigger when we try to save two different plants in the item level while creating PO. for this purpose i have used enchancement mm06e005 and FM EXIT_SAPMM06E_016.
    i want to pass this message to standard message in me21n
    transaction and  should get the message in dialog box
    user should not able to save PO until he corrects the plants in item level.
    please help me
    thanks in advance,
    Rama.

    Hi,
    You have to check 1st this user-exit is triggering or not while saving the P.O.
    If it triggers then you can put the code what you want.  The message type should be Error type why becuase then only it won't allow further until it correct.
    Thanks
    Ganesh

  • Acrobat Batch Plug-in and accessing user input parameters

    I have written a plug-in for acrobat 9 and need to retreive the value stored in the "select output location" field from the default "edit batch sequence" dialog.
    How can I get a handle to the "edit batch sequence" dialog and the dialog's user input fields and their respective values?

    I don't know if this will help you out, but remember that a batch sequence (.sequ) is finally just a plain-text file.
    If you know the name of the batch and the location of the sequences folder, you can probably write a small tool to read it in, parse it and figure out the output folder yourself.
    For example, here's a very basic batch sequence I've created. It just calls a JS method on each file:
    <</Commands [/c <<    /0 [/c <<        /Config [/c <<            /UIPolicy [/i 3]
    >>]
            /HandlerName [/a /JavaScript]
            /Params [/c <<            /ScriptCode [/t (collectFilePaths\(this\);)]
                /ScriptName [/t ()]
    >>]
            /Title [/t (Execute JavaScript)]
    >>]
    >>]
    /Input [/c <<    /FileVariation [/i 1]
        /PreselectedFolderPath [/c <<        /DI [/s (/C/Batch In)]
            /DIText [/t (/C/Batch In)]
            /FS [/a /DOS]
    >>]
        /SourceFileOptions [/c <<        /Formats [/c <<>>]
    >>]
    >>]
    /Output [/c <<    /AddToBaseName [/b false]
        /DontOverwrite [/b false]
        /FileVariation [/i 2]
        /InsertAfterBaseName [/t ()]
        /InsertBeforeBaseName [/t ()]
        /OptimizePDF [/b true]
        /PreselectedFolderPath [/c <<        /DI [/s (/C/Batch Out)]
            /DIText [/t (/C/Batch Out)]
            /FS [/a /DOS]
    >>]
        /PresetName [/t (Standard)]
        /RunPDFOptimizer [/b false]
    >>]
    >>
    The input and output folders ("C:\Batch In" and "C:\Batch Out\") are plainly visible in the code.

  • Dialog Box and VBS Scripting

    Within the dialog box I have a combo box and an Edit box. I would like to take the value I select from the Combo Box and have it used in a calculation and then output to the edit box.

    Hi Croxtonj,
    Please have a look at the DIAdem online help and there in ...Examples->Viewing, Presenting, Automating->User Templates->DIAdem Script->User Dialog Boxes->"User Dialog Box with Selection Lists" or "User Dialog Box with Selection Fields" etc.
    I hope this will help you.
    Greetings
    Walter

  • How to disabled the input parameter dialog box in crystal reports 9

    Post Author: Murtaza
    CA Forum: General
    Hi friends,I have got stuck with a weird problem.  In my
    crystal report, I have set up some input parameters.  I am setting
    values for these parameters somewhere inside code.  But I don't
    want to show the default input parameter dialog box. Under any case,
    user should not see the ugly parameter dialog box that crystal
    presents.   Please suggest me how I can achieve
    this.  I cannot do this through code, because our environment does
    not allow that.  I have to do this in crystal reports viewer and
    by setting some property of the crystal report object. But everything
    must be done on UI, not through code. So, the solution should not be the following. 
    // step before step 1
    // **** the line needs to refer to the report and be set before setting
    ReportSource in the viewer to myReport
    myReport.EnableParameterPrompting = False
    Any help would be greatly appreciated.  Murtaza

    Post Author: sleahcim
    CA Forum: General
    Hi Murtaza,
    Unfortunately, I am not aware of any method to suppress the prompt for the input parameters, but still use them.  It is truly a design-related issue for the report.  The reason that the prompt appears is because the parameter it is prompting for is used in the report; in particular either the Group or Record Selection, or referenced in another formula.
    The only way I can think of to not show the prompt, is to not use the parameter in the report.  You did mention that you are setting the value of the parameter inside of the report -- are you doing this through using a formula?  Perhaps you can just remove the parameter and only use the formula that you are setting the default values with.
    -Michael

  • Retrieve 4 inputs from one dialog box at a time

    I have a Jframe and when I click a button I want it to open a new Jdialog box. I want 4 different input fields. Two will be for strings, 1 int, 1 double. But I can't get it to open up a dialog with all of those things. Will I have to accept them all as strings then convert them to double and int? and what will the code for 4 input fields in a dialog box look like? If you need more info just ask... And I'm using Netbeans, if this makes it easier.

    You could design a custom JDialog or whip up something simpler with JOptionPane:
    import java.awt.*;
    import javax.swing.*;
    public class JOptionPaneExample {
        public static void main(String[] args) {
            JPanel p = new JPanel(new GridLayout(2, 2));
            p.add(new JLabel("name:"));
            p.add(new JTextField(10));
            p.add(new JLabel("age:"));
            p.add(new JTextField(10));
            int result = JOptionPane.showConfirmDialog(null, p, "title",
                JOptionPane.OK_CANCEL_OPTION,
                JOptionPane.PLAIN_MESSAGE);
    }

  • Hide user input in text box

    Is there a way to hide user input in an applescript text box?  I'm using the 'display dialog' command to get the user to type in a password and i would like to display it on screen as "*******" or something.
    Thanks.
    Pedro

    Try display dialog "Password:" default answer "" with hidden answer

  • Is there any way to popup a dialog box when user try to create a new folder?

    Hi
    I want to add a pop up dialog ,using Flex custom UI dialog, when use click "New Folder" in Adobe Bridge ? Then user can input folder name in this dialog.
    Or I want to put this way,  is there any way to display Flex custom UI dialog and get user's input in my CreateDirectoryHandler implementation?
    The Adobe Drive SDK doesn't elaborate clearly about how to interact with custom UI dialog.
    Thanks a lot!

    Hi jmc,
                 See the links below.This will be helpful to you.
                 http://forums.ni.com/t5/LabVIEW/A-picture-as-a-dialog-box/td-p/236851
                 http://forums.ni.com/t5/LabVIEW/Dialogbox-with-user-input-and-image/td-p/1601214
    Thanks as kudos only

  • Trying to create an input dialog box, that will halt execution

    I am trying to get a pop up dialog box to appear where the user will enter their name, after clicking OK or Cancel, i would like the code to continue executing.  For example when i use the Alert.show("1");Alert.show("2");Alert.show("3");  it appears as 3,2,1. Is it possible to fire one alter at a time AFTER the user has clicked Ok.
    Back to the originial question.
    I am setting up a Pop up menu
    var ret:String;
    var Dialog:SimpleTitleWindowExample =SimpleTitleWindowExample(PopUpManager.createPopUp( this, SimpleTitleWindowExample , true));
    ret = Dialog.Input      //where input is just a public text for example
    return ret;
    ^returns null.
    I was hoping it would wait until  it was closed to continue. I thought it would by setting the modal = true
    Essentially I'm asking is there a way to halt execution until the user inputs some text? Doesn't have to utilize the PopUpManager.
    Please help. I've spent 4 hours trying to tackle this.  I even tried to do a DoEvent (Visual Studio) type loop until the button was clicked or variable was no longer blank.

    I think you may alternately be able to listen for the removedFromStage event and react to that. In any case, you need some way of reacting to SampleTitleWindow closing (via an event listener), and only then trigger the next pop-up.

  • Possible alternative to input dialog box

    The program I'm creating would like to utilize the functionality of an input dialog box, however, I would like for the input dialog box to return a group of values instead of just one. As far as I can tell, the input dialog box can return a single String based an a group of values that I supply. However, the program I use would want the user to be able to select several of those values. Is there a way to have the input dialog box return a String[]? Perhaps there is another option that I'm not really aware of that can mimic the input dialog box functionality?

    Hi,
    You might create some complex JComponent (a JPanel containing lots of check boxes and text fields etc). Use that component as a message. Then, when the user clicks the OK button, investigate your complex component for all its values.
    Piet

  • Keyboard input to change the default selection in a dialog box.

    Hello,
    Let say I close a file that I had just edited without saving. I'll then have a dialog box "do you want to save?" with "yes" as default. If I do not want to save my changes, how can I select "no" or "cancel" with the keyboard?
    I'm sure this is an easy one for a long time Mac user.
    Thanks

    As a matter a fact there is. Just hit the first letter of the choice n = no, c=cancel etc. Edit. I tested this in Word for Mac and it worked but other programs don't so the method below is best.
    An alternate method is to tab to the choice and hit enter.
    Cheers
    Message was edited by: captfred

  • How do I ensure user name is shown rather than 'another user' on the 'File in Use' dialog box?

    How can I ensure user names are shown rather than just 'another user' on the 'File in Use' dialog box that appears when attempting to edit a checked out document in Microsoft Word/Excel? 
    All suggestions welcome. 

    If I recall correctly, that dialog is generated by the Office client product supporting that file type. There would be no way to modify it.
    Trevor Seward
    Follow or contact me at...
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

Maybe you are looking for

  • Button Text on Form not Displaying

    The following was posted by PGMR1998 at 09:58am on Feb 22, 2008 (Pacific) but got no response: I am using Adobe Acrobat Pro 8, and I have added a button to reset the form fields. The button has some text on top, but the text on the button does not di

  • Problems with wrt610n and mac mini (MA206LL/A*)

    i purchased a new wrt610n and one of the machines that is connected is a mac mini, 1.66 ghz intel core duo. #ma2066/ll/a for those who want to compare notes. the computer is stock with the 802.11g wireless card  that came with the machine. it is runn

  • BT Home Hub 3 + Back To My Mac / Port Forwarding

    I've recently got BT Infinity and along with it a BT Home Hub 3 which doesn't seem to be playing nicely with Back to my Mac. The setup on the Mac side of things is correct and I can see my remote computer but I just can't connect to them, or vice ver

  • Installed login screen, but can't log in

    I followed the beginners guide which led me to install arch a few times due to my inexperience, but I finally was able to get it to run, I ended up installing a log in screen with kde, but when I rebooted I tried to log in using root, but it didn't w

  • We want a good photo printer, can anyone recommend one

    We are trying to find and decide which is the best photo printer for the Apple Mac Pro, can anyone help?  Also can someone tell me us which photo software is the best on this machine as we have found the general one supplied (iphoto) is not very adva