Sunteți pe pagina 1din 8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)

Documentation

TheJavaTutorials
Trail:CreatingaGUIWithJFC/Swing
Lesson:UsingSwingComponents
Section:HowtoUseVariousComponents

HowtoUseFileChoosers
FilechoosersprovideaGUIfornavigatingthefilesystem,andtheneitherchoosingafileordirectoryfromalist,orenteringthenameofafileor
directory.Todisplayafilechooser,youusuallyusetheJFileChooserAPItoshowamodaldialogcontainingthefilechooser.Anotherwayto
presentafilechooseristoaddaninstanceofJFileChoosertoacontainer.
Note:
IfyouintendtodistributeyourprogramasasandboxJavaWebStartapplication,theninsteadofusingtheJFileChooserAPIyou
shouldusethefileservicesprovidedbytheJNLPAPI.TheseservicesFileOpenServiceandFileSaveServicenotonly
providesupportforchoosingfilesinarestrictedenvironment,butalsotakecareofactuallyopeningandsavingthem.Anexampleofusing
theseservicesisinJWSFileChooserDemo.DocumentationforusingtheJNLPAPIcanbefoundintheJavaWebStartlesson.
ClicktheLaunchbuttontorunJWSFileChooserDemousingJavaWebStart(downloadJDK7orlater).Alternatively,tocompileandrunthe
exampleyourself,consulttheexampleindex.

WhenworkingwiththeJWSFileChooserDemoexample,becarefulnottolosefilesthatyouneed.Wheneveryouclickthesavebuttonandselectan
existingfile,thisdemobringsuptheFileExistsdialogboxwitharequesttoreplacethefile.Acceptingtherequestoverwritesthefile.
TherestofthissectiondiscusseshowtousetheJFileChooserAPI.AJFileChooserobjectonlypresentstheGUIforchoosingfiles.Your
programisresponsiblefordoingsomethingwiththechosenfile,suchasopeningorsavingit.RefertoBasicI/Oforinformationonhowtoreadand
writefiles.
TheJFileChooserAPImakesiteasytobringupopenandsavedialogs.Thetypeoflookandfeeldetermineswhatthesestandarddialogslook
likeandhowtheydiffer.IntheJavalookandfeel,thesavedialoglooksthesameastheopendialog,exceptforthetitleonthedialog'swindowand
thetextonthebuttonthatapprovestheoperation.HereisapictureofastandardopendialogintheJavalookandfeel:

HereisapictureofanapplicationcalledFileChooserDemothatbringsupanopendialogandasavedialog.

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

1/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)

Trythis:
1.
2.
3.
4.

Compileandruntheexample,consulttheexampleindex.
ClicktheOpenaFilebutton.Navigatearoundthefilechooser,chooseafile,andclickthedialog'sOpenbutton.
UsetheSaveaFilebuttontobringupasavedialog.Trytouseallofthecontrolsonthefilechooser.
InthesourcefileFileChooserDemo.java,changethefileselectionmodetodirectoriesonlymode.(Searchfor
DIRECTORIES_ONLYanduncommentthelinethatcontainsit.)Thencompileandruntheexampleagain.Youwillonlybeableto
seeandselectdirectories,notordinaryfiles.

Bringingupastandardopendialogrequiresonlytwolinesofcode:
//Createafilechooser
finalJFileChooserfc=newJFileChooser();
...
//Inresponsetoabuttonclick:
intreturnVal=fc.showOpenDialog(aComponent);

