Hi all,
I am fairly new to java, as well as netbeans, but I come from a VB background.
I am wanting to build platform independant aps and find the need to cross over into this world of Java, and netbeans (so far) is the best visual ide I have seen for it.

I am having a few issues finding tutorials on using netbeans for GUI aps.

Perhaps I am missing something in concept, I don't know. VB lets you create and call windows at will, pretty much.

Here's what I have.
the main window when starting a project has a button and a textfield.
I have created a second (swing) window which is called InputLocation
when I created InputLocation it showed InputLocation.java in the project area.

InputLocation is a swing "file chooser" dialogue in reality.

When the button is pushed on the main form, I need a couple of things to happen.
1.) the InputLocation dialogue should appear.
2.) once the user chooses the location, this dialogue should go away and the location chosen should appear in the main page textfield that I have created.

I am using this for later manipulation of files which reside in this folder (and it's subfolders)

I can't seem to figure out what to put in the mouse event area of the source to even get the InputLocation dialogue to appear.
Anyone able to help me with this, or show me where I can find the information that I need?
Thanks in advance

10 Years
Discussion Span
Last Post by jwenting
public void actionPerformed(ActionEvent e) {
                    JFileChooser fileChooser = new JFileChooser(".");
                    int status = fileChooser.showOpenDialog(screen);
                    if (status == JFileChooser.APPROVE_OPTION) {

Something like this.

Votes + Comments
Great answer for my java netbeans question

Great answer, you were right, it was "something like this". I only had to plug in the right names (I may have missnamed them in my explination), and poof, I had the popup.
There were a couple of minor tweeks to make it fit my exact setup, but I did give you fairly limited information and no code sample.

Points to your reputation for putting me on the right track.
Thanks a bunch for your help.


you didn't use wrong names, just different ones from the ones I chose in the application I pulled that code from :)

It's pretty much boilerplate code, you'll be writing similar methods a LOT.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.