public class load {
public static void main (String [] args) {
int Button_width = 65;
int Button_height = 25;
JLabel NameLabel = new JLabel ("Name:");
final JTextField Nametextfield = new JTextField(15);
JButton Savebutton = new JButton("Save");
Savebutton.setPreferredSize (new Dimension (Button_width, Button_height));
JButton Openbutton = new JButton("Open");
Openbutton.setPreferredSize (new Dimension (Button_width, Button_height));
class SaveButtonListener implements ActionListener {
public void actionPerformed (ActionEvent event) {
try {
FileWriter writer = new FileWriter ("data.txt");
PrintWriter out = new PrintWriter (writer);
I NEED HELP?
1) on the above code i can save wat i type in to file that was made (data.txt as seen above). How do i make it so that i can select where i want to save. How can i choose the name and location wen i click on save???
2) Another question is now wen i save, how do i now load the data???
public class load {
public static void main (String [] args) {
int Button_width = 65;
int Button_height = 25;
JLabel NameLabel = new JLabel ("Name:");
final JTextField Nametextfield = new JTextField(15);
JButton Savebutton = new JButton("Save");
Savebutton.setPreferredSize (new Dimension (Button_width, Button_height));
JButton Openbutton = new JButton("Open");
Openbutton.setPreferredSize (new Dimension (Button_width, Button_height));
class SaveButtonListener implements ActionListener {
public void actionPerformed (ActionEvent event) {
try {
FileWriter writer = new FileWriter ("data.txt");
PrintWriter out = new PrintWriter (writer);
I NEED HELP?
1) on the above code i can save wat i type in to file that was made (data.txt as seen above). How do i make it so that i can select where i want to save. How can i choose the name and location wen i click on save???
2) Another question is now wen i save, how do i now load the data???
Bookmarks