TheargumenttotheshowOpenDialogmethodspecifiestheparentcomponentforthedialog.Theparentcomponentaffectsthepositionofthe
dialogandtheframethatthedialogdependson.Forexample,theJavalookandfeelplacesthedialogdirectlyovertheparentcomponent.Ifthe
parentcomponentisinaframe,thenthedialogisdependentonthatframe.Thisdialogdisappearswhentheframeisminimizedandreappearswhen
theframeismaximized.
Bydefault,afilechooserthathasnotbeenshownbeforedisplaysallfilesintheuser'shomedirectory.Youcanspecifythefilechooser'sinitial
directorybyusingoneofJFileChooser'sotherconstructors,oryoucansetthedirectorywiththesetCurrentDirectorymethod.
ThecalltoshowOpenDialogappearsintheactionPerformedmethodoftheOpenaFilebutton'sactionlistener:
publicvoidactionPerformed(ActionEvente){
//Handleopenbuttonaction.
if(e.getSource()==openButton){
intreturnVal=fc.showOpenDialog(FileChooserDemo.this);
if(returnVal==JFileChooser.APPROVE_OPTION){
Filefile=fc.getSelectedFile();
//Thisiswherearealapplicationwouldopenthefile.
log.append("Opening:"+file.getName()+"."+newline);
}else{
log.append("Opencommandcancelledbyuser."+newline);
}
}...
}

TheshowXxxDialogmethodsreturnanintegerthatindicateswhethertheuserselectedafile.Dependingonhowyouuseafilechooser,itisoften
sufficienttocheckwhetherthereturnvalueisAPPROVE_OPTIONandthennottochangeanyothervalue.Togetthechosenfile(ordirectory,ifyou
setupthefilechoosertoallowdirectoryselections),callthegetSelectedFilemethodonthefilechooser.Thismethodreturnsaninstanceof
File.
Theexampleobtainsthenameofthefileandusesitinthelogmessage.YoucancallothermethodsontheFileobject,suchasgetPath,
isDirectory,orexiststoobtaininformationaboutthefile.Youcanalsocallothermethodssuchasdeleteandrenametochangethefilein
someway.Ofcourse,youmightalsowanttoopenorsavethefilebyusingoneofthereaderorwriterclassesprovidedbytheJavaplatform.See
BasicI/Oforinformationaboutusingreadersandwriterstoreadandwritedatatothefilesystem.
TheexampleprogramusesthesameinstanceoftheJFileChooserclasstodisplayastandardsavedialog.Thistimetheprogramcalls
showSaveDialog:
intreturnVal=fc.showSaveDialog(FileChooserDemo.this);

Byusingthesamefilechooserinstancetodisplayitsopenandsavedialogs,theprogramreapsthefollowingbenefits:
Thechooserremembersthecurrentdirectorybetweenuses,sotheopenandsaveversionsautomaticallysharethesamecurrentdirectory.
Youhavetocustomizeonlyonefilechooser,andthecustomizationsapplytoboththeopenandsaveversions.
Finally,theexampleprogramhascommentedoutlinesofcodethatletyouchangethefileselectionmode.Forexample,thefollowinglineofcode
makesthefilechooserabletoselectonlydirectories,andnotfiles:

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

2/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

AnotherpossibleselectionmodeisFILES_AND_DIRECTORIES.ThedefaultisFILES_ONLY.Thefollowingpictureshowsanopendialogwiththe
fileselectionmodesettoDIRECTORIES_ONLY.Notethat,intheJavalookandfeelatleast,onlydirectoriesarevisiblenotfiles.

Ifyouwanttocreateafilechooserforataskotherthanopeningorsaving,orifyouwanttocustomizethefilechooser,keepreading.Wewilldiscuss
thefollowingtopics:
AnotherExample:FileChooserDemo2
UsingaFileChooserforaCustomTask
FilteringtheListofFiles
CustomizingtheFileView
ProvidinganAccessoryComponent
TheFileChooserAPI
ExamplesthatUseFileChoosers

AnotherExample:FileChooserDemo2
LetuslookatFileChooserDemo2example,amodifiedversionofthepreviousdemoprogramthatusesmoreoftheJFileChooserAPI.This
exampleusesafilechooserthathasbeencustomizedinseveralways.Liketheoriginalexample,theuserinvokesafilechooserwiththepushofa
button.Hereisapictureofthefilechooser:

Asthefigureshows,thisfilechooserhasbeencustomizedforaspecialtask(Attach),providesauserchoosablefilefilter(JustImages),usesa
specialfileviewforimagefiles,andhasanaccessorycomponentthatdisplaysathumbnailsketchofthecurrentlyselectedimagefile.
Theremainderofthissectionshowsyouthecodethatcreatesandcustomizesthisfilechooser.Seetheexampleindexforlinkstoallthefiles
requiredbythisexample.

