Passing a selected file in a GUI to another class

Hi guys. I have a GUI set up so that when a file is selected in a directory and the user presses a play button in the GUI..it plays back the sound. (Java sound used.) However i want whatever file was selected to be passed to another class also.In other words..whatever the JFileChooser selects..i want that file info to be passed to another Java class in the package...can anyone help? cheers.

No...whatever file is selected i just want that
instance to be sent to another class.Yes it can be done.
These are the steps.
1.) Choose the file you want. Once you have chosen the file retrieve the absolute path of that file.
2.)Call a method of the other class instance to which you want to send the file passing the file path as an argument.
3.)In the other class retrieve the String path and then use it to create a file object to access it.
//User chooses a file from file chooser and retrieves the path of that file and stores it in a variable String file_path;
//Now let other_class_instance be the reference of the other class to which you want to send the files path and let that other class contain a method retrievePath(String path);
other_class_instance(file_path);
//The method definition in the other class
public void retrievePath(String file_path)
        File file_reference=new File(file_path);
        //Now access the file using this file_reference
}

Similar Messages

  • How can I to control any element of my GUI from another class?

    How can I to control any element of my GUI from another class?

    For that, you need the external class to have the reference to your element.. If your idea is to change basic properties like width, height etc.. then you can have the constructor of the external class to take the object of the parent of your class as the parameter and modify ..
    However, if the properties to be altered/accessed are custom to your element, then you will have to have the class accept an object of your class as the parameter. No other option..
    What exactly is your requirement?

  • How do I copy selected files from one HD to another?

    To date, the only way I can do this is by copying the entire folder (or one file at a time). Does another program exist where I can copy groups of files rapidly?

    Select...Select All, Ctrl+C to copy the contents to the Clipboard, then in the other PSD image use Ctrl+V to paste the contents in on its own layer.
    Ken

  • Passing contents of file as an argument while calling class from shell scri

    I am calling a class from shell script. One fo arguments which i want to pass to this class is the content of a text file. like:
    /opt/java/bin/javac CLASS_NAME "FILE_CONTENTS"
    if i give "cat FILE_NAME" it will take literally
    and if i dont use quotes then it will be considered as seperate arguments, how do i slve this?

    double-post http://forum.java.sun.com/thread.jspa?threadID=684422

  • CL_gui_frontend_services-To read data by selecting file from file dialog

    Hi I have a requirement in which -
    I have to selct the file using file open dialog . Cl_gui_open_frontendservices . From this I have to read the data into internal table .
    How can I get the data  after getting the file name .
    Does any one have idea on this .

    data: begin of itab_string occurs 0,
          record type char255,
          end of itab_string.
    data:  L_FILETABLE TYPE FILETABLE,
    L_FILETAB_H TYPE FILETABLE WITH HEADER LINE.
    data: p_file1 type string.
    selection screen .
    PARAMETERS: P_FILE TYPE LOCALFILE.
    at selection-screen on value-request for P_FILE.
    IF THE USER SELECT EXTENTION BUTTON IT WILL OPEN THE LOCAL DIRECTORY FOR SELECTING THE FILE LOCATION.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
       WINDOW_TITLE            =
       DEFAULT_EXTENSION       = 'CSV'
       DEFAULT_FILENAME        = 'C:\Documents and Settings\kiran\Desktop\STATUS.csv'
       FILE_FILTER             =
       INITIAL_DIRECTORY        = 'C:\Documents and Settings\kiran\Desktop\'
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = L_FILETABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    ELSE.
    LOOP AT l_filetable INTO L_FILETAB_H.
    P_FILE = L_FILETAB_H-FILENAME.
    move p_file to p_file1.
    EXIT.
    ENDLOOP.
    ENDIF.
    passing the selected file name to gui_upload for loading the data
    into internal table
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = p_file1
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = itab_string
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE I000(Z00) WITH 'PLEASE PROVIDE CORRECT FILE NAME'.
    ENDIF.
    Reward points for all helpful answers,
    kiran.M
    Reward points if helpful and close this thread
    Message was edited by:
            KIRAN KUMAR

  • How to execute an SSIS package on a scheduled basis from remote server and pass in input files

    I have an application server and a db server.  My db server has all things SQL Server stored on it (DBMS, SSRS, SSIS, etc.)  I have several nightly batch process SSIS packages (dtsx files currently) that will pickup an input file and import them
    into the database.  I would like to execute all batch processes from my application server as I have quite a few other ones as well that do other stuff outside of SQL Server via powershell.  My question is how to do this?  Is there away to execute
    them remotely via DTexec.exe, should I set them up as Agent jobs and somehow pass in the file names\location (how?), create and SSIS catalog, etc.?  
    I need to easily be able to see if the packages execute successfully or not and if not capture the detailed information of why they failed from the remote server so I can use that to drive my process flow logic in the batch processes.

    Hi Jason,
    According to your description, you want to execute a package on a schedule and receive notification when package ends with error in the job.
    After testing the issue in my environment, we can directly add the package in a step of a job, then add a schedule and set the Alert and Notification property in the job to achieve your requirement. For more details, please see:
    Create a Database Mail in the SSMS.
    Right-click the SQL Server Agent services to Enable mail profile, then select the appropriate Mail profile.
    Under the Operators folder, create an operator with the correct E-mail name.
    Right-click the Jobs folder to add a new job.
    In the Steps pane, New a step with SQL Server Integration Services Package Type to run the package.
    In the Schedules pane, New a schedule for the job.
    In the Alerts pane, New an alert with SQL Server event alert, then enable Notify operators option with an operator in the Response pane.
    In the Notifications pane, enable Email option with same operator and When the job fails selection.
    Then when the package fails, the job would be failed and we can receive the error message in the mailbox.
    Besides, please make sure the account that execute the job has correct permissions for the file, for the folder that contains the file, and for the database.
    References:
    Configure Database Mail – Send Email From SQL Database
    How to setup SQL Server alerts and email operator notifications
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Photoshop crashes when selecting File / Automate / Batch

    Photoshop users still need a fix for Photoshop crashing whenever they select Batch.
    I understand that Adobe staff has chosen to blame scanner drivers for the problem. And, I've read the discussions thru last year (very long and boring when all you want is a fix). But, I'm not settled on several things which do not add-up.
    First, I'll review the symptoms for the sake of all interested readers. Photoshop users have reported Photoshop crashing whenever they select File / Automate / Batch from the menu for years. This problem got much worse (widespread) since the release of version 12.0.4. The problem apparently affects only those with Train compatible scanners and who installed Adobe's optional Twain plugin. I never read how anyone came to this conclusion, but scanner drivers are being blamed. The accepted work-around is to disable or remove Adobe's Twain plugin.
    Second, I want to point out that Photoshop works normally when using the Twain plugin. I can scan images and they are imported directly into Photoshop without any problems. This was the case before the 12.0.4 update and is still the case now.
    Third, I want to pose my most pressing question. What does selecting "Batch..." have to do with scanner drivers? In other words, what possibly could Photoshop be doing with scanner drivers when selecting "Batch..." that it does not do when actually does use the drivers?
    Lastly, I'll point out that I am a software developer of over 30 years. So, I understand how it might somehow work out in the details that the source of the problem really is buggy scanner drivers. However, as a programmer with a lot of experience dealing with problems common in device driver API's, I know that good practice is to expect anything. If Photoshop begins a process that calls out to someone else's software API, it should cushion that call with proper exception error handling. All processes should execute with an "if all else fails" contention.

    >> What does selecting "Batch..." have to do with scanner drivers?
    When running the actions for the Batch command, Photoshop updates it's menu/command state to check which commands are enabled or disabled based on the document state being changed by the actions.  Part of that update is calling the scanner interface to see what is available or not, and at that point some drivers crash.  Since the crash occurs in third party code executed within Photoshop's context - there was not much Photoshop could do to recover (there was exception handling, but it couldn't work across OS and DLL boundaries).
    In Photoshop CS6, we spent quite a bit of time figuring out why they were crashing (apparently there was some assumption about the application GUI state), and how we could avoid them crashing in those circumstances - and now CS6 avoids the crashes in the Batch command even with the TWAIN plugin and drivers are loaded.

  • Is it possible to pass a TXT file as an input of a SQL script?

    Dear all,
    I have a question about SQL scripts running in SQL*Plus. I have a table including a list of SAP UserIDs. I would like to check for several people whether their
    ID already exists. Here is how I proceed in my script file.
    SELECT sap_userid
    FROM SAPREF_USERS
    WHERE (sap_userid
    IN
         'user1',
         'user2',
         'user3',
         'user4',
         'user5',
           .          /*  So here I write one by one each userid. Consequently if a user already exists, the script will print his/her UserID */
    GROUP BY sap_userid
    ORDER BY sap_useridWell, this works, but I'm sure there should be a more intelligent method to do the job. If I put all UserIDs in a let's say a TXT file (one userid per line) is there
    any way to pass this text file as an input for the script so I may get rid of the very long IN clause in my SQL query?
    Thanks in advance,
    Kind Regards,
    Dariyoosh

    Yet Another Post Without Version.
    Typing 4 digits and 3 dots, or running select * from v$version and paste the result here
    Qualifies as work, and the very reason you post here is you want to avoid to work, or to earn as much as possible by doing as little as possible.
    In 9i and higher, the file is best treated as an external table, so the whole list of userids is replaced by
    in (select * from external_table)
    But this requires reading documentation, which again qualifies as ... work.
    Ahh, most 'DBA's here are quite hopeless.
    Sybrand Bakker
    Senior Oracle DBA

  • How to get list of selected files from swf to javascript ?

    Hi everybody,
    i want to make an upload script with swf and javascript. I want to do selecting files via swf then uploading files to server via javascript. I have searched SWFupload plugins but they are not working as i need. I am new here and i do some search, i see it is possible to save list of selected files in FileReferenceList array, but i dont know if is it possible to pass this array into javascript and then make upload progress via javascript ?

    Hi,
    You will not be able to get the local file paths from FileReference due to flash security restrictions.
    Hence I think it is not possible to pass the file reference data to javascript and load the same.
    Warm Regards
    Deepanjan Das
    http://deepanjandas.wordpress.com/

  • Can ditto select files based on modification date?

    Hi. I'm trying to use ditto to make backups. I would like to have it select only files modified after a certain date. Is there a way to do this?
    I noticed the bom (bill of materials) option... can that be used for this purpose somehow? Not quite sure how best to create a BOM that includes only files based on modification date.
    Any suggestions? Thanks
    Eric

    ditto doesn't provide a way to select only files modified after a certain date -- but find does; see the "-newer" and "-newerXY" options. Using find, you can generate a BOM file listing files that have been modified after a certain date.
    Then you can pass that BOM file to ditto.
    Powerbook G4 1GHz   Mac OS X (10.3.9)  

  • Change selected file in automator using applescript ???

    So I'm getting better at using Automator to create useful Services but still a bit of a newbie with doing powerful things with AppleScript... and I think this task requires some applescripting. Here's what I want to do:
    1. Based on a selected text file I want to run a pre-existing script that converts this file into an HTML file. This new file has the same name as the text file but has the .html extension rather than the .txt extension. (This step is easy enough with Automator and it works just fine already.)
    2. BUT NOW, I want to take that resulting HTML file and run another pre-existing script that converts the HTML file into an RTF file. The problem is that I basically want to change the selection from selectedfile.TXT to selectedfile.HTML so that I can proceed to this next step...
    3. AND THEN, I want to launch an app with this resulting RTF file. Again, I need to change the selection to selectedfile.RTF.
    Right now this requires me to run three different automator services, and changing the selected file between each step... But I'm sure there's an easy applescript way (or other way) to do this using just one service -- probably involves some filename parsing and some magic to change the selection??? -- or something like that...
    Could anyone point me in the right direction???
    Thank you thank you thank you!
    ~zyyyy

    Have you considered using a bash script? You can even write the script in an Automator Service.
    Open Automator and select Service from the main screen. Set the ‘Service Receives Selected’ pop-up menu to Files or Folders, and set the ‘in’ pop-up to Finder. Drag Run Shell Script from the Utilities section of the actions library into the workflow area. Set Pass Input to As Arguments. Replace the sample code in the input area with this:
    for f in "$@"
    do
    file_ext="${f##*.}"
    if [ $file_ext = "txt" -o $file_ext = "TXT" ] ; then
    /usr/bin/textutil -convert html "$f"
    /usr/bin/textutil -convert rtf "${f/$file_ext/html}"
    /usr/bin/open -a /Applications/TextEdit.app "${f/$file_ext/rtf}"
    fi
    done

  • Selected file cannot be linked because its type (video) does not match the original file's type

    I've been using Premiere Elements 9 for a couple of years now, and a few months ago I began having problems importing AVI files created from a BlackMagic Intensity Pro capture card.  (These issues were not previously occurring, and since they surfaced, I have exhausted the various settings for the BlackMagic card, used various software such as BlackMagic's own Media Express as well as the freeware VirtualDub, and still have the following problems.)
    In addition, these AVI files play just fine, in their entirety, using Windows Media Player and in Quicktime.
    The problem (or possibly two, but I suspect they could be related) is that most of the AVI files I attempt to import will either (1) import all video and NO audio, or (2) import ONLY a short segment of audio and video, and the length that Elements imports varies.  Usually only in the range of a minute or two.  The rest of the file is not imported at all.
    After much digging in forums, and testing various settings in trying to figure out the issue, I decided to back up all of my files and completely wipe all hard drives and start over with a fresh installation of Windows and Premiere Elements 9.  I haven't installed much else yet, as I wanted to first find out if the reinstallation improved things with Elements.
    For the first project I created in Elements after the reinstallation, Elements successfully imported an entire AVI that was nearly 2 hours long, audio and video.  This was a file that previously would not import properly into Elements.  This suggested that my earlier installation of Elements must have been corrupted somehow.  At this point I was very hopeful that all was well.
    I proceeded to edit the video as I had wanted, saved the project, and exported it to an MPEG format file.  I had originally wanted to export it as an MOV, but I hadn't yet installed Quicktime, so Elements couldn't do that just yet.  The MPEG export was successful and plays fine.
    However, I then installed Quicktime, and once it was finished, I restarted the PC and reloaded the same project.  This time, Elements claimed the media was offline.  I double-clicked on a segment of the video, and directed Elements to the raw file, but then an error message popped up:  "The selected file cannot be linked because its type (video) does not match the original file's type (audio and video)."  This was the same file I had JUST edited and of which I created an MPEG.
    I tried creating a new project and the "Get Media" function to import the AVI again, but this time only the video imported with NO audio.  (This would explain why the error message said what it did, but not why the audio wasn't imported.)
    What in the world is going on with Elements???  I am baffled since the ONLY task I have done on this machine after a complete reinstallation of both Windows and Elements is edit one AVI.  I find it very hard to believe that just installing Quicktime caused this.
    Some info on my system:
    System:  Asus P6T w/ Intel i7 920 and 12 GB memory
    OS: Windows 7 Ultimate
    Video Software:  Premiere Elements 9
    Capture Card:  BlackMagic Intensity Pro (PCI-e)
    Capture Software:  AVIs recorded with either BlackMagic Media Express or VirtualDub (only prior to the reinstallation, as neither of these programs are currently installed)
    I'm getting to the point with Elements that I might need to just abandon it and find something else that is more reliable.  Anybody have suggestions to help with this, so I won't have to migrate?

    mtnsports
    We think that we need to start off with definiting the properties of these .avi files that you are importing into Premiere Elements 9.0/9.0.1 (assumed that you are working for the required 9.0.1 Update).
    You say that the "avi" was created from a "BlackMagic Intensity Pro capture card". What are the properties of this .avi that you imported into Premiere Elements? Not all .avi are created equal. What is the video and audio compression, frame size, frame rate, interlaced or progressive, pixel aspect ratio, typical duration?
    Based on the properties of the video what have you been setting as the project preset?
    Let us start here.
    More later.
    ATR

  • Passing multiple select value from BI publisher to PL/SQL functions

    Hi - I have designed a report which pass parameters (Multi select) into a function to get the output result. When a single parameter value is passed to the function, report is being displayed. When multi select value is passed to the function it is returning the error `wrong number or types of arguments in call to 'F_PROCESS_WAVE_DATA'. When i checked the parameters passed to the function, i can see each multi select value is treated as different value and is assigned to different parameter in the function.
    Any help on passing the multi select parameter into function will be helpful.
    Regards,
    Vikram.

    All - Issue was resolved. I followed the following steps to resolve the issue
    1. Create a PL/SQL table type variable as VARCHAR2 in the database - Say as Larray
    2. Create PL/SQL type record and table for the record in database. Lrec, Ltable
    3. In BI report pass multiple select LOV variable as Larray(variable).
    4. In DB function, Parameter should be defined as LARRAY.
    5. Return PL/SQL table type Ltable from the function.
    Regards,
    Vikram.

  • Edit in Photoshop CS4... does not open the selected file.

    Sorry if this is an old topic, but I can not seem to find the answer and I was hoping someone here might know.
    When in Lightroom (2.2 or 2.3) if I select "Edit in Photoshop CS4..." or any of those dropdown commands, Photoshop opens....and that is it. The selected photo from Lightroom is NOT opened/merged/panoramaized. duuh. frustrating.
    So I re-installed Lightroom, updated to the 2.3, re-installed CS4. all with the same effect that Photoshop opens, but the selected file is NOT opened.
    Has anyone experienced this? Any solutions?
    Thanks in advance.

    When you remove the obvious,
    that which is left must therefore be the truth -- Sherlock Holmes
    Short version:
    When I created a new lightroom catalog, and imported a single, standalone file, It worked fine. But when I imported to the new catalog, any photos from my existing catalog, it would fail.
    Turns out that I was doing something a bit out of the ordinary with the IPTC Copyright field. In order to make my copyright information look "different" when I would export a file.
    One would normally put in that field something like "© 2009 someone". I discovered a few months ago that I could make this field display as a multi line entry.
    ie.
    if you wanted to put XY into the copyright field, but wanted it to display as:
    X
    Y
    all you would have to do is to put a carrage return between the two characters. (hint ctl^enter). Now when you displayed the "copyright" in an output file, it will display
    vertically instead of all the characters in a horizontal line.
    After being frustrated by this for a couple of weeks, I simply started removing every option that I might have applied to photographs that I would import with Lightroom. One of the last ones was the "vertical" information I put in the copyright field in a Preset. (when you remove the obvious...).
    Funny thing is that no program really cares about the formatting of that field, or if it has multiple lines in the data, or special characters.......It even opens up just fine in Photoshop / Gimp / PSE / etc. with no problems.
    But, if you have multiple lines of data in the Copyright Field (and I suspect others as well),
    AND you want to open up the file from Lightroom in Photoshop, using the standard menu item of " Edit with Photoshop CS4", for some reason Photoshop will start, but never open the designated file. I would expect some parsing something just giving up after it encounters a CR.
    But.....All is well that ends well. Now I can quit obsessing, and move on to something else...
    Best,
    Jim

  • How can we pass the select-option value to modulepool program?

    hi,
      how can we pass the select-option value to modulepool program ?
      Because if i declared select-options in executable program and i used SSCRFIELDS to define push buttons in selection screen.
               My requirement if enter the values to select-options and press UPDATE pussbotton then i want call screen which contains tablecontrol.
               How i get select-option values to PAI of call screen for getting the data from database table to my internal table?

    Oh I thought that you have selection-screen and again you are working on dialog programming.
    if you want to use select-option directly in module pool then it is not possible.
    but you can do other way.
    create two varaiables
    data : v_kun_low like kna1-kunnr,
             v_kun_high like kna1-kunnr.
    use these two variables in layout ,let user knows that he can not give options like gt,lt,eq ,it will be always BT.
    and also when you see normal report program,you can use multiple values in either low or high,but here it is not possibel.
    use can enter only low value and high value.
    when you come to program point of view
    declare one range
    ranges r_kunnr for kna1-kunnr.
    do the coding like
    r_kunnr-low = v_kun_low.
    r_kunnr-high = v_kun_high.
    r_kunnr-options = 'BT'.
    r_kunnr-sign = 'I'.
    append r_kunnr.
    now you can use r_kunnr in select query ,it will work like select-option.
    other than this there is no option.
    Thanks
    Seshu

Maybe you are looking for

  • ICloud Backup restoring someone else's Apple ID information.

    Hey guys, Every time I restore from a particular backup on my iPad, it restores and constantly pops up someone else's Apple ID. I won't specify the ID for security reasons, but I have isolated it to the iCloud backup. I can backup from the iCloud bac

  • System not picking up the base lines created.

    Hi, We are in the process of upgrading database from 10.2.0.5 to 11.2.0.3.4 and as a part of this, i am working on implementing the Sql PLAN management to stability the environment.   i tried following URL and it worked in one of the database as per

  • Font issue: 1550 Regular

    Hello everyone, I'm currently having some very frustrating trouble with a font: 1550 Regular (the link is to dafont.com) : it doesn't show in my applications. What I'm working with: MacBook Pro (Retina, 13", mi-2014), Intel Core i5 2,6GHz, 8Go 1600 M

  • 3G access fix

    I got my iPhone today and everything worked fine except some issues with the iTunes/App Store download sync and more importantly it only worked on WiFi and no Edge or 3G! After reading a post here I did a full restore that took about 30 mins and it w

  • Changing the window scheme

    is there a way to create your own look and feel for a window in java? Such as change the way that the outside of the window is displayed. including the close resize and minimize buttons? Thanks Tyler