I am using the netbeans gui builder.

I dragged a filechooser onto my frame, and it does almost everything I want it to do.

How do I remove the buttons? I dont need them - the user just has to select a file, or type in a file name, the buttons are unused.

Also, if a user types in a file name in the "File name" Text field, how do I get that file name?

I tried "fileChooser.getSelectedFile()" but that only returns a value if the user has actually highlighted an existing file. The idea is to get the file name the the user entered and create a new file with that name.

Anyone have an idea?

Recommended Answers

All 4 Replies

I am using the netbeans gui builder.

I dragged a filechooser onto my frame, and it does almost everything I want it to do.

How do I remove the buttons? I dont need them - the user just has to select a file, or type in a file name, the buttons are unused.

Also, if a user types in a file name in the "File name" Text field, how do I get that file name?

I tried "fileChooser.getSelectedFile()" but that only returns a value if the user has actually highlighted an existing file. The idea is to get the file name the the user entered and create a new file with that name.

Anyone have an idea?

Which buttons are you talking about?
If you want to create a new File with given name then You need to use the SAVE_DIALOG mode (which can be set in Dialog type in properties of that fileChooser) to create a file with the given name

Thanks, will try the SAVE_DIALOG advice immediatly.

I'm talking about the "Open" and "Cancel" buttons.

Thanks, will try the SAVE_DIALOG advice immediatly.

I'm talking about the "Open" and "Cancel" buttons.

There is a checkbox in properties controlButtonsAreShown. You can uncheck it to remove the buttons

*yay*

Thanks! No more buttons!

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.