UsingaFileChooserforaCustomTask
Asyouhaveseen,theJFileChooserclassprovidestheshowOpenDialogmethodfordisplayinganopendialogandtheshowSaveDialog
methodfordisplayingasavedialog.

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

3/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)

Theclasshasanothermethod,showDialog,fordisplayingafilechooserforacustomtaskinadialog.IntheJavalookandfeel,theonlydifference
betweenthisdialogandtheotherfilechooserdialogsisthetitleonthedialogwindowandthelabelontheapprovebutton.Hereisthecodefrom
FileChooserDemo2thatbringsupthefilechooserdialogfortheAttachtask:
JFileChooserfc=newJFileChooser();
intreturnVal=fc.showDialog(FileChooserDemo2.this,"Attach");

ThefirstargumenttotheshowDialogmethodistheparentcomponentforthedialog.ThesecondargumentisaStringobjectthatprovidesboth
thetitleforthedialogwindowandthelabelfortheapprovebutton.
Onceagain,thefilechooserdoesn'tdoanythingwiththeselectedfile.Theprogramisresponsibleforimplementingthecustomtaskforwhichthefile
chooserwascreated.

FilteringtheListofFiles
Bydefault,afilechooserdisplaysallofthefilesanddirectoriesthatitdetects,exceptforhiddenfiles.Aprogramcanapplyoneormorefilefilterstoa
filechoosersothatthechoosershowsonlysomefiles.Thefilechoosercallsthefilter'sacceptmethodforeachfiletodeterminewhetheritshould
bedisplayed.Afilefilteracceptsorrejectsafilebasedoncriteriasuchasfiletype,size,ownership,andsoon.Filtersaffectthelistoffilesdisplayed
bythefilechooser.Theusercanenterthenameofanyfileevenifitisnotdisplayed.
JFileChoosersupportsthreedifferentkindsoffiltering.Thefiltersarecheckedintheorderlistedhere.Forexample,anapplicationcontrolledfilter
seesonlythosefilesacceptedbythebuiltinfiltering.
Builtinfiltering
Filteringissetupthroughspecificmethodcallsonafilechooser.Currentlytheonlybuiltinfilteravailableisforhiddenfiles,suchasthose
whosenamesbeginwithperiod(.)onUNIXsystems.Bydefault,hiddenfilesarenotshown.CallsetFileHidingEnabled(false)to
showhiddenfiles.
Applicationcontrolledfiltering
Theapplicationdetermineswhichfilesareshown.CreateacustomsubclassofFileFilter,instantiateit,andusetheinstanceasan
argumenttothesetFileFiltermethod.Theinstalledfilterisdisplayedonthelistofuserchoosablefilters.Thefilechoosershowsonly
thosefilesthatthefilteraccepts.
Userchoosablefiltering
ThefilechooserGUIprovidesalistoffiltersthattheusercanchoosefrom.Whentheuserchoosesafilter,thefilechoosershowsonlythose
filesacceptedbythatfilter.FileChooserDemo2addsacustomfilefiltertothelistofuserchoosablefilters:
fc.addChoosableFileFilter(newImageFilter());

Bydefault,thelistofuserchoosablefiltersincludestheAcceptAllfilter,whichenablestheusertoseeallnonhiddenfiles.Thisexampleuses
thefollowingcodetodisabletheAcceptAllfilter:
fc.setAcceptAllFileFilterUsed(false);

OurcustomfilefilterisimplementedinImageFilter.javaandisasubclassofFileFilter.TheImageFilterclassimplementsthe
getDescriptionmethodtoreturn"JustImages"astringtoputinthelistofuserchoosablefilters.ImageFilteralsoimplementsthe
acceptmethodsothatitacceptsalldirectoriesandanyfilethathasa.png,.jpg,.jpeg,.gif,.tif,or.tifffilenameextension.
publicbooleanaccept(Filef){
if(f.isDirectory()){
returntrue;
}
Stringextension=Utils.getExtension(f);
if(extension!=null){
if(extension.equals(Utils.tiff)||
extension.equals(Utils.tif)||
extension.equals(Utils.gif)||
extension.equals(Utils.jpeg)||
extension.equals(Utils.jpg)||
extension.equals(Utils.png)){
returntrue;
}else{
returnfalse;
}
}
returnfalse;
}

