Small problem with Chooser

I'm new to Java and ever more clueless about Swing but am trying to learn.
I have implemented a chooser to choose a folder. It works but not exactly as I wish. I supply chooser with the last folder that was previously chosen by the user. Chooser displays that folder and other folders in the parent folder. That's OK but I would like the last folder to be "selected" so the user can just accept it and not have to click on it.
Here's my code:
     chooser = new JFileChooser();
     chooser.setCurrentDirectory(new java.io.File(lastFolderXML.getLastFolder())); // last folder accepted
     chooser.setDialogTitle(choosertitle);
     chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
     chooser.setSelectedFile(chooser.getCurrentDirectory());
How do highlight the last folder accepted?
TIA
Nate

Andrew, thanks for taking time to attempt to help me.
1 The CODE tag: I looked very hard at the thread to find a code tag but couldn't and was wondering why there was none.Which I why I stated +"reply and quote to see the markup"+ . Did you not read that part either? >o(
I (...) had no idea that while heading sizes are available on the page the really important code tag is not.Yes, we all hate that, but Oracle doesn't care. That's why we're usually not too harsh on newbies who don't know how to post code, and why the first reply is usually explaining how to do that. We're much less indulgent when newbies disregard this kind advice...
So far this is the only forum that I've found that does it this way. It would have been very helpful to convey the tag or where it was written up.
I didn't (...) notice that the acronym SSCCE, which conveyed no meaning to me, was a link.I think I explained what it was too: +"Could you post an SSCCE (a short but complete example that fits in one class, and that (...)"+
I was about to comment wittily on how one can miss a link, but I have to admit that this forum's rendering is disgraceful and very confusing...
But I found the problem (...) On Ubuntu it works just as I expected. Next time I have a GUI question I'll specify the OS I'm using.Fine.
Note that if you had posted an SSCCE, several of us would have run it and testified whether it "worked" for them. Myself, had I tried it, would have replied "It works for me on WinXP. What's your OS?".
Glad you found it yourself though. Good luck with Java.
Now to see if I can implement a progress bar.Just in case: in your Swing experiments, make sure you read the Swing tutorial (e.g. for progress bars: http://download.oracle.com/javase/tutorial/uiswing/components/progress.html)

Similar Messages

  • I have a small problem with MSI GF4 MX 420

    Hi,
    I have a small problem with MSI G4MX420-T(S+C) ( MS-8878 ). Exactly with nVidia WDM Video Capture (universal), which  " can't be turned on " by Windows XP.
    I have also new drivers ...
    Could someone help me?
    Asus A7V333
    Athlon 1700+
    128 MB RAM
    Thanks !!!

    If you only have 10 seconds of content in a 15-second composition, then you need to either add more content or shorten your composition.
    You can shorten the composition by changing the duration in the composition settings.
    Since you're obviously very new to After Effects, I very strongly recommend that you start here to learn After Effects.

  • Some small problems with my new 3G iPhone

    Having some small problems with my new iPhone, nothing major, just annoying.
    1. When I plug my iPhone in to charge/sync my Adobe photoshop keeps trying to download the photos on my iPhone, which causes an error message from Adobe that it can't download and it stops all syncing and removes my iPhone from iTunes. I have to unplug and reinsert USB cable and sometimes it works ok and sometimes I have to reinsert again. Also when charging, it will disconnect, reconnect and the samething all over again, photoshop trying to get photos and an error message.
    2. Can't send e-mails via 3G? Only can get, have to connected to a WiFi to send e-mails, or is this normal?

    When your iPhone includes photos in the Camera Roll, it is also detected as a digital camera when connected to your computer, and whichever app you have selected to import photos will automatically launch to import the photos. If you haven't imported these photos, it is a good idea to do so as with any other digital camera. I import the photos followed by deleting the photos from the iPhone after the import process is complete. If I want any of the imported photos available on my iPhone for viewing, I add the photos to an existing album that is selected to be transferred to my iPhone under the Photos tab for my iPhone sync preferences, or add the photos to a new album followed by selecting the album under the Photos tab followed by a sync.
    If your iPhone's Camera Roll does not include any photos that have not been imported, Adobe Photoshop should not launch automatically when your iPhone is connected.
    I know how to disable the selected application for photo import from launching automatically regardless with a Mac, but not with Windows.
    Regarding the sending email problem, who is the email account provider and does the email account provider have an authenticated SMTP server?
    Most ISPs block the use of SMTP servers that are outside of their network or not provided by the ISP being used for your internet connection unless the SMTP server is authenticated. When connected to the internet via AT&T's cellular network, it is no different in this regard. AT&T's SMTP server is included and available by default for use with an email account that does not have an authenticated SMTP server when connected to the internet via AT&T's cellular network, but you probably won't be able to use this SMTP server for sending messages with the account when connected to the internet with your ISP via an available wi-fi network - especially if the email account is provided by your ISP.
    I access two email accounts with the iPhone's mail client and both accounts have an authenticated SMTP server. I've never had any problems sending with either account regardless the ISP being used for an available wi-fi network, or when connected via AT&T's cellular network.

  • Smaller problem with handling frame-borders in dreamweaver 8

    Hello people
    I have build a website using a frameset in dreamweaver 8.
    Ewerything works fine, except i cannot drag in my frames when i
    re-open the page. I try to select frames in the "windows" bar, and
    click on the different frames to make the frame-border appear, but
    it does not. Only dotted lines that indicate the selected frame
    appear.
    mabe there is a button somewhare that make the draggeble
    borders come back..
    if anybody knows the anwser to my problem - please write.
    Thanks
    Daniel - Copenhagen

    > I have build a website using a frameset in dreamweaver
    8.
    Why? Are you familiar with all the problems associated with
    choosing frames
    for you layout?
    > except i cannot drag in my frames when i re-open the
    page
    Hmm - I don't understand this. You have created a frameset
    page in which
    you define your frames, right? And you have saved both the
    frame pages, and
    the frameset page, right? So, you next open which page? The
    frameset? Or
    the frame page?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "duranduranduran" <[email protected]> wrote
    in message
    news:glk8uh$noc$[email protected]..
    > Hello people
    >
    > I have build a website using a frameset in dreamweaver
    8. Ewerything works
    > fine, except i cannot drag in my frames when i re-open
    the page. I try to
    > select frames in the "windows" bar, and click on the
    different frames to
    > make
    > the frame-border appear, but it does not. Only dotted
    lines that indicate
    > the
    > selected frame appear.
    > mabe there is a button somewhare that make the draggeble
    borders come
    > back..
    >
    > if anybody knows the anwser to my problem - please
    write.
    >
    > Thanks
    >
    > Daniel - Copenhagen
    >
    >

  • A small problem with my Zen Xtra 60 turned into a bigger problem. Help me save it

    What started as a small problem has grown to a big mess. My Zen xtra 60 GB unit started going to "Rebuilding Library" often. With 5000 Wma's on it, this rebuild was taking 30 minutes. So what I attempted to fix with reloading firmware to recognize the new Windows Media Player version, has left me with a dead unit.
    I have followed many of the solutions, that have been able to fix other peoples units, but to no avail. While my computer sees the unit, none of the firmware loads will see the player. I fixed what was said in the register. Went through the 4 options of the "Rescue Mode" on the player, followed several of the knowledge notes on procedures, including hooking unit up to a new Dell Laptop. Exactly the same problem happens on a different computer.
    I guess my first step is to get the computer to see the MP3 player when I run a firmware install.
    Tell me what to do to save my little player.
    Thanks Scott

    peschli wrote:
    . . . if I don't use [my 30GB Zen Xtra] for day, it re-builds my library and half of the songs are disappeared and also so the "memoryplace" . . .
    I've had a similar experience, but to a degree. I've found that if I don't use my <EM>40GB</EM> Zen Xtra for more than one day the player will "re-build" the library... but in my case once the library has been re-built it plays just fine; none of my songs or memory are lost.
    Why does the player have to "re-build" the library if the player is not used for a period of time?

  • Recursive mergeSort... small problem with infinate recursion.

    Basically, I have made a recursive mergeSort method, but there is a small problem...im getting stuck with an eternal recursion, which is obviously followed up swiftly by a stack flow error, problem is I cant see where im going wrong...
    The error reads, "Exception in thread "main" java.lang.StackOverflowError at part3.mergeSort(part3.java:56)"
    Heres the code... any help is highly appreciated, as I am new to java, and this is for university.
    public class part3
        public static void main(String[] args)
          // Declare array of unsorted values.
          int[] values = {1,3,5,7,9,2,4,6,8,10};
          // Display unsorted values on screen.
          System.out.println("Unsorted Values");
          for(int i= 0;i < values.length; i++)
               System.out.println(values);
    mergeSort(values, values.length);
    output(values);
    public static void mergeSort(int[] vals, int n)
    // Declare necessary values
    int lowCount, highCount;
    int[] low, high;
    int i, j, k;
    if (n > 1)
              low = new int[n];
              high = new int[n];
              for(i=0,j=0,k=0; i < n; i++)
                   if(vals[i] < low.length)
                        low[j] = vals[i];
                        j++;
                   else
                        high[k] = vals[i];
                        k++;
              lowCount = j;
              highCount= k;
              mergeSort(low, lowCount);
              mergeSort(high, highCount);
              for(i = 0; i < lowCount; i++)
                   vals[i] = low[i];
              for(i = 0; i < highCount; i++)
                   vals[i+lowCount] = high[i];
    public static void output(int[] data)
    for(int i = 0; i < data.length; i++)
         System.out.print(data[i] + " ");
              System.out.println();

    yes sorry, that was it, when i put that code in my class... i get an acception in thread main...
    heres the code i now have...
    I know i need to add a main method, but im completely unsure of what I need to put inside the main method, if you get what i mean...
    sorry for all the hassle... :(
    public class part3
         * Mergesort algorithm.
         * @param a an array of Comparable items.
        public static void mergeSort( Comparable [ ] a ) {
            Comparable [ ] tmpArray = new Comparable[ a.length ];
            mergeSort( a, tmpArray, 0, a.length - 1 );
         * Internal method that makes recursive calls.
         * @param a an array of Comparable items.
         * @param tmpArray an array to place the merged result.
         * @param left the left-most index of the subarray.
         * @param right the right-most index of the subarray.
        private static void mergeSort( Comparable [ ] a, Comparable [ ] tmpArray,
                int left, int right ) {
            if( left < right ) {
                int center = ( left + right ) / 2;
                mergeSort( a, tmpArray, left, center );
                mergeSort( a, tmpArray, center + 1, right );
                merge( a, tmpArray, left, center + 1, right );
         * Internal method that merges two sorted halves of a subarray.
         * @param a an array of Comparable items.
         * @param tmpArray an array to place the merged result.
         * @param leftPos the left-most index of the subarray.
         * @param rightPos the index of the start of the second half.
         * @param rightEnd the right-most index of the subarray.
        private static void merge( Comparable [ ] a, Comparable [ ] tmpArray,
                int leftPos, int rightPos, int rightEnd ) {
            int leftEnd = rightPos - 1;
            int tmpPos = leftPos;
            int numElements = rightEnd - leftPos + 1;
            // Main loop
            while( leftPos <= leftEnd && rightPos <= rightEnd )
                if( a[ leftPos ].compareTo( a[ rightPos ] ) <= 0 )
                    tmpArray[ tmpPos++ ] = a[ leftPos++ ];
                else
                    tmpArray[ tmpPos++ ] = a[ rightPos++ ];
            while( leftPos <= leftEnd )    // Copy rest of first half
                tmpArray[ tmpPos++ ] = a[ leftPos++ ];
            while( rightPos <= rightEnd )  // Copy rest of right half
                tmpArray[ tmpPos++ ] = a[ rightPos++ ];
            // Copy tmpArray back
            for( int i = 0; i < numElements; i++, rightEnd-- )
                a[ rightEnd ] = tmpArray[ rightEnd ];
    }

  • Small problem with applescript

    Hello Again,
    Every day I use a morning script to launch my programs I have to use... and some more things...
    Aldo I have a problem with Golive.
    When I try to type activate in the editor it makes a bigg A.
    Also with cut and past.
    and when i run the applescript-program it does all I need ( The golive part is at the end... but when I place it in the middle it's just stops.
    I get this fault message : Can't continue <event Coreactv>
    and i guess it has something to do with the A-ctivate
    Is this a bugg? Or can someone explain this?
    I would like to do more after launching Golive..
    tell application "Extensis Suitcase X1"
    activate
    end tell
    tell application "Mail"
    activate
    end tell
    tell application "Adobe Photoshop CS"
    activate
    end tell
    tell application "QuarkXPress Passport"
    activate
    end tell
    tell application "Adobe GoLive CS"
    Activate
    end tell

    Some apps don't respond well to tell blocks. I don't have that app to test, but you could try using something like launch "TextEdit" or tell app "Finder" to open posix file "/Applications/TextEdit.app" to improve your results. Sometimes an ignoring application responses block can help too.

  • Weird problem with choosing song to play

    Whenever I choose a song by going to Music -> Artists -> <the artist I want> -> Album -> and then a particular song, it always starts playing the FIRST song on the album, not the song I picked. Same thing happens if I try to play a song by going to Music -> Album -> and then song... whatever song I pick, the Nano will play the first song on the album instead. It's not the end of the world, but how annoying! I have "Restored" my Nano in an attempt to fix this, and at first the problem went away. Just today, though, it began doing it again. My Nano sees very little exposure to the elements or anything one would consider "harsh" use; basically goes from my night stand to work with me at the office and then back again. Anyone else had this issue?
    Thanks in advance,
    James
    home made   Windows XP  

    Hi
    I have a similar problem, however i want to play the first song and it wont. instead it will jump to either track 2, 3 or even 4!, i have had previous ipods none of them doing the same.
    Anyone got any ideas for this problem?

  • I am having a small problem. with Media Go??

    I have a program call " Creative MediaSource Go!" but when click on it to open so i can do some setup, nothing happens. Is ee the hour glass then nothing happens. I already updated with creative. please can some one tell me wat i am missing yo get the "Creative MediaSource Go!" to open and run ??

    Having this problem too: IT'S REALLY REALLY ANNOYING!!! Anyone have an idea how to sort this?

  • Small problems with Image Capture

    Hi,
    When I upload images from my camera, I have a few problems.
    When Image Capture automatically opens, there are two different windows, and I never know which one will open. One has choices like Delete and Eject camera. The other window only has choices like Rotate Right and Rotate Left. Is there a way to get the one with more choices to open every time?
    When I eject the camera (either by using the choice from the one window) or by quitting Image Capture and dragging the camera icon in the Trash, I seem to always get a Device Removal warning when I shut off the camera.
    Thanks,
    Allan

    The second problem may be cured by using 'reformat' of the memory card, in the camera.
    There may be some corruption in the flash memory; or it may be failing.
    The first issue, may be relieved if you can find the correct file plists for Image Capture; and
    trash those preferences. If the actual application is somehow damaged, it may be possible
    to re-install just that application through use of Pacifist (charlessoft, download) to extract
    just that item, from the computer's OS X install/restore disc. Without an 'archive & install.'
    Hopefully someone will have exact details from experience; since I've not had similar issues.
    Usually, I'd use a free image editor such as ToyViewer for Mac; and also Preview, to edit.
    Good luck & happy computing!

  • Small problem with generics

    Hi,
    I'd like to get my generic (Hash)Map back from a textfile, for this I have written a method that reads the file and returns an Object. The only problem I have is that I get the error "java uses unchecked or unsafe operations , ..." with the following code:
    Map<Character, TransVal> thisIsMyMap = (HashMap<Character, TransVal>) readFromFile("filename.dat");I thought it would be the same as parsing a String (guess not :-) ):
    String s = (String) justAnObject;TransVal is a class that contains a BitSet and an Integer.
    Any help plz?
    (btw sorry for my english :-s )

    The reason is that it cannot check, at runtime or at compile time whether or not the cast is valid. It will at runtime check the cast to HashMap (btw, use Map for both the cast and the variable), but it will not check that all the keys are Characters and that all the values are TransVals. What will happen is that somewhere where you actually use the map, if the assumption you are making here is incorrect, there will be a ClassCastException in what appears to be perfectly safe code. If you are positive that your cast is safe, either change the return type of readFromFile or put a @SuppressWarnings("unchecked") annotation on the method and use a java compiler that respects it (eclipse, 1.6, and maybe others, but not sun's 1.5 javac).

  • Small problem with the Nano 6G, and run workouts

    Hello! I have sensor Nike IPod Sport Kit, which is in the new Nano 6G is not needed, because the accelerometer (pedometer) is built into the player and is suitable for running. But buying a heart rate monitor transmitter i is upset that it should only be used with the sensor in the shoe. Because when I connect the transmitter Nike to player Nano 6G, and then connected transmitter heart rate monitor and want to start training, the player Nano 6G is looking sensor in the sneaker, although it could well do without him. Request to developers Apple fix this problem so that you can use the transmitter heart rate monitor with built-in accelerometer in the player Nano 6G.
    Sorry for the google-translator. Regards, Alex.

    Alex, exactly what I was looking for...
    I tryed to get info from Apple and Nike support but seems nobody knows what I'm tolking about.
    I hope Apple will fix it on 6th G even if they'll launch the 7th G.
    Max

  • Problem with choose material in a query

    hello
    I have a simple query and when i'm trying to choose a material in the selection screen it doesn't choose it.
    I make a search for a material and then double click on it and nothing is happen.
    Any idea why??
    thanks

    Itay,
    It is unclear to me exactly what is the nature of your problem.
    I will assume that what you are saying is that you have constructed a query in which MATNR is one of the items you have placed on the selection screen, and when you select something from the F4 help, and you execute the query, that you get no results from the execution of your query.
    Assuming that you have defined an output, this means that the way you have constructed your query, no records satisfy the selection criteria.
    If the above describes your problem, then the next step is to examine the infoset.  What kind of infoset are you using?  Direct Read, Join, or LDB?
    Regards,
    DB49

  • Small problem with desktop

    When I chose desktop picture from my pictures folder (by clicking on plus and browsing the picture in desktop preferences) it doesn't show previews in some of the folders - it shows empty icons without pictures. I know it's not a major problem but still irritating. Does anyone know why this can be and how to fix it? (when I open same folders with finder everything is shown normally)

    Make sure you have connect the speaker jack in green color out port which is back on the tower.
    Now perform this steps.
    Step1 Changes audio settings in BIOS
    1. To enter the BIOS, turn on the computer and begin pressing the F10  or F1 key
    repeatedly untila BIOS Setup screenopens.
    2. In the BIOS Setup screen, press the F5 key.
    3. Select yesor OK(press the Enter key).
    4. Press the F10 key. Select yes or OK to save the default settings (press
    the Enter key).
    5. Start the computer and check for sound. If there is still no sound,
    continue with these steps.
    6. Use the Left and Right Arrow keys to select the advanced tab.
    7. Find and select the advanced menu items that correspond to audio. This
    may be one of the following:
    8. Onboard Audio, Onboard Audio Options, I/O Device Configuration, On-board
    Sound, Audio Codec
    9.Select either Enabled or disabled depending on the computer configuration
    and press Enter.
    10. Press Enter to save and exit and check for sound.

  • A small problem with painter when i try to use color selector

    in paint brush there is this color selector that things that takes drops a dropper i think it's called if i choose it and use it on some part of the pictuer i get this color on paint 1 but i can't use it to change color 2 why is that and what can i do about this?
    thanks in advance.

    in paint brush there is this color selector that things that takes drops a dropper i think it's called if i choose it and use it on some part of the pictuer i get this color on paint 1 but i can't use it to change color 2 why is that and what can i do about this?
    thanks in advance.
    Hi
    1. Select the Color Picker (Eye Dropper).
    2. Click Color 1.
    3. Select a color from the Pallette.
    4. Select Color 2.
    5. Select the second color from the Pallette.
    6. Select a Brush from the Brushes drop down.
    7. When you use the left Mouse Button, you will get Color 1.
    8. When you use the Right Mouse Button, you will get Color 2.
    While you are painting, you can select the Color Picker at any time to change either color 1 or 2.
    Windows 7 features - Paint - Microsoft Windows
    Getting started with Paint
    Using Paint
    Hope this helps.
    Thank You for using Windows 7
    Ronnie Vernon MVP

Maybe you are looking for

  • File Receiver - Dynamically create filename from data in payload

    Hi there. Can anyone tell me the approach I need to take to be able to use the data in one field to determine the filename in the file receiver adaptor. I have a requirement that requires that I save a file with the following mask: xxxx_xxx<b><date e

  • Sending Infopath content to a database or web service

    Hi, I have a sharepoint 2010 where I have 2 infopath forms used to enter data (each form has 5 por 6 fields). I need, once the data entered and validated, at the same time sent to a sql database or web service. Can you please let me know the best rou

  • Compare two iTunes Libraries

    Hi all. I have two iTunes Libraries: one in my Time Capsule and one in an external HD. They are similar with slight differences. In the TC library I have 15.600 tracks, in the HD I have 14.900 tracks. I'd like to update the HD library with the same t

  • Updated iPhone5s but headphones not working

    I updated the software on my iPhone5S last night and now it will only play music through standard Apole ear buds. I use Panasonic ones for running. They worked before the update and still work in my ipod but not my iPhone5S. Baffled but I'm guessing

  • Macbook Pro stuck loading when powering on

    Hi there, My old macbook pro is stuck powering on.  The dial under the apple spin continues to spin.  Any idea how to correct?