ImageIcon retrieving file name once created

I have created an image icon and at some later point would like to retrieve the name of the file that created the icon. Is that possible? I have not found a method to do this.
Thanks.
-Jim

To my knowledge, there is no built-in way.
You could create a Map of icon information, that stores the icon as the key and the filename as the value for later retrieval. Something like:
private Map iconInfo = new HashMap();
private ImageIcon image1;
// then, when you go to load the images...
public void loadImages()
  String pathname1 = "./someDir/someOtherDir/someImage.gif";
  // perhaps call some other method to fetch an image
  image1 = loadImage(pathname1);
  iconInfo.put(image1, pathname1);
// at some later point ...
public void doSomething()
  String filename1 = (String) iconInfo.get(image1);
}

Similar Messages

  • Retrieve file name from full file path

    I am trying to retrieve a file name from a path (ex. c:\temp\tes.txt) using the following code, but it is given me an error of "The method split(String) in the type String is not applicable for the arguments (char).
    {code}
    String filepath = item.getName();
    String[] buf = filepath.split('/');
    String filename = buf[buf.length-1];
    {code}
    I tried to use double quote instead of single quote, but it is not returning anything.
    {code}
    String[] buf = filepath.split("/");
    {code}
    Anyone knows why? Thanks.

    How is this related to JDBC?
    Anyway, is the path separator actually a forward slash? Isn't it a backward slash?
    If you're using Apache Commons FileUpload (which I guess, the 'item.getName()' is recognizeable), then just read their FAQ: [http://commons.apache.org/fileupload/faq.html#whole-path-from-IE].

  • How can I retrieve file name being processed in Batch

    Hi All
    I want to retrieve the current filename that is being processed by a batch, e.g. A1~Texas~Actual~Jan-2010~RR.txt
    I can do this in various event scripts that have the strFile parameter but I need to do it in the BatchAction event script and cannot see how I go about it. I can see various objects in the API guide that should help me get at it but can't get it working.
    Has anyone done this before or got any pointers for how I can do this?
    Many thanks
    Stuart

    Hi Tony
    I have been able to retrieve this using the PstrFileName property in various event scripts, particularly those where strFile is a parameter and then used API.DataWindow.Utilities.fParsePath to trim that and provide just the file name. However thsi does not work in the BatchAction event script.
    I have found a property in the Batch Loader section of the supplementary API called PstrFileTitle but my VB is not strong enough to work out how to get at it. From what I can gather I would need to supply the BatchID (plus other parameters) to another function that would return this into a recordset and then read from the recordset (??) but I am not sure how to go about this.
    To give you some background, what I am trying to achieve is writing to a log file pre and during batch processing where the log file name should use the source file's name, e.g. 'SourceFile.txt' will write to SourceFile.log. The issue is that for batch processing we have to rename 'SourceFile.txt' s 'A1~Texas~Actual~Jan-2010~RR.txt' and I previously tried to use the PvarTempNC variables to store the source file name only to find that I could use that in the BatchAction event script!
    If you can point me in the right direction that would be great.
    Thanks
    Stuart

  • Retrieving file name using web agent

    When uploading to the database using interMedia web agent and an HTML form, is the file name (as well as the file contents) passed to the agent?
    If so, how does one retrieve the file name on the server side?
    Thanks for insight.
    -John

    Hi John,
    OK, you got me thinking, so I just had to look :-) Turns out its not in the documentation as such. Its in the doc changes section at the end of the README. (Because, now I really think about it, I added the code after the docs were last updated).
    Simon

  • Retrieving file name from jsp

    I have an input field on my jsp. The input type is "File".
    I am trying to get the contents of that field and the filename and/or file path that is included in that field.
    Does anyone know how to do this?
    I tried a request.getParameter in the servlet but this field is not a text field.
    Thanks.

    Check out the Apache FileUpload package:
    http://jakarta.apache.org/commons/fileupload/
    It has the methods you'll need to get the file name and file contents.

  • File information -- How to retrieve file name from header variable

    Hi
    I am using File Adapters to read files(.xml) and then I need to perform some database operations.
    One of the requirement is storing the file name read into the DB.
    I searched through the forum and got the information on how to configure this in the header variable. The link below shows the same.
    File Adapter
    Now, I use the XSL mapper to map the source values(from input xml file) to the corresponding table column names. So how should I get the value of the file name.
    I saw some of the in-built functions to be used for this but there is not enough documentation to proceed.
    Can anyone please provide some solution on this.
    /Kiran.

    Hi,
    Here are the steps that you need to do after you have declared the variable.
    1) The variable that you have declared should have the following elements
    a) Filename
    b) Directory
    2) Use the assign activity to copy the value of the filename part of this variable to the arg that needs to be passed to the database. (most probably an invoke variable).
    If you still have any problems implementing this, mail me at [email protected]..and i'll send you the screen shots for the entire process.
    ciao,
    Gunjan

  • Retrieve file name of email attachment

    Hi,
    it's getting more and more absurd about the fact that it is not possible to get the file name of an email attachment. It's not possible by writing a module (getName(), getContentType() nor getDescription() doesn't work) or by accessing mailadapter specific message attributes.
    I mean it's a basic requirement. Why is it so diffcult to implement it???
    -Steffen
    (frustrated)

    Hi,
    See the below links
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    http://help.sap.com/saphelp_nw04/helpdata/en/23/c093409c663228e10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/9ef1680efbec4c9656eb028c44ab0b/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ad/bf93409c663228e10000000a1550b0/frameset.htm
    Mail adapter
    Regards
    Chilla..

  • Write to measurement file will not ask for file name once as selected.

    When using the Write to Measurement file Express VI.  I select "Ask user to choose file" and "Ask only once" with the intention that the data from each iteration simply be appended to the chosen file.
    I select "Run continuous" and the VI asks for me to choose a file repeatedly anyway instead of just appending the first file.  Selecting "Write to one file" properly appends data to the file specified in the box.
    Am I doing something wrong?

    DianeS wrote:
    Personally I can't figure out why that particular button even exists (I'm told it's occasionally useful for debugging).  
    I find it useful if I am creating a subVI that is supposed to be a part of another VI.  No while, loop just some inputs and outputs as a function.  If I want to test it out stand alone and try a variety of inputs, then Run Continuous and change the inputs, then I see immediate feedback on the outputs.  Once I'm satisfied its working right, then there is no need to clean up.  Just save it and drop it in the large VI as a subVI.
    Beyond that, I see no need for Run Continuous.

  • How to Retrieve Server Name for creating connection pool during startup!

    Hi All,
    I am going thru the edocs documentation of weblogic for creating the connection pool and the datasource dynamically. The URL I referred to was as under
    http://edocs.bea.com/wls/docs81/jdbc/programming.html
    There is a sample given in the above-mentioned URL. The Server MBean is created by passing the server name.
    The code below mentioned was have placed in my dblib.java
    svrAdminMBean = (ServerMBean)adminMBeanHome.getAdminMBean("myserver", "Server");
    I am creating the connection pool from the servlet by invoking the dblib.java
    I cannot hard-code the server name in the dblib.java since the same code was shared across multiple servlets.
    Each Servlet will create its own connection pool during application server startup.
    Is there a way to retrieve the server name in which the dblib.java is invoked.
    Any pointers to info source will be REALLY appreciated.
    Many Thanks in Advance,
    C R Baradwaj

    You can get it from the Java system property weblogic.Name, i.e. System.getProperty("weblogic.Name");
    Cheers
    Feargal

  • F4 help to give desktop path for retrieving file name

    Hi Guys,
    I want a big help from u people, I worked on module pool programming and in that i had written some BDC also in that. Now my concern is i need to give F4 help path for the user to goto Desktop and pick the file from his PC.He will goto transaction and then only he can run the Report.
    Now i had tried this
    at selection-screen on value-request for p_filename.
    v_mask = ',Tab Delimited (.txt),.txt.'.
    CALL FUNCTION 'WS_FILENAME_GET'
      EXPORTING
        DEF_FILENAME     = ' '
        DEF_PATH         = ' '
        MASK             = v_mask
        TITLE            = ' '
      IMPORTING
        FILENAME         = p_filename
      EXCEPTIONS
        INV_WINSYS       = 1
        NO_BATCH         = 2
        SELECTION_CANCEL = 3
        SELECTION_ERROR  = 4
        OTHERS           = 5.
    but in at selection screen i need to give parameters or select-options... which is not there as u know bcoz its a module pool programming.....
    Can u pls help me out its urgent!!!!!!!!
    Rewards will be definite....

    Hi Abdul,
    Refer demo program DEMO_DYNPRO_F4_HELP_MODULE in SE38.
    Check Flow Logic by double clicking on the screen 100.
    PROCESS BEFORE OUTPUT.
      MODULE INIT.
    PROCESS AFTER INPUT.
      MODULE CANCEL AT EXIT-COMMAND.
    PROCESS ON VALUE-REQUEST.
      FIELD CARRIER MODULE VALUE_CARRIER.
      FIELD CONNECTION MODULE VALUE_CONNECTION.
    <b>Reward points if it helps.</b>
    Regards,
    Amit Mishra
    Message was edited by: Amit Mishra

  • Bridge MUST KEEP ORIGINAL FILES NAMES when creating a web gallery.

    My clients use the galleries I create to download higher resolution images, and now Bridge decides to randomly rename the output images with arbitrary numbers? REALLY? Why on earth would Bridge even NEED to do that? So stupid, please fix, pronto.

    I agree.
    The web gallery is useless this way.
    Fix needed asap!
    wim

  • Tracking of Attached file by File name in display changes option

    Hi All,
    i have a requirement where user wants to track the deleted file from document.
    when we go to environment-->display changes, system shows only format(wrd,xls etc) of the file which was created and deleted but how to track the file by file name once created and/or deleted.
    Thank You,
    Manoj

    Hi,
    I have created new profile and even activated, after deleting attachment from one of DIR there's no log showing for deleting the particular attachments in environment-->display changes..
    Thank You,
    Manoj

  • Limit on the number of file names retrieved using FM 'RZL_READ_DIR_LOCAL'

    Hi All,
    I am using FM 'RZL_READ_DIR_LOCAL' , to retrieve file names from a specified directory.
    When executed, i am getting 10,000 records(file names) only against lakhs of files present in the directory.
    I would like to know if there is any limitation on the number of file names retrieved using that FM and how to over come it.
    Also please let me know if the FM 'EPS2_GET_DIRECTORY_LISTING' also has any such limitations.
    Thanks in advance,
    Sreeni Vallem

    I did not know about this limitation of number of files returned. You can give a try to the external command way of doing it in your development system.  Well, creating 10001 files in development is a boring job . You can write a sample program as Rob has mentioned in this thread and copy files to a specific directory ABAP: Copy files from one R3 directory to another. This doesn't disturb the existing program written.
    Mean while let's wait for expert's reply.
    Kesav

  • Selecting a list of files and creating a list of only the file names?

    Hopefully this is an easy question, one that I can't seem to figure out. I have a folder of photos and I would like to select all their file names and create a text list of just the file names. Every time I try I select the photos themselves and when pasted into my text document all of a sudden I have a lot of images. Any advice on how to do this? Thanks Jeff

    You're part way there. Do this in TextEdit. Open a new document, CMDSHIFTT to put it into plain text format, paste in the contents of your photo folder, and be surprised when only the names get pasted and not the images. If you want them in alphabetical order, change the photo folders view to list and click on the name column before copying.

  • File name created on run time

    did anyone face this issue that file name is created with digit?
    insert into "D:\Inbox/26"
         STUDENT_ID,
    STUDENT_NAME
    this is the code of step of inserting rows.I dont know why wrong file name is generating.I am using variable for file name.I checked the value of variable and it is correct.
    ANY IDEA ?

    Hi,
    Some ideas :
    1. Is your variable of alphanumeric datatype, with a keep all history property? If not, try with this config.
    2. Did you try with single quotes in the resource name of your datastore ?
    3. Do you run it inside a package ? (Refresh variable then execute your interface)

Maybe you are looking for

  • "Internal module error" in NSU - fix offered here!

    Just received this: Dear updaters, We have noticed some of you reporting the message "Internal module error". When installing Nokia Software Updater, sometimes the Microsoft XML4 DLL silent installation fails. This problem can be resolved by manually

  • How can I determine what is making FireFox slow?

    I am using FF 34.0.5 on Win 8.1 64-bit. It works very well, but occasionally it will get very noticeably slower. When I go to Task Manager, it reports FF is using 29-31% of my i5 3570K 3.4 GHz CPU. It continues to work, and does not use up more resou

  • Error while setting up Oracle Stream

    Hi All, I am not able to execute package dbms_streams_auth.grant_admin_privilege for establishing stream between databases on the same server. It is failing with the following error. SQL> exec dbms_streams_auth.grant_admin_privilege('strmadmin',true)

  • Auto update problem in 1.5?

    -In 1.4.2, when we put a new jar on the web server, the next time we logged into an application using webstart, it would show the progress bar as it loaded the application. -In 1.5, the only way we can get the progress bar to show is if we delete tem

  • Adobe 10 Flash Player Download

    When trying to download Adobe Flash Player 10 I get an error message to close chrome. I am not doing any applications so the browser is not open. I then tried to do it through Explorer and Yahoo but get same message. Can someone explain how I can clo