Byacceptingalldirectories,thisfilterallowstheusertonavigatearoundthefilesystem.Iftheboldlineswereomittedfromthismethod,the
userwouldbelimitedtothedirectorywithwhichthechooserwasinitialized.
TheprecedingcodesampleusesthegetExtensionmethodandseveralstringconstantsfromUtils.java,shownhere:
publicclassUtils{

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

4/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)
publicfinalstaticStringjpeg="jpeg";
publicfinalstaticStringjpg="jpg";
publicfinalstaticStringgif="gif";
publicfinalstaticStringtiff="tiff";
publicfinalstaticStringtif="tif";
publicfinalstaticStringpng="png";
/*
*Gettheextensionofafile.
*/
publicstaticStringgetExtension(Filef){
Stringext=null;
Strings=f.getName();
inti=s.lastIndexOf('.');
if(i>0&&i<s.length()1){
ext=s.substring(i+1).toLowerCase();
}
returnext;
}
}

CustomizingtheFileView
IntheJavalookandfeel,thechooser'slistshowseachfile'snameanddisplaysasmalliconthatrepresentswhetherthefileisatruefileora
directory.YoucancustomizethisfileviewbycreatingacustomsubclassofFileViewandusinganinstanceoftheclassasanargumenttothe
setFileViewmethod.Theexampleusesaninstanceofacustomclass,implementedinImageFileView.java,asthefilechooser'sfileview.
fc.setFileView(newImageFileView());

TheImageFileViewclassshowsadifferenticonforeachtypeofimageacceptedbytheimagefilterdescribedpreviously.
TheImageFileViewclassoverridesthefiveabstractmethodsdefinedintheFileViewasfollows.
StringgetTypeDescription(Filef)
Returnsadescriptionofthefiletype.HereisImageFileView'simplementationofthismethod:
publicStringgetTypeDescription(Filef){
Stringextension=Utils.getExtension(f);
Stringtype=null;
if(extension!=null){
if(extension.equals(Utils.jpeg)||
extension.equals(Utils.jpg)){
type="JPEGImage";
}elseif(extension.equals(Utils.gif)){
type="GIFImage";
}elseif(extension.equals(Utils.tiff)||
extension.equals(Utils.tif)){
type="TIFFImage";
}elseif(extension.equals(Utils.png)){
type="PNGImage";
}
}
returntype;
}

IcongetIcon(Filef)
Returnsaniconrepresentingthefileoritstype.HereisImageFileView'simplementationofthismethod:
publicIcongetIcon(Filef){
Stringextension=Utils.getExtension(f);
Iconicon=null;
if(extension!=null){
if(extension.equals(Utils.jpeg)||
extension.equals(Utils.jpg)){
icon=jpgIcon;
}elseif(extension.equals(Utils.gif)){
icon=gifIcon;
}elseif(extension.equals(Utils.tiff)||
extension.equals(Utils.tif)){
icon=tiffIcon;
}elseif(extension.equals(Utils.png)){

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

5/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)
icon=pngIcon;
}
}
returnicon;
}

StringgetName(Filef)
Returnsthenameofthefile.Mostimplementationsofthismethodshouldreturnnulltoindicatethatthelookandfeelshouldfigureitout.
Anothercommonimplementationreturnsf.getName().
StringgetDescription(Filef)
Returnsadescriptionofthefile.Theintentistodescribeindividualfilesmorespecifically.Acommonimplementationofthismethodreturns
nulltoindicatethatthelookandfeelshouldfigureitout.
BooleanisTraversable(Filef)
Returnswhetheradirectoryistraversable.Mostimplementationsofthismethodshouldreturnnulltoindicatethatthelookandfeelshould
figureitout.Someapplicationsmightwanttopreventusersfromdescendingintoacertaintypeofdirectorybecauseitrepresentsacompound
document.TheisTraversablemethodshouldneverreturntrueforanondirectory.

