JOptionPane input question

Hi everybody,
I have JOptionPane input dialog in a program to input file names, and I have a lot of text files to input, over 20. They all come from the same folder, the only difference is their names. Does anyone know, is there a way to have the JOptionPane show the last thing I inputted when it comes up again, so I don't have to type the whole file name again. For example (this isn't exactly code, but I'm formatting it that way so it's clear):
String fileMined = the result from the JOptionPane input dialog
fileMined is saved and used to create a button
If the user wants more input the JOptionPane comes up again
Show the previous fileMined, but let the user change part of it
Save the new string as fileMinedJust to make sure I'm clear, it would be something like:
Type in C:\Text.txt in JOptionPane
Next time JOptionPane comes up, C:\Text.txt is in the input field, and we can just delete "Text" and replace it with whatever other file name we need
If anyone can tell me how to do this, I'd be very grateful!
Thanks,
Jezzica85
Message was edited by:
jezzica85

Thank you Michael, I didn't know there was something with that few parameters. My code still isn't working to put the previous string in the input box, I have a feeling I'm doing something small and silly. So far, I have:
Object inputString = new String( "" );
             fileMined = JOptionPane.showInputDialog( "Input File", ( String )inputString );
             if( ( fileMined != null ) && ( fileMined != "" ) ) {
                  inputString = fileMined;
             }So once again, I guess, can you tell what I'm doing wrong?
Thanks again,
Jezzica85

Similar Messages

  • Mandatory User input question

    Hello,
    I am trying to write a script that I can use to list out all permissions in a SharePoint site (site).
    I had a mandatory parameter set : [string]$SiteCollection
    Where the user would need to type the site collection and then my command would use that input to find the permisssions for the site collection.
    For my test I used our site collection called service.  It never ran.  After checking the variable $SiteCollection it took the name I typed in 'service' and actually ran the command, thus the variable $SiteCollection was filled with a list of all
    the current services on the machine.
    2 questions
    1) How can I set the input of the mandatory variable to be literally what I type in, not running an alias such as 'service'
    2) I though this might be better if I gave the user a list of site collections to pick from, thus they would not need to know the correct spelling.  Is there a way to list out all the sites (Get-SPSite) in a list with a number next to them and the user
    could then select the number that corresponds with the correct site collection as their input?
    Thanks for you help

    Hi Robert,
    I‘m writing to check if the suggestions were helpful, if you have any questions, please feel free to let me know.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Built-in Input question

    I know this might sound like I'm new to iMac, but I am so I'm sorry for such a lame silly question.
    I have a 27" iMac I use at work and I have an iPhone. I plug in my iPhone to my iMac input on the back of the computer to listen to music from my iPhone.
    Oddly, I see the Input Level indicator showing sound input but I cant get it to actually play on the internal speakers on my iMac.
    OUTPUT SETTING is set to Internal Speakers
    INPUT SETTING is set to Line In
    ...and nothing...

    Mac OS X does not automatically play audio directly from the line input to the speakers. Try the free app LineIn:
    http://www.rogueamoeba.com/freebies/
    Regards.

  • Classes and subclasses given as String input - question

    Hello, I am new in Java so please don't laugh at my question!!
    I have a method as the following and I am trying to store objects of the type Turtle in a vector. However the objects can also be of Turtle subclasses: ContinuousTurtle, WrappingTurtle and ReflectingTurtle. The exact class is determined by the String cls which is input by the user.
    My question is, how can I use cls in a form that I don't have to use if-else statements for all 4 cases? (Imagine if I had 30 subclasses).
    I have tried these two and similar methods so far but they return an error and Eclipse is not of much help in this case.
    Simplified methods:
    //pre:  cls matches exactly the name of a valid Turtle class/subclass
    //post: returns vector with a new turtle of type cls added to the end
    private Vector<Turtle> newturtle(Vector<Turtle> storage, String cls){
         Turtle t = new cls(...);
         storage.add(t);
         etc.
    private Vector<Turtle> newturtle(Vector<Turtle> storage, String cls){
         Turtle t = new Turtle<cls>(...);
         storage.add(t);
         etc.
    }Thanks for your help.
    p.s.: I didn't know whether to post this question here or under Generics.

    a Factory is atually very simple (100x simpler than reflection).
    example:
    class TurtleFactory
      public Turtle makeTurtle(String typeOfTurtle)
        if (typeOfTurtle.equals("lazy") { return new LazyTurtle(); }
        else if (typeOfTurtle.equals("fast") { return new FastTurtle(); }
        <etc>
    }While at first this doesn't look any better than your original problem, what we've done is made a class that is responsible for all the types of turtles. This will also benefit in case some turtles need initialization or need something passed to their constructor. You encapsulate all that knowledge in one place so you rcode doesn't become littered with it else ladders.

  • JOptionPane Closing Question

    I am trying to close a dialog window when a boolean variable in another class changes to false. I use JOptionPane inside of an instance of Dialog. I have tried using hide(), dispose(), and setVisible(false). The problem is that the dialog window does not know to check the variable. Do I need to add some kind of event listener or what? I know this isn't compilable but I think this is a simple question, I must just be overlooking something...
          Object[] options = {"Stop"};         
             JOptionPane optionPane = new JOptionPane("Playing...",          
                  JOptionPane.OK_OPTION,
               JOptionPane.INFORMATION_MESSAGE,
               dialogIcon,     //don't use a custom Icon
               options,  //the titles of buttons
               options[0]); //default button title
             Dialog playingDialog = optionPane.createDialog(frame, "Status");
             playingDialog.setVisible(true);
             //here is what needs to happen when the orhb class sets getPlayState to false
             if(!orhb.getPlayState()){
               System.out.println("done playing, close window");
               setVisible(false);
             }

    Here is the code that provoked my answer, above:Yea, I thought the same thing at first but then I when I re-read it, I realized that the OP was saying this code:
    //here is what needs to happen when the orhb
    class sets getPlayState to false
    if(!orhb.getPlayState()){
    System.out.println("done playing, close window");
    setVisible(false); is not being called and the question was where to put it. (Of course once he determines where to put that code he will have to call it on the appropriate object)

  • Data Input Question

    Hi!
    I'm trying to input numbers from the console using "System.in". However, the numbers are never read right. I want to read one number per line. Let the code do the explaining as my explanations are usually not clear...
    DataInput = new DataInputStream(System.in);
    int Number = DataInput.readInt();What did I do wrong? Does "DataInputStream" only read binary data?

    The question isn't about Java Native Interface programming so this isn't the right forum. Try the generic Java Programming forum instead.
    But to answer it anyway, you are correct that java.io.DataInputStream.readInt treats the input as binary rather than as user-typed digit characters. See the docs for java.io.DataInput.readInt for details.
    (Also suggest not naming local variables with an initial capital letter like DataInput or Number. It's confusing for an experienced Java programmer to read and can collide with class names.)
    -slj-

  • File input question

    I'm new to java and I'm trying to write a program using file input/output.
    The user is asked for the names of an input file and an output file.
    My question is that in case I don't specify the path of the input file, where should it reside?
    thanks,

    My question is that in case I don't specify the path
    of the input file, where should it reside? In the present working directory. Which is not reliably known at runtime. If the input file will remain unchanged, you can put it into your JAR (if you create one) or somewhere else in your classpath, like the package root, and use getClass().getResourceAsStream("/thefile.ext") to load it. That will always work.

  • Batch input questions

    Hi. Can someone explain me teh diferences between =mod and =ins in a batch input? i know that one is for modify and the other one id for insert, but my question is if i use the =ins code and if there is allready a registry with data in the fields that im going to insert does the =ins code , deletes the old ones and replaces by the new ones??
    Thk
    Regards

    Hi,
    You are talking about the OK Codes in Batch input.
    These OK codes are accompanied by the respective fields followed by this OK codes(function Codes for the user actions on screen).
    Sp sap takes care of them automatically, when you write field and after that OK code for that field.
    regards,
    ANJI

  • Audio input question

    Hello,
    Day three of imac here. I have this cd recorder (stand alone home stereo style) which records cd's that NOTHING else will read. Not even my beloved new imac. My question is , if I plug this recorder into the input will I be able to rip these cds into either itunes or garage band?
    I figured I would throw this to all of you before I go plugging things in all willie nillie.
    Thanks,
    Carl

    Welcome to the Apple Discussions.
    You will need a software program that can record the incoming audio stream from your input port. Audio Hijack or Audio Hijack Pro should fit the bill.

  • Sound Blaster Z Digital Input Question

    Hi,
    Problem: PS4 connects via HDMI cable to my speaker-less monitor, cannot connect the PS4 to my stereo system since there is no separate analogue connector to use (there was on the PS3 but not on the PS4) and my stereo does not have a Digital Input connector (it's old).
    Solution?: If I get hold of a Sound Blaster Z, can I connect the Digital Output from the PS4 into the Digital Input on the SBZ and therefore output my PS4 sound through my PC?
    This is a relatively cheap solution for me so I would really appreciate it if you guys could give me a heads up on whether this is possible. Apologies if this is a straightforward/dumb question. I want to doublecheck before dropping the cash.
    Thanks for reading,
    -Yosh

    Originally Posted by Yosharian
    Hi,
    Problem: PS4 connects via HDMI cable to my speaker-less monitor, cannot connect the PS4 to my stereo system since there is no separate analogue connector to use (there was on the PS3 but not on the PS4) and my stereo does not have a Digital Input connector (it's old).
    Solution?: If I get hold of a Sound Blaster Z, can I connect the Digital Output from the PS4 into the Digital Input on the SBZ and therefore output my PS4 sound through my PC?
    This is a relatively cheap solution for me so I would really appreciate it if you guys could give me a heads up on whether this is possible. Apologies if this is a straightforward/dumb question. I want to doublecheck before dropping the cash.
    Thanks for reading,
    -Yosh
    Hi Yosharian,
    Do you want to consider getting the Recon3D USB instead? The price is almost the same as the Sound Blaster Z and it can function alone without the computer. You may be able to save on your electricity bills using the Recon3D USB instead.
    Here is an illustration of the Recon3D Omega Wireless connecting to the PS4 using SPDIF input. The Recon3D Omega Wireless is actually the Recon3D USB with a Tactic Link card connected to it and a wireless headset.

  • Very Quick PF Input Question

    Hello.
    A quick question if I may. I am in diffs.
    What are/When to use the PF inputs?
    With regard to triggering data aquistiions, will wiring a +5V input to pfi0 work as a trigger?
    Thanks.

    Hello Brian. Thanks for the reply.
    I am using a 6071 card.
    PFI 0/AI START
    PFI 1/REF TRIG
    Perhaps I should be using the PFI 1 port?
    http://www.ni.com/pdf/products/us/4daqsc199-201_ETC_212-213.pdf
    Here is the link for the pdf of 6071
    Best Regards
    Thomas

  • Get Input Question

    Hi,
    Does anyone have any idea how many characters can be retrieved from the ME after a get input command? In the documentation it says that it can be somewhere between 0 and FF charcaters, but it seems I cannot receive more than 160 charcaters. So, what's the limit anyway and is it possible to retrieve something like 300 charcaters at once, does anybody know?
    Thanks,
    Adrian.

    if (JOptionPane.YES_OPTION)
    Why you want to add action listener here
    Do what you want to do on Yes Option
    if you want to close the dialog use, dialog.dispose();

  • JOptionPane Input Message

    I want a customize input message dialog, But i dont want the user to edit the input dialog box.
    I just want to display a text in JTextArea or something, but all the text is read only. Is it possible through JOptionPane.showInputMessage()

    Only use showInputMessage() when requiring input - in this case use
    javax.swing.JOptionPane.showMessageDialog();This will accept you components as the message Object...
    :)

  • Text Input question.

    Hi, i'm having problems with the text input feature, i'd created a comment field but when typing it go only in one line.
    I would like to know if theres any way to make alow typing in more than one line in the same text field.
    Sorry for my english, thanks.

    Tanya Heins wrote:
    I tried out the following which resulted in an editable multi-line text field (after changing code in Flash Builder)
    Created a text input in Fc and resized it to allow for multi-line display
    Imported the Fc .fxp file into Fb and changed the following line of code (in src/Main.mxml) from:
    <s:TextInput height="244" text="my text field." width="431" x="191" y="173"/>
    to
    <s:TextArea height="244" text="my text field." width="431" x="191" y="173"/>
    If you now run your application from Fb, it will result in an editable multi-line text field.
    Be sure to do this after you've finished layout and design of your interface in Flash Catalyst. Once you move over to Flash Builder, that's where you will be completing your application.
    Hope this helps.
    Tanya
    I tried rezolving the problem this way but when I type in something and press enter, the text dissapears by going up, which means out of the text input field. I'm looking forward to find a solution for this problem.
    Thank you!

  • Line input question

    I would like to be able to use my desktop speakers to listen to a satelitte radio receiver using the Mac Pro's line input and volume controls but I can not find a way to nake this audio "pass through" from the line input to the line output.
    I know that there is analog audio present at the mini plug I am feeding the line input with because I can select it as my recording source in other applications (garage band, peak, etc.). Obviously, I would prefer not to have to run one of those applications to monitor the audio.
    Any suggestions are appreciated.
    Mac Pro   Mac OS X (10.4.7)   Macbook Pro

    Thanks for your input, but I was hoping to find a solution that did not involve more hardware. I would really be quiet happy if the audio was just able to pass thru.
    Mac Pro Mac OS X (10.4.7) Macbook Pro

Maybe you are looking for

  • Problem restoring Leopard system from Time Machine OS 10.4.7 disk

    My Imac is currently running leopard 10.5.8, but my install disks are 10.4.7.  I am trying to restore to a backup on my time machine from 4 days ago (prior to a storm that seems to have corrupted my network system, erasing all information of a wirele

  • "Cannot draw document with negative rows to credit note"

    Hi Experts, A General query : I create an AR invoice with two items one with qty 1 and the other with qty (-ve 1)  on posting this invoice the second item / row with negative qty gets closed automatically. Now, I require to post a AR Credit note to t

  • Guetting trouble with install Jdeveloper 10.1.3

    I've just downloaded jdevstudio1013 and unzipped on Windows 2000. Launching Jdeveloper throws an error : Error occurred during initialization of VM java/lang/NoClassDefFoundError : java/lang/Object Any help ? Regards.

  • Buying new iMac - Advices

    Hello, in a few days I'll buy a new iMac, I'm already a holder of an old 2010 iMac 21,5. I thought to remain on a 21,5 because for how expensive it can be, it is less than a 27, even if in this one there is the possibility to add RAM in future, would

  • Desktop uploader urgent problems

    am io wrong or is the adobe cc desktop app allow you to upload files from your desktop?? i just had a very very frustrating conversation with an adobe rep over chat, are these people seriously considered professionals???... https://sales.liveperson.n