JFileChooser with FileSystemView Selecting directory

Hi,
I am using JFileChooser and with my own implementation of FileSystemView .
It is imposable to select a Directory.
Q1. Do you have any clue about the problem?
Q2. Is there any way I can add action listener to "Open" button.
or listen to the events of "Open" button.
Note:
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);is set.
Regards,
Byju

In the future, Swing questions should be posted to the Swing forum:
http://forum.java.sun.com/forum.jspa?forumID=57
If you have to select a directory, not an ordinary file, why not do this first?
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

Similar Messages

  • Using JFileChooser to select directory only

    Hi. I am using JFileChooser to let the user to select the directory to save some files into the user-selected directory. I set the JFileChooser to show only directory and not files. Below show part of my code:
    private JFileChooser chooser = new JFileChooser();
    chooser.setFileHidingEnabled(true);
    chooser.setMultiSelectionEnabled(false);
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
         chooser.setDialogType(JFileChooser.OPEN_DIALOG);
    int state = chooser.showDialog(frame, "Select Directory");
    if (state == JFileChooser.APPROVE_OPTION )
    file = chooser.getCurrentDirectory();
    However, the File reference that i get is not the user-selected directory. Please help.
    Thank you.

    Hi,
    i found that if user writes in the text field of save dialog name of the file(but application needs directory), getCurrentDirectory() returns correct directory. but if user chooses directory, getCurrentDirectory() returns parent directory but getSelectedFile() returns correct one, so i suggest something like this(it's nasty but it works [i hope;])
    JFileChooser dirChooser = new JFileChooser("");
    dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    if (dirChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
    java.io.File curDir = dirChooser.getSelectedFile().isDirectory()?dirChooser.getSelectedFile():dirChooser.getCurrentDirectory();

  • File Browser with multi select....

    Is it possible to have a file browser with multi- select??? I have several (possibly dozens) of files in a directory that I'd like to up load using a file browser style item, but be able to select several at a time to up load rather that doing them on at a time. Is this possible???

    Different idea, look at this thread, where you could just have multiple file upload capacity in a form.. The multi-select with browser I believe is NOT possible with current version of APEX.
    how to Upload Multiple Files
    Thank you,
    Tony Miller
    Webster, TX

  • [svn] 1267: fixed . patch creation to create patch with the selected files only, remove, fix newlines in the patch file.

    Revision: 1267
    Author: [email protected]
    Date: 2008-04-16 17:02:53 -0700 (Wed, 16 Apr 2008)
    Log Message:
    fixed .patch creation to create patch with the selected files only, remove, fix newlines in the patch file.
    Modified Paths:
    flex/sdk/trunk/tools/diffpack/diffpack
    flex/sdk/trunk/tools/diffpack/readme.txt

    All,
    I thought it may be related to spaces in the path in which the script was called from. I tried having the ODBC command script in another directory but the same thing happens. It will give me the "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259". As soon as the script is done running I can manually double click the script and it adds the DSN fine.
    Thanks,
    Clif Bridegum

  • JFileChooser performance in huge directory

    Customer has problem with opening huge directory over network. Directory conatains more than 1000 files. He can't accept dividing content to more directories. Time for open list of files is approx. 60 sec. If I open this directory from explorer time is 2 seconds. May help me Please ?

    I have the same problem (1.4beta2 and beta3) in a directory having 4000 files. 1000 files take only a few second though.
    I figured out the problem was because of isDirectory which takes an incredible amount of time.
    Sun was notified of this bug but they said it is irreproductible, back in 1997: http://developer.java.sun.com/developer/bugParade/bugs/4071318.html
    A hack would be to replace the isDirectory function and say:
    boolean isDirectory() {
      return file.getName().indexOf('.')<0 && file.isDirectory();
    }I didn't do it on jfilechooser (but on a filefilter), still hoping it will resolve by itself in the 1.4 release :)

  • How can i get all values from jtable with out selecting?

    i have one input table and two output tables (name it as output1, output2). Selected rows from input table are displayed in output1 table. The data in output1 table is temporary(means the dat wont store in database just for display purpose).
    Actually what i want is how can i get all values from output1 table to output2 table with out selecting the data in output1 table?
    thanks in advance.
    raja

    You could set the table's data model to be the same:
    output2.setModel( output1.getModel() );

  • Problems with spaces in directory or file names and Word.exe

    Hi
    I'm trying to open a file with Word from my java aplication, and I have a problem with some file/directory names.
    I have this
    String cmd = "c:\\Program Files\\Microsoft Office\\Office10\\WINWORD.EXE" + " " + path;
    try {
    Runtime.getRuntime().exec(cmd);
    } catch (Exception errorea){ }
    Here is what happens:
    if path is something like this: "c:\people\info.doc" , there's no problem, Word opens the document, but if path contains blank spaces somewhere, it doesn't work. For example:
    path = "c:\Documents and Settings\info.doc"
    path = "c:\Hi everybody\info.doc"
    path = "c:\tests\test results.doc"
    with the above examples it doesn't work :( Word tries to open "c:\Documents", "c:\Hi" or "c:\tests\test".
    Can anyone help? thanx a lot ! : )

    No, the exec method runs the Word.weird, it shouldn't, and it wouldn't on my system going by the test I just made, but I'm running linux & not windows, maybe the command line parsing is different for some reason.
    The problem is that
    Word starts and then Word says that it can't open the
    file because the name or the path to the file is not
    valid.You still should use the overload that takes a String array.

  • SSRS Report with mutli select values in parameters

    Hi All,
    I am creating a SSRS report and displaying the result in tablix. I want to make the report to filter by multi select values from the parameters.
    I have 3 parameters. For all the three parameters, I have set "Default  Values" and "Available Values". Also, modified my result dataset to get the values from parameters using "WHERE ID = @Parameter1" (example) and so
    on..
    3 Parameters types:   1. Yes or No       
    2. Date          3. Values with NULL in the DB
    Problems:
    1. When I am passing the default values "Yes" "No" - it is throwing errors because default values is passed as Yes "AND" No instead of "OR" condition. The value stored in the DB wil have either Yes or No but not both.
    2. When I am querying the date values, it is a DateTime field in the DB. But I have queried like SELECT CONVERT(DATE, EXE_DATE) AS DATE FROM table which is giving only date in SQL but in SSRS displaying date with time.
    3. When I pull the list of values for third Parameter from SQL, it has some NULL values. When I try to use it in SSRS, it is not displaying the NULL value as select option in the list of values
    Any suggestions for the above three problems for SSRS with multi select values as filter will be helpful.
    Maruthu | My Blog

    Hi Maruthi,
    Regarding the three things:
    1.) I believe your first parameter is mutliselect , please convert it to single select.
    Steps: 
    a.) Select the parameter, right click and go to parameter properties
                    b.) Under General Tab in DataType section remove the checkbox for Allow Multiple Value.
    2.) Instead of returning as the date please return string. For example : 
    SELECT CONVERT(VARCHAR, GETDATE(),101)
    Here is the list of conversion : http://www.sqlusa.com/bestpractices/datetimeconversion/
    3.) As such there is no concept of null in SSRS. (Its a relational concept) . We do have nothing , which means empty. In Order to use null please select the Allow null option in the DataType section of the Parameter, This will add an checkbox for null in
    the report preview. Its developer job to handle the null values in there query.
    Regards Harsh

  • The standard report for BOMs of a material with a selected period?

    Hi Gurus
    Is there any  standard report for BOMs of a material with a selected period?

    Hi,
    You will have to develop a report for your requirement,
    The following tables will be used for the report
    MAST-WERKS
    STPO-MATNR
    MARA-MAKTX
    STPO-BMENG
    STPO-POSNR
    STPO-IDNRK
    STPO-MAKTX
    STPO-DATUV
    STPO-MENGE
    STKO-MEINS
    STPO-AVOAU
    Regards
    Merwyn

  • Submit report with dynamic selections

    Hi All,
    I am trying to Submit a report with dynamic selections. I am using the option SUBMIT REPORT WITH FREE SELECTIONS.
    But the dynamic selections are not getting passed.
    Request you to kindly provide some inputs
    My code is
    DATA: trange TYPE rsds_trange,
          trange_line LIKE LINE OF trange,
          trange_frange_t_line LIKE LINE OF trange_line-frange_t,
          trange_frange_t_selopt_t_line LIKE LINE OF trange_frange_t_line-selopt_t,
          texpr TYPE rsds_texpr.
    trange_line-tablename = 'PA0002'.
    *trange_frange_t_line-tablename = 'PA0002'.
    trange_frange_t_line-fieldname = 'GBJHR'.
    trange_frange_t_selopt_t_line-sign   = 'I'.
    trange_frange_t_selopt_t_line-option = 'EQ'.
    trange_frange_t_selopt_t_line-low    = '1987'.
    trange_frange_t_selopt_t_line-high   = '1987'.
    APPEND trange_frange_t_selopt_t_line TO   trange_frange_t_line-selopt_t.
    APPEND trange_frange_t_line TO trange_line-frange_t.
    APPEND trange_line TO trange.
    CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
      EXPORTING
        field_ranges = trange
      IMPORTING
        expressions  = texpr.
    submit RPCADVQ0
    VIA SELECTION-SCREEN
                    WITH SELECTION-TABLE rspar_tab
                    WITH FREE SELECTIONS it_texpr
                    and returN.
    Kindly provide your inputs
    Regards
    Reshma

    Hi Reshma,
    Use the FM - RS_REFRESH_FROM_DYNAMICAL_SEL before FREE_SELECTIONS_RANGE_2_EX.
      data: trange  type rsds_trange,
              g_repid type sy-repid.
    g_repid = 'RPCADVQ0'.
      call function 'RS_REFRESH_FROM_DYNAMICAL_SEL'
        exporting
          curr_report        = g_repid
          mode_write_or_move = 'M'
        importing
          p_trange           = trange
        exceptions
          not_found          = 1
          wrong_type         = 2
          others             = 3.
      if sy-subrc eq 0.
    " Do the changes to the trange
    CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
    EXPORTING
    field_ranges = trange
    IMPORTING
    expressions = texpr.
    submit RPCADVQ0
    VIA SELECTION-SCREEN
    WITH SELECTION-TABLE rspar_tab
    WITH FREE SELECTIONS it_texpr
    and returN.
    endif.
    Cheers,
    Kothand

  • How do i take one layer with multiple selections...

    how do i take one layer with multiple selections and make those selections their own layer?

    Yes sir. It w was really hard to explain. It is discontiguous segments that are separated by transparent areas. And I want those non transparent areas to be on their own layer. I have a photo shop file that has a bunch of buttons on them and they are on a transparent background. It is one layer. I want to select all the buttons and put them on their own layers. I can do this manually by selecting a button and cmd Just to a new layer, but when I have 200 buttons it is a daunting task.
    Sent by MailWise<http://www.mail-wise.com/installation/4> – Your emails, with style.

  • How to replace the existing selection screen with new selection screen

    Hi,
    I have first selection screen with parametre as a table name, then I have created dynamic selection screen as 2nd selection screen with different fields of that table as select options. This is done using genaration of dynamic report. Now If I click on button on this 2nd selction screen , then I want to replace this 2nd dynamic selection screen , with the other selection screen fields.
    Can anybody guide me, How to do replace one slection screen with different selection screen.
    and one imp thing is this selction screen is populating with dynamic fields on it.
    Regards,
    Mrunal

    As I can understand you want to make some of the screen field to disable or visible on screen  depending upon the interaction of user with screen 1.
    You may use this example code in PBO of screen 2.
    LOOP AT SCREEN.
        " action has been taken to modify the area office screen as per the option chosen at screen 99.
        CASE ACTION.
            " if the user has taken up the option of UPLOAD
          WHEN 'UP'.     " screen processing while we upload the plan
            " during upload we will make dates as output fields only
            IF SCREEN-NAME = 'ZSDTPLANVRSIO-DAT_TO' OR SCREEN-NAME = 'ZSDTPLANVRSIO-DAT_FRM'.
              SCREEN-INPUT = 0.
              MODIFY SCREEN.
            ENDIF.
            " also make 2 buttons disabled
            IF SCREEN-NAME = 'AO_DO' OR SCREEN-NAME = 'AO_VE'.
              SCREEN-ACTIVE = 0.
              MODIFY SCREEN.
            ENDIF.
          WHEN 'DN'.      " screen processing while we upload the approved plan
            " during upload we will make dates as output fields only
            IF SCREEN-NAME = 'ZSDTPLANVRSIO-DAT_TO' OR SCREEN-NAME = 'ZSDTPLANVRSIO-DAT_FRM'.
              SCREEN-INPUT = 0.
              MODIFY SCREEN.
            ENDIF.
            " also make 2 buttons disabled
            IF SCREEN-NAME = 'AO_UP' OR SCREEN-NAME = 'AO_VE'.
              SCREEN-ACTIVE = 0.
              MODIFY SCREEN.
            ENDIF.
          WHEN 'VW'.      " screen processing while we view the plan
            " during upload we will make dates as output fields only
            IF SCREEN-NAME = 'ZSDTPLANVRSIO-DAT_TO' OR SCREEN-NAME = 'ZSDTPLANVRSIO-DAT_FRM'.
              SCREEN-INPUT = 0.
              MODIFY SCREEN.
            ENDIF.
            " also make 2 buttons disabled
            IF SCREEN-NAME = 'RLGRAP-FILENAME' OR SCREEN-NAME = 'FNAME'.
              SCREEN-ACTIVE = 0.
              MODIFY SCREEN.
            ENDIF.
            " and hide the file input field
            IF SCREEN-NAME = 'AO_DO' OR SCREEN-NAME = 'AO_UP'.
              SCREEN-ACTIVE = 0.
              MODIFY SCREEN.
            ENDIF.
        ENDCASE.
      ENDLOOP.

  • How to create a table with multiple select on???

    Hi all,
            I am  new to webdynpro and my requirement is to create a  table with multiple selection on.I have to add abt 10 rows in the table but only 5 rows should be visible and moreover a verticalscroll should be available to view other rows.Can anybody explain me in detail how to do that.Please reply as if you are explaining  to a newcomer.Reply ASAP as i have to do it today.
                                                                           Thanxs

    Hi,
    1. Create a value node in your context name Table and set its cardinality to 0:n
    2. Create 2 value attributes within the Table node name value1 and value2
    3. Goto Outline view> Right click on TransparentUIContainer>Apply Template> Select Table>mark the node Table and it's attributes.
    you have created a table and binded its value to context
    Table UI properties
    4.Set Selection Mode to Multi
    5.Set Visible Row Count to 5
    6.ScrollableColCount to 5
    In your implemetaion, you can add values to table as follow:
    IPrivate<viewname>.ITableElement ele = wdContext.nodeTable().createTableElement();
    ele.setValue1(<value>);
    ele.setValue2(<value>);
    wdContext.nodeTable().addElement(ele);
    The above code will allow you to add elements to your table node.
    Regards,
    Murtuza

  • How to call the same query more than once with different selection criteria

    Hi,
    Please do anybody know how to solve this issue? I need to call one query with the fixed structure more than once with different selection criteria. For example. I have following data
    Sales organization XX
                         Income 2008  Income 2009
    Customer A       10                 20
    Customer B        30                  0
    Sales organization YY
                         Income 2008  Income 2009
    Customer A        20                5
    Customer B        50                10
    Now, I need this. At the selection screen of query, user fill variable  charakteristic "Sales organization" with interval  XX - YY, than I need to generate two separate results per sales organization, one for Sales Organization XX and the second for SO YYwhich will be displayed each on separate page, where result for SO YY will be dispayed under result for SO YY. Are there some options how to do it for example in Report Designer or WAD or with programming? In Report Designer is possible to use one query more than once, but I dont know how to force each query in RD to display result only for one Sales Organization, which will be defined in selection screen.
    Thank you very much
    J.

    Hello,
    thanks to all for cooperation. Finally we solved this issue with the following way..
    User fill appropriate SO on the selection screen, which is defined as range. This will resulte, that selected SO are listed in report below each othe (standard behavior). Required solution we achieved with the Report Designer, we set page break under each Result row of RD. This caused, that report is divided into required part per SO, which are stated each on separate page.
    J.

  • What is the wrong with my select query

    HI All,
    TYPES: BEGIN OF t_equi,
             equnr          TYPE equi-equnr,
             aedat          TYPE equi-aedat,
             matnr          TYPE equi-matnr,
             sernr          TYPE equi-sernr,
             kunde          TYPE equi-kunde,
             zzreg_date     TYPE equi-zzreg_date,
             zzin_indic     TYPE equi-zzin_indic,
             zzinvoice_num  TYPE equi-zzinvoice_num,
             zzinvoice_date TYPE equi-zzinvoice_date,
             kund1          TYPE equz-kund1,
          END OF t_equi,
    DATA: it_equi        TYPE TABLE OF t_equi,
      SELECT equnr
             aedat
             matnr
             sernr
             kunde          "Ship to
             zzreg_date
             zzin_indic
             zzinvoice_num
             zzinvoice_date
             kund1            "Sold to
             INTO TABLE it_equi
             FROM equi AS a
             INNER JOIN equz AS b
             ON a~equnr = b~equnr
             WHERE a~equnr      IN s_equnr AND
    *               aedat GE gv_rdate AND
                   a~matnr      IN s_matnr AND
                   a~sernr      IN s_sernr AND
                   a~kunde      IN r_shpbr_kunde AND
                   a~zzin_indic IN s_indic  AND
                   b~datbi      EQ c_datbi  AND 
                   b~kund1     IN r_sldbr_kund1 .
    what is the wrong with this select query.. ?
    its giving me error  "The column name "EQUNR" is unclear ."
    Thanks

    Hi ,
    write  tablename or alias in select also
    SELECT a~equnr and check.
    Regards