ProvidinganAccessoryComponent
ThecustomizedfilechooserinFileChooserDemo2hasanaccessorycomponent.IfthecurrentlyselecteditemisaPNG,JPEG,TIFF,orGIF
image,theaccessorycomponentdisplaysathumbnailsketchoftheimage.Otherwise,theaccessorycomponentisempty.Asidefromapreviewer,
probablythemostcommonusefortheaccessorycomponentisapanelwithmorecontrolsonitsuchascheckboxesthattogglebetweenfeatures.
TheexamplecallsthesetAccessorymethodtoestablishaninstanceoftheImagePreviewclass,implementedinImagePreview.java,as
thechooser'saccessorycomponent:
fc.setAccessory(newImagePreview(fc));

AnyobjectthatinheritsfromtheJComponentclasscanbeanaccessorycomponent.Thecomponentshouldhaveapreferredsizethatlooksgoodin
thefilechooser.
Thefilechooserfiresapropertychangeeventwhentheuserselectsaniteminthelist.Aprogramwithanaccessorycomponentmustregisterto
receivetheseeventstoupdatetheaccessorycomponentwhenevertheselectionchanges.Intheexample,theImagePreviewobjectitselfregisters
fortheseevents.Thiskeepsallthecoderelatedtotheaccessorycomponenttogetherinoneclass.
Hereistheexample'simplementationofthepropertyChangemethod,whichisthemethodcalledwhenapropertychangeeventisfired:
//wheremembervariablesaredeclared
Filefile=null;
...
publicvoidpropertyChange(PropertyChangeEvente){
booleanupdate=false;
Stringprop=e.getPropertyName();
//Ifthedirectorychanged,don'tshowanimage.
if(JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)){
file=null;
update=true;
//Ifafilebecameselected,findoutwhichone.
}elseif(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)){
file=(File)e.getNewValue();
update=true;
}
//Updatethepreviewaccordingly.
if(update){
thumbnail=null;
if(isShowing()){
loadImage();
repaint();
}
}
}

IfSELECTED_FILE_CHANGED_PROPERTYisthepropertythatchanged,thismethodobtainsaFileobjectfromthefilechooser.TheloadImage
andrepaintmethodsusetheFileobjecttoloadtheimageandrepainttheaccessorycomponent.

TheFileChooserAPI
TheAPIforusingfilechoosersfallsintothesecategories:
CreatingandShowingtheFileChooser
SelectingFilesandDirectories

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

6/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)
NavigatingtheFileChooser'sList
CustomizingtheFileChooser
CreatingandShowingtheFileChooser

MethodorConstructor

Purpose

JFileChooser()
JFileChooser(File)
JFileChooser(String)

Createsafilechooserinstance.TheFileandStringarguments,whenpresent,providetheinitialdirectory.

int
showOpenDialog(Component)
Showsamodaldialogcontainingthefilechooser.ThesemethodsreturnAPPROVE_OPTIONiftheuserapprovedthe
int
operationandCANCEL_OPTIONiftheusercancelledit.AnotherpossiblereturnvalueisERROR_OPTION,which
showSaveDialog(Component)
meansanunanticipatederroroccurred.
intshowDialog(Component,
String)
SelectingFilesandDirectories
Method

Purpose

voidsetSelectedFile(File)
FilegetSelectedFile()

Setsorobtainsthecurrentlyselectedfileor(ifdirectoryselectionhasbeenenabled)directory.

voidsetSelectedFiles(File[])
File[]getSelectedFiles()

Setsorobtainsthecurrentlyselectedfilesifthefilechooserissettoallowmultipleselection.

voidsetFileSelectionMode(int)
voidgetFileSelectionMode()
boolean
isDirectorySelectionEnabled()
booleanisFileSelectionEnabled()

