Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

JChooser Save Dialog - Default Title

Thread view: 
wendy.c.leung@gmail.com - 03 Jan 2006 18:45 GMT
Hi,

I would like to have the JChooser Save Dialog display a default title
plus extension when the user first clicks on the Save as option.  It is
just like what Microsoft Word does when a user creates a new document
and goes and saves it, and the dialog displays a default title.doc for
the user to use if desired.  Is there a way to do this for JChooser
Save Dialog?

Thanks! Any help is much appreciated!

Wendy
zero - 03 Jan 2006 21:12 GMT
wendy.c.leung@gmail.com wrote in news:1136313958.157237.260220
@g49g2000cwa.googlegroups.com:

> Hi,
>
[quoted text clipped - 8 lines]
>
> Wendy

Have you tried calling JFileChooser:setSelectedFile(File f) before showing
the dialog?

Let me know if it works.

Signature

Beware the False Authority Syndrome

wendy.c.leung@gmail.com - 03 Jan 2006 22:23 GMT
Thank you very much!  That worked the way I want it!

Wendy
wendy.c.leung@gmail.com - 03 Jan 2006 23:01 GMT
I used JFileChooser:setSelectedFile(File f)

Wendy
Rhino - 03 Jan 2006 21:37 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Thanks! Any help is much appreciated!

I assume you mean JFileChooser; there is no JChooser class in the J2SE 1.5.0
API.

I think the method you want is setDialogTitle(), one of the many methods in
JFileChooser. However, I'm not a Word user so I may be mistaken about what
you are trying to do; from the wording of your question, it sounds like you
are more interested in setting the default file name for the file  that the
user will save; if that's what you mean, I don't think you can display the
default name directly on the line that shows the File Name; I think the user
needs to click on one of the files displayed in the file list box, THEN the
name of that file is copied to the File Name text field. At least, that's
how it works in a program that I wrote which I just tried to test the
behaviour of JFileChooser.

You may find it helpful to read the Java Tutorial article on the
JFileChooser component; you can find it at
http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html.
The JFileChooser article in the API will probably also be useful.

Rhino
Vova Reznik - 03 Jan 2006 21:43 GMT
> Hi,
>
[quoted text clipped - 8 lines]
>
> Wendy

Read:

javax.swing.filechooser.FileFilter - for file extension

javax.swing.plaf.basic.BasicFileChooserUI (setFileName(String)) - for
file name


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.