hi guys

how to achieve a goal like this in java programming:
when i click a button it prompt me a browsing window to locate some file(s) or folder(s)...
basically i need a specific function...

any help will be appreciated

best regards

thanks for the help...

it seem work for me...

commented: A simple question, but you seemed nice about the whole thing :) +3

does that mean that your problem is solved? :)
when a button is presses, i assume you do already know how actionListener works.

no not yet but I'm working on it...

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// here i don't know how to invoke the "JFileChooser".....

}

any help....!


thank you

did you read the sun tutorial (my first post, the JFileChooser was a link (as is this one)? it explains the usage quite thoroughly...

a quote almost but not quite 1/4 down the page

int returnVal = fc.showOpenDialog(FileChooserDemo.this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            //This is where a real application would open the file.
            log.append("Opening: " + file.getName() + "." + newline);
        } else {
            log.append("Open command cancelled by user." + newline);
        }

yes I've red that and it was quite helpful...

well im still far away form the objective which im working on... but sooner or later it will be done... yah...

thanks for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.