Why am i getting the same icon ...?

Hi
i have the following code
// get selected file
file = fileChooser.getSelectedFile();
//get Icon for the selected file
Icon icon = fileChooser.getIcon(file);
//set Icon
L_Icon.setIcon(icon);but the prob is i am getting the same icon for all the file type(for html, Doc,...),
how can we get the icon accociated to file
Regards
Satinderjit

YOU have to define what images are for what files in a FileView derived class.
import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;
public class ImageFileView extends FileView {
    ImageIcon jpgIcon = new ImageIcon("images/jpgIcon.gif");
    ImageIcon gifIcon = new ImageIcon("images/gifIcon.gif");
    ImageIcon tiffIcon = new ImageIcon("images/tiffIcon.gif");
    public String getName(File f) {
        return null; // let the L&F FileView figure this out
    public String getDescription(File f) {
        return null; // let the L&F FileView figure this out
    public Boolean isTraversable(File f) {
        return null; // let the L&F FileView figure this out
    public String getTypeDescription(File f) {
        String extension = Utils.getExtension(f);
        String type = null;
        if (extension != null) {
            if (extension.equals(Utils.jpeg) ||
                extension.equals(Utils.jpg)) {
                type = "JPEG Image";
            } else if (extension.equals(Utils.gif)){
                type = "GIF Image";
            } else if (extension.equals(Utils.tiff) ||
                       extension.equals(Utils.tif)) {
                type = "TIFF Image";
        return type;
    public Icon getIcon(File f) {
        String extension = Utils.getExtension(f);
        Icon icon = null;
        if (extension != null) {
            if (extension.equals(Utils.jpeg) ||
                extension.equals(Utils.jpg)) {
                icon = jpgIcon;
            } else if (extension.equals(Utils.gif)) {
                icon = gifIcon;
            } else if (extension.equals(Utils.tiff) ||
                       extension.equals(Utils.tif)) {
                icon = tiffIcon;
        return icon;
}

Similar Messages

  • Why am I getting the same error message after replacing with a new cartridge?

    I have replaced the cartridge with two different new HP cartridges, but the message continues to say that cartridge is empty. In addition, it won't even allow me to print in black only.  Any suggestions?

    Please read this post then provide some details. What printer model? What operating system? How is the printer connected - USB, wired LAN, Wireless LAN, bluetooth?
    Are you using refilled/reman cartridges?  These usually have not been reset to show proper ink levels.  In this case contact your supplier or use genuine HP cartridges.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • My daughter has downloaded free games from the App Store and I have been charged in excess of £200 and I don't know why has anyone had the same issue and if so how did you get your money back

    My daughter has downloaded free games from the App Store and I have been charged in excess of £200 and I don't know why has anyone had the same issue and if so how did you get your money back

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact
    To help avoid future transgressions set the Restrictions for In-App Purchases...
    Settings > General > Restrictions
    Understanding Restrictions  >  http://support.apple.com/kb/HT4213

  • Hi - for any photo, info in mountain lion shows a different file size than Photoshop does. I've tested with CS3 and CS6 and get the same problem. Doesn't happen with CS3 and OSX10.4 or any previous versions of Photoshop and OSX. Anyone know why?

    Hi - for any photo, info in mountain lion shows a different file size than Photoshop does. I've tested with both CS3 and CS6 on 10.8.2 and get the same problem. This doesn't happen with CS3 and OSX10.4 or any previous versions of Photoshop and OSX. Anyone know why?

    this one is actually a really rare symptom of a flaky connection to the ipod on a Windows PC. there's more going on in terms of hardware on nanos and 5th gens than in the earlier models ... so if the connection is flaky to precisely the right/wrong degree, itunes will see the ipod, but misidentify it as an earlier version of ipod.
    tracking down the cause of the flakiness can be tricky ... as you already know ...
    just checking. have you tried connecting with a different (known-good) USB cable? does that seem to have any impact on the rate of occurence of the problem?

  • When I click on my Yahoo bookmarks, I only get the download Yahoo toolbar page, I downloaded the toolbar again and I still get the same page when I hit bookmark icon - how do I get my bookmarks back - they still show on Microsoft Explorer

    Question
    When I click on my Yahoo bookmarks, I only get the download Yahoo toolbar page, I downloaded the toolbar again and I still get the same page when I hit bookmark icon - how do I get my bookmarks back - they still show on Microsoft Explorer

    julianscars wrote:
    I don't get a page, all I get is the player popping
    Click the green jelly button at the top left of the player.

  • I have Elements 12 installed.  When I am in the catalog, click on a photo, then want to open the Editor, I get an error message.  If I click on Editor from the Welcome screen, I get the same error message.  Why doesn't Editor work?  Thanks.

    I have Elements 12 installed.  When I am in the catalog, click on a photo, then want to open the Editor, I get an error message.  If I click on Editor from the Welcome screen, I get the same error message.  Why doesn't Editor work?  Thanks.

    You'd better ask in the Elements forum.
    Photoshop Elements

  • In eBay & YouTube, I get the message to install the latest version of Adobe Flash Player; I have gone through the download and installation procedure several times, but still get the same message - why can't I install the latest version on Firefox?

    In eBay, I was trying to upload pictures when I got this message: "You need the latest version of Adobe Flash Player to use the standard picture uploader.
    Download and install the latest version from Adobe before continuing."
    In YouTube, when trying to watch a video, I got this message: "You need to upgrade your Adobe Flash Player to watch this video."
    I have gone through the procedure for downloading and installing the latest version of Adobe Flash Player, but still get the same messages when I reopen Firefox and revisit these sites.
    There does not seem to be the same problem with Safari, which runs the latest version of Adobe Flash Player with no trouble.
    I am using an iMac running Mac OS X Version 10.6.7.

    You can find the latest Flash player for Firefox on this page.
    *http://www.adobe.com/special/products/flashplayer/fp_distribution3.html
    For Firefox on 64 bit Windows, you need the 32 bit Flash version version because Firefox is a 32 bit application.
    *http://www.adobe.com/software/flash/about/

  • TS1702 App store keeps telling me my iPad settings have to be set to enable cookies to download apps.  The setting is done, but why do I keep getting the same message to change the settings?

    I'm just setting up my new iPad.  I tried to download an app for the first time but kept getting a notice that said cookies have to be enabled.  I have followed the directions on enabling cookies, but I keep getting the same message when I try to download the app.

    Is this how you do it?
    Settings>Safari>Accept Cookies>From Visited

  • Why do I get the message "iPhone Not Available" when trying to make calls from my Mac even when both devices are clearly on the same Wi-Fi network?

    I am using a mid-2010 Mac Book and the iPhone 6.  I can't imagine that it is due to the age of my Mac because if it was disqualified, then we would not get the option to use it to take calls.

    I get the same message and stating that both the iPhone and Mac must be on the same network, which they are.  I was able to call from my iPad through the iPhone on the same network I'm using for the iMac and iPhone.  I've tried several settings configurations on the iPhone but to no avail.

  • Why do different users get the same session ID assigned???

    I have a database with users (username, password....). When a user logs on (through JSP and servlet), the user attributes get stored in a session.
    However, when I test my application (currently on my own pc), and I log on using a username in 1 window and then log on with another username in another window, I see these users get assigned identical session-ids! Is this because I'm testing this on my own pc environment?? Of course because they get the same session-ids, my application doesn't work right because if one user removes an attribute, the other user loses it as well. ????
    Thx in advance for expert advise!

    Try using IE for one user and FireFox for the other. The browsers wouldn't share cookies.

  • Why I keep getting the NO SIGNAL on my monitor??

    Question.....Someone gave me a Pc, I notice everytime I turn it on I get a No Signal icon on my monitor. So I open the unit up, took out the memory stick. Clean it off from dust with dry rag. Power it back up, still the same thing. I notice everything else is running like fans, even the little green light was on.  I went on youtube, tried those tips too, still the same reaction. Just before I got ready to give up on it. I notice there is no graphic Card. I was wonder could this be the reason why I keep getting the No Signal sign everytime i turn the pc on???? Please Help!!!!!In simple english Please......lol. Im very new at this.

    Does the iPhone NOT tell iTunes if you've played a track or not?
    Yes, but the entire track must be listened to - until the track ends.
    A song is not marked as played until the song has completed and the iPod starts playing the next song. The song must be played until the very end, and the same with a podcast.

  • I have multiple devices in my family. Each of us has an iPhone and an iPad. Is there a way for each of us to have our own Apple ID but one account so we can all get the same music, movies, books, etc. I can't see paying twice for something in the same fam

    I have multiple devices in my family. Each of us has an iPhone and an iPad. Is there a way for each of us to have our own Apple ID but one account so we can all get the same music, movies, books, etc. I can't see paying twice for something in the same family.

    Welcome to the world of digital media. Your can't really transfer it. I don't know what the rules are about transferring to your spouse but I do know that in some cases when you die, your heirs cannot inherit your digital media. This is why there is still an advantage to buying the CD since the usage rights belong to whomever holds the physical media.
    A possible workaround is to burn the songs to a music CD with yout account (tracks only without song titles) and then having your wife upload it as a regular music CD onto her account. It's been a while since i've done this so I'm not sure if it would work now.
    Please note that I'm not advocating copyright and/or TOS violations. I'm only suggesting ways to copy music for your own personal use which has traditonally been permitted. I only did this because I wanted to convert iTunes songs to mp3 files so I could burn them onto a data CD for use in my car. It would make sense that since married couples are a joint entity, this would be personal use.
    Also, I'm not a lawyer so don't take this as legal advice.

  • Why do I get the error message "unable to load page (HTTP 502) when I try to open Mobile Web?

    I have an LG Octane 3 basic phone.   Does everything I need, phone and text, and I never was interested in web or e-mail capabilities until I recently upgraded our plan to the "More Everything" and was able to use data and check e-mail and access the internet.   Whenever I try to open Mobile Web, I get the error message "unable to load page (HTTP 502)".    As of March 31, 2015, all of us basic phone users lose the "Mobile Email" app on our phones, and will have to access web versions of our e-mail via the web.  Which is currently unavailable and doesn't work.
    Over a week ago, did a chat session with a tech support rep, and she indicated that either she or an engineer would contact me with how to fix the problem.   Have not heard anything from anybody, and the deadline is approaching quickly.   Have no need of all the excess features of a smart phone, nor do I wish to be forced to jettison a perfectly working phone for my needs and buy something I don't want to be able to do 2 simple things.............check e-mail to see if there's something that needs to be answered right away, and to check traffic reports when I'm on the road, or find something in an area with which I'm not familiar.     Not really too much to ask, you would think....   )
    Has anyone else had this same problem, and if so, how do we fix it....???  My next move is a phone call, but those haven't always been very productive.
    If any of you have any ideas why this error keeps coming up and the web can't load, and some on how to fix it, I would really appreciate some advice.
    Thanks in advance.
    Karen

    Since the chat session got no reply, I contacted Verizon by phone and a very nice level 2 tech created a trouble ticket and sent it up the food chain.  Got a call back, maybe 2 days later, and had a nice, although very long session with a higher level tech.  They had determined that the browser for the LG Octane is an old one and no longer supported by Verizon.    We tried everything we could to download the Opera browser, but since I was totally unable to get Mobile Web to work, couldn't do it.   The only other possible "fix" was to totally reset the phone to factory specs and try it again.   That would mean a lot of work on my part to move anything I didn't want to disappear off the phone, and find a place to forward texts that had to be saved.   Caught our tenants lying about why the rent was late (again), and need that for when I put them back on a lease....  
    Long story short is that unless we try this total reset, which isn't a sure fix, either, anyone who isn't able to access the Mobile Web with the LG Octane will have to change their plan to avoid paying for data that you can't access using any method. 
    I ran a test with an app that I knew was no longer valid.....that was sending photos to PixPlace.   Got the exact same error message as when trying to access Mobile Web to get the web version of my e-mail.   That just verified that the 502 error is, at least in the LG Octane, for an app that no longer works.   After today, we'll get the same thing when we try to access Mobile E-Mail.
    Have to admit, it's a real ****-off, but this shouldn't surprise me, since Verizon won't repair older copper phone lines if you are in an area where FIOS is offered. 
    I am going to immediately change my husband's and my cell phone plan to one without data, and see what I can find that will still give unlimited calls and text.  The way my luck runs, they won't offer one for a decent price.  The other half has some very long-winded friends and he was always running over minutes, and some months are very text-heavy and I'd go over my limit.   Absolutely HATE touch screens, and am not looking forward to having to get a new phone.  

  • Yes i keep ashing the same question i keep getting the same answer and it is not resolving the problem

    YES I KEEP ASKING THE SAME QUESTION I KEEP GETTING THE SAME ANSWER AND IT IS NOT RESOLVING THE PROBLEM AND CHAT KEEPS SENDING ME BACK TO THE FORUMS THEY SAY THEIR EXPERTS WILL BE ABLE TO RESOLVE THE PROBLEM BUT IT IS NOT RESOLVED YET I KEEP GETTING THE SAME ANSWER FROM FORUM EXPERTS WELL THAT IS NOT WORKING I NEED A SOLUTION THAT WILL WORK I PAID FOR THIS AND I WANT TO USE IT BUT I CANNOT
    TRYING TO ACTIVATE A trial version of photoshop elements 7.0 disc worked till in the middle got an erroe fur and animalskin file missing checked dvd and it had a scratch so 3 times i downloaded a trial version of photoshop elements 7.0 from adobe.com but when try to activate get invalid serial number the website said have your serial number ready to activate which i do because i am getting it right from the dvd case it is registered i am signed in and chat just keeps telling me it is too old try the forums which i have many times with no resolution but they mark it as assumed resolved premeir elements 7.0 from the same dvd case is on why can't i activate trial version of photoshop elements 7.0 my computer crashed and i had to restore then i am now trying to put the programs
    maybe i can buy or exchange the dvd of photoshop elements 7.0 without because my serial number is good so i maybe just need a new disc being this disc is scratched i've got 40 to 50 hours into this 1 trial version of photoshop elements 7.0 more than i have in the whole computer restore and all the other programs i have restored have windows xp service pack 3 or 3.5 and net framework 4.0 and all the important and required updates i also have an open case which i am getting no where either case #213952591 which i responded to within 4 days as not resolved but i am still getting no help activating this trial version of photoshop elements 7.0
    24 Views
    Tags:

    YES I KEEP ASKING THE SAME QUESTION I KEEP GETTING THE SAME ANSWER AND IT IS NOT RESOLVING THE PROBLEM AND CHAT KEEPS SENDING ME BACK TO THE FORUMS THEY SAY THEIR EXPERTS WILL BE ABLE TO RESOLVE THE PROBLEM BUT IT IS NOT RESOLVED YET I KEEP GETTING THE SAME ANSWER FROM FORUM EXPERTS WELL THAT IS NOT WORKING I NEED A SOLUTION THAT WILL WORK I PAID FOR THIS AND I WANT TO USE IT BUT I CANNOT
    TRYING TO ACTIVATE A trial version of photoshop elements 7.0 disc worked till in the middle got an erroe fur and animalskin file missing checked dvd and it had a scratch so 3 times i downloaded a trial version of photoshop elements 7.0 from adobe.com but when try to activate get invalid serial number the website said have your serial number ready to activate which i do because i am getting it right from the dvd case it is registered i am signed in and chat just keeps telling me it is too old try the forums which i have many times with no resolution but they mark it as assumed resolved premeir elements 7.0 from the same dvd case is on why can't i activate trial version of photoshop elements 7.0 my computer crashed and i had to restore then i am now trying to put the programs
    maybe i can buy or exchange the dvd of photoshop elements 7.0 without because my serial number is good so i maybe just need a new disc being this disc is scratched i've got 40 to 50 hours into this 1 trial version of photoshop elements 7.0 more than i have in the whole computer restore and all the other programs i have restored have windows xp service pack 3 or 3.5 and net framework 4.0 and all the important and required updates i also have an open case which i am getting no where either case #213952591 which i responded to within 4 days as not resolved but i am still getting no help activating this trial version of photoshop elements 7.0
    24 Views
    Tags:

  • When my lightroom opens up I keep getting an error message that states, "Lightroom encountered an error whne reading from its preview  cache and needs to quit" I have relaunched it a number of times and keep getting the same message.

    when my lightroom opens up I keep getting an error message that states, "Lightroom encountered an error whne reading from its preview  cache and needs to quit" I have relaunched it a number of times and keep getting the same message. Any thoughts on how to fix this?

    You need to delete your preview cache and have Lightroom rebuild it.   Cache location can be found here.
    https://helpx.adobe.com/lightroom/kb/preference-file-locations-lightroom-41.html
    Why And How To Clear Your Lightroom Cache - Lightroom Fanatic

Maybe you are looking for

  • Is it possible to connect an external USB 2.0 hard drive to a Thunderbolt Display?

    Hello, Is it possible to connect an external USB 2.0 hard drive to a Thunderbolt Display and back up a MacBook Air to the external hard drive using Time Machine? I intend to connect my MacBook Air to the Thunderbolt Display using a Thunderbolt cable.

  • Key Generation, doesnt work

    Hi, every body I want to generate new Material Number automatically for new Materials I have done the following steps - I have set Key Mapping to YES in Products main table - In the remote systems I added a new remote system called SAP_ECC - In this

  • Problem in downloading ESS package

    Dear All, I m trying to download ESS package from market place, Description: BP ERP05 ESS 1.0 Support Package 13 File name: BPERP5ESS13_0-10003288.SCA But I m getting following message: "All corrective software packages, for SAP NetWeaver 2004s and S

  • Just got back from exchanging

    Got a week 38 with Macy Gray...it's GORGEOUS! I hope iskin releases their case for it soon.

  • Issues importing photos into lightroom 5.6

    Hello All,  I would very much appreciate any assistance in figuring out my issue of not being able to import new photos after having used LR for years with almost 6000 photos in my LR catalogue.  It looks like the images are coming in and then it giv