|
-
Apr 5th, 2010, 04:08 AM
#1
Thread Starter
New Member
writing , reading , bar chart.
Hi guys,
I'm trying to make a program that is capable of writing certain data ( own input ) to a "yourname" file. ( only numbers). The next step is that i have to read it again and put it in a bar chart.
I'm already stuck with the first step, anyone has some suggestions ?
Thanks,
Tom
-
Apr 5th, 2010, 11:47 AM
#2
Thread Starter
New Member
Re: writing , reading , bar chart.
Ok,
I now have a button that puts all the numbers that i want to add in an array.
Does anyone know how to write this array to a file?
greets,
Tom
-
Apr 6th, 2010, 05:29 AM
#3
Thread Starter
New Member
Re: writing , reading , bar chart.
I can write data to a file with the following code:
Code:
class KnopHandler1 implements ActionListener
{
public void actionPerformed(ActionEvent a)
{
String settoernooi = tekstvak1.getText();
String setaanmeldingen = tekstvak2.getText();
Double setDoubleaanmeldingen = new Double (setaanmeldingen);
ArrayShuttle[count] = new Badminton(setDoubleaanmeldingen, settoernooi);
count++;
JOptionPane.showMessageDialog(null, "Toernooi Toegevoegd");
}
}
Following step is to write a file of this:
Code:
class KnopHandler2 implements ActionListener
{
public void actionPerformed(ActionEvent a)
{
try
{
BufferedWriter uit = new BufferedWriter(new FileWriter(tekstvak3.getText()));
for (int i = 0; i<count;i++)
{
uit.write("" + ArrayShuttle[i].gettoernooi());
uit.newLine();
uit.write("" + ArrayShuttle[i].getaanmeldingen());
uit.newLine();
}
uit.close();
}
catch( IOException d )
{
System.out.println("Fout bij maken");
d.printStackTrace();
}
tekstvak3.setText("");
When i search the file in my workspace folder it says on line 1 : null, and on line 2 : 0,0
suggestions anyone?
Tom
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|