• Post Reply Bookmark Topic Watch Topic
  • New Topic

open button event  RSS feed

 
sheng zhong
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After i put a "open" button on the layout. And set a action listener. How can I add the event that open a window to choose the disc's file to open?
Must I write these code myself or there is some tool I can use? Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the actionListener:

JFileChooser fc = new JFileChooser(".");
fc.showOpenDialog([parent]);

more info
http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!