Results 1 to 2 of 2
Thread: Saving a File
- 08-17-2011, 05:31 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 8
- Rep Power
- 0
Saving a File
Hi guys/girls..
I have been writing code for my program to save a Linked List into a text file.
Here are the errors I am getting..
E:\Property Manager\PropertyManager.java:203: cannot find symbol
symbol : method getPropertyNumber()
location: class Property
PropertyNumber = p.getPropertyNumber();
^
E:\Property Manager\PropertyManager.java:204: cannot find symbol
symbol : method getStatus()
location: class Property
Status = p.getStatus();
^
E:\Property Manager\PropertyManager.java:205: cannot find symbol
symbol : method getPropertyOwner()
location: class Property
PropertyOwner = p.getPropertyOwner();
^
E:\Property Manager\PropertyManager.java:206: cannot find symbol
symbol : method getDate()
location: class Property
date = p.getDate();
^
E:\Property Manager\PropertyManager.java:207: cannot find symbol
symbol : method getAddress()
location: class Property
Address = p.getAddress();
^
5 errors
Tool completed with exit code 1
and here so my code so far..
Here is my Code for my button called Save Property.
My Linked List is called propList.
I have a separate Java file called Property.java
Java Code:// Save Property Button button5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { PrintWriter out = new PrintWriter(new FileWriter("Property.txt")); int PropertyNumber = 0; String Status = ""; String PropertyOwner = ""; String date = ""; String Address = ""; for (int i = 0; i < propList.size(); i++) { Property p = propList.get(i); PropertyNumber = p.getPropertyNumber(); Status = p.getStatus(); PropertyOwner = p.getPropertyOwner(); date = p.getDate(); Address = p.getAddress(); out.println(PropertyNumber + "," + Status + "," + PropertyOwner + "," + date + "," + Address); } out.close(); JOptionPane.showMessageDialog(null,"Data saved successfully!","", JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { System.out.println("Save file failed"); } } });
Is anyone able to tell me on why these variables cannot be found? I have searched through my code and am not sure as to why the program cannot find them. The variables are declared in the button. It is saying it can't find the get() method.
How could I go about fixing this?
Please any help would be appreciated!
Thanks Casey
- 08-17-2011, 05:40 AM #2
The Property class does not have a method called getPropertyNumber()
The Property class does not have a method called getStatus()E:\Property Manager\PropertyManager.java:204: cannot find symbol
symbol : method getStatus()
location: class Property
etc
The error messages are self-evident. You need to learn how to read the messages you get, what they mean and how to fix them. Nobody will hold your hand forever.
Similar Threads
-
Saving JTextArea as a txt file
By chirag123 in forum AWT / SwingReplies: 4Last Post: 04-28-2011, 04:39 PM -
NEW to writing/saving to a file
By hayden06f4i in forum New To JavaReplies: 28Last Post: 12-06-2010, 03:23 AM -
Saving a file in a gui
By rav in forum AWT / SwingReplies: 9Last Post: 07-07-2010, 05:27 PM -
Sending a File from Server to Client and saving the file to Clients computer
By al_Marshy_1981 in forum NetworkingReplies: 8Last Post: 02-18-2010, 12:54 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks