Results 1 to 2 of 2
  1. #1
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default how to open a folder when hitting the button (like opening a my documents)

    hi guys.. please help me how to open a folder like my documents in windows or other application in swt?
    :cool:

  2. #2
    qualitystreet is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    btnCSVOpen.addSelectionListener(new SelectionListener() {
    public void widgetSelected(SelectionEvent arg0) {
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new java.io.File("."));
    chooser.setDialogTitle("choosertitle");
    chooser.setFileSelectionMode(JFileChooser.FILES_ON LY);
    chooser.setAcceptAllFileFilterUsed(false);

    if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
    System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
    System.out.println("getSelectedFile() : " + chooser.getSelectedFile());
    txtCSVLocation.setText(chooser.getSelectedFile().t oString());
    } else {
    System.out.println("No Selection ");
    }
    }

Similar Threads

  1. GUI. Button opening another GUI
    By Felic in forum New To Java
    Replies: 5
    Last Post: 12-02-2010, 06:52 PM
  2. how to prevent open folder in run time
    By syedabu in forum NetBeans
    Replies: 0
    Last Post: 03-18-2010, 04:09 AM
  3. opening directory (folder) to reveal contents.
    By solris in forum New To Java
    Replies: 6
    Last Post: 06-28-2009, 06:40 PM
  4. Open specific folder form JSP
    By roseline43 in forum New To Java
    Replies: 2
    Last Post: 09-02-2008, 07:53 PM
  5. Internet Explorer is unable to open Office documents from an SSL Web site
    By pramod@netedgecomputing.c in forum Web Frameworks
    Replies: 0
    Last Post: 07-19-2007, 07:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •