0

I am 11 years old and I hope to do Java as a career, and I am making a Notepad like program in Java. Everything is functional except save and open button of the menu bar. Okay it works but I don't know the code for the save and open button. Can someone please give me the code (and actually explain it)

Noah Cagle
  • 146
  • 1
  • 4
  • 15
  • 1
    Read the file chooser tutorial: http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html – JB Nizet Jul 26 '13 at 05:43
  • @LuiggiMendoza While that certain provides an answer to part of their question, I'm not sure it answer all parts of the question - IMHO - Still a good link – MadProgrammer Jul 26 '13 at 05:45
  • 1
    It might seem harsh, but as a learner, we're going to encourage you to have a go first. When you get stuck on a particular problem, then ask a question, demonstrating what it is you have tried. This way we can guide you better. If you want to know why we do it this way, have a read of [What have you tried?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – MadProgrammer Jul 26 '13 at 05:47

2 Answers2

0

create a JFileChooser fc = new JFileChooser(); on open button click

This is already answered Please check this link

Community
  • 1
  • 1
Sanyam Goel
  • 2,138
  • 22
  • 40
0

First of all, take a look at JTextComponent#read and JTextComponent#write, which will save you a lot of work and time.

Next, take a look at How to use buttons and How to write action listeners and lastly, take a look at How to use file chooers

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366