Maybe you are looking for

  • Dynamic photo gallery with XML

    My photo gallery works fine when I test movie in gallery.fla I have a thumbnail scroller that moves the thumbnails right when you move mouse left and left when you move mouse right. When you click on a thumb a larger picture is displayed. This all wo

  • Quadro video cards (for Windows)...

    Is it possible to utilize a Windows version of the nVidia Quadro series video cards in a 2009 MacPro? I would be using it in the B/C side of course; but was curious if this is even do-able? Or are there too many little "gotchas" to even bother with t

  • About Collection and ForAll

    Dear Guru 1) I have some documents about collection of 10g and example of Forall function. 2) Question: I have procedure called Test_ps How to see the source code of the procedure A : User_source But i want to see how my parameter are there in proced

  • Info button on selection screen...

    Hey!    When you execute program RSCONN01 (in 4.6C, at least), there is an "Info" button on the application tool bar next to the "Get variant" selection.  How does one get that button up there?  It's not on a gui-status that I can see...    I can get

  • Mini Windows 7 Starter won't restore!

    Hi, I have an HP mini netbook; Windows 7 starter. And I have a TON of viruses. And my computer won't even connect to the Wi-fi anymore even when I am right next to it! And frankly it's gotten annoying. I have tons of conduit viruses on this thing and