Setsorobtainsthefileselectionmode.AcceptablevaluesareFILES_ONLY(thedefault),
DIRECTORIES_ONLY,andFILES_AND_DIRECTORIES.
Interpretswhetherdirectoriesorfilesareselectableaccordingtothecurrentselectionmode.

void
setMultiSelectionEnabled(boolean) Setsorinterpretswhethermultiplefilescanbeselectedatonce.Bydefault,ausercanchooseonlyonefile.
booleanisMultiSelectionEnabled()
void
SetsorobtainswhethertheAcceptAllfilefilterisusedasanallowablechoiceinthechoosablefilterlistthe
setAcceptAllFileFilterUsed(boolean)
defaultvalueistrue.
booleanisAcceptAllFileFilterUsed()
DialogcreateDialog(Component)

Givenaparentcomponent,createsandreturnsanewdialogthatcontainsthisfilechooser,isdependentonthe
parent'sframe,andiscenteredovertheparent.
NavigatingtheFileChooser'sList

Method

Purpose

void
ensureFileIsVisible(File)

Scrollsthefilechooser'slistsuchthattheindicatedfileisvisible.

void
setCurrentDirectory(File)
FilegetCurrentDirectory()

Setsorobtainsthedirectorywhosefilesaredisplayedinthefilechooser'slist.

void
Changesthelisttodisplaythecurrentdirectory'sparent.
changeToParentDirectory()
void
rescanCurrentDirectory()

Checksthefilesystemandupdatesthechooser'slist.

void
Setsorobtainsthepropertythatdetermineswhetherautomaticdraghandlingisenabled.SeeDragandDropandData
setDragEnabled(boolean)
Transferformoredetails.
booleangetDragEnabled()
CustomizingtheFileChooser
Method

Purpose

void
setAccessory(javax.swing.JComponent) Setsorobtainsthefilechooser'saccessorycomponent.
JComponentgetAccessory()
voidsetFileFilter(FileFilter)
FileFiltergetFileFilter()

Setsorobtainsthefilechooser'sprimaryfilefilter.

voidsetFileView(FileView)
FileViewgetFileView()

Setsorobtainsthechooser'sfileview.

FileFilter[]getChoosableFileFilters()
voidaddChoosableFileFilter(FileFilter)
boolean
Sets,obtains,ormodifiesthelistofuserchoosablefilefilters.
removeChoosableFileFilter(FileFilter)
voidresetChoosableFileFilters()
FileFiltergetAcceptAllFileFilter()

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

7/8

5/25/2015

HowtoUseFileChoosers(TheJavaTutorials>CreatingaGUIWithJFC/Swing>UsingSwingComponents)

voidsetFileHidingEnabled(boolean)
booleanisFileHidingEnabled()

Setsorobtainswhetherhiddenfilesaredisplayed.

void
SetsorobtainsthepropertythatindicateswhethertheApproveandCancelbuttonsareshowninthefile
setControlButtonsAreShown(boolean)
chooser.Thispropertyistruebydefault.
booleangetControlButtonsAreShown()

ExamplesThatUseFileChoosers
Thistableshowstheexamplesthatusefilechoosersandpointstowherethoseexamplesaredescribed.
Example

WhereDescribed Notes

FileChooserDemo

Thissection

Displaysanopendialogandasavedialog.

FileChooserDemo2

Thissection

Usesafilechooserwithcustomfiltering,acustomfileview,andanaccessorycomponent.

JWSFileChooserDemo Thissection

UsestheJNLPAPItoopenandsavefiles.

Youruseofthispageandallthematerialonpagesunder"TheJavaTutorials"bannerissubjecttotheselegal
notices.
Copyright1995,2015Oracleand/oritsaffiliates.Allrightsreserved.

Problemswiththeexamples?TryCompilingandRunningtheExamples:
FAQs.
Complaints?Compliments?Suggestions?Giveusyourfeedback.

Previouspage:HowtoUseEditorPanesandTextPanes
Nextpage:HowtoUseFormattedTextFields

https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

8/8

S-ar putea să vă placă și