| Author |
I need to have my program take information from text file Plus my pie chart is in wrong place
|
laurie Watson
Greenhorn
Joined: Jun 23, 2011
Posts: 5
|
|
This is my last class and I am confused i really need a good grade to pass the class I need it to reaad a file then show a pie chart heres the first part of the code i will also include my piechart code and text file thanks for your help its due tonight
the pie chart code
it won't allow me to post a txt document here but is not reading my text document and my pie chart sets on top of my readout how do I move it
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
Welcome to the Ranch.
Did you write all that code yourself? What exactly is your question about it? It's a lot of code to look through. If you have a specific problem with it, then explain, preferrably with a short piece of code, what you don't understand.
Also, please use a meaningful title for your posts instead of something like "Please help".
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
laurie Watson
Greenhorn
Joined: Jun 23, 2011
Posts: 5
|
|
I'm not sure where the problem is it is not reading my external file.
I think the problem may be here but I am not sure
String line;
BufferedReader br = new BufferedReader(new FileReader("loanterms.txt"));
while ((line = br.readLine()) != null) { standardTerms.add(line);
termList.addItem(line);
}
br.close();
int numberOfLoans = standardTerms.size();
//allocate the arrays
rates = new String[numberOfLoans];
years = new String[numberOfLoans];
String [] temp;
for (int index = 0; index < numberOfLoans; index ++)
{
temp = standardTerms.get(index).split(",");
years[index] = temp[0];
rates[index] = temp[1];
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
I also do not know how to position my pie chart so it is not on top of the rest of the readout thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
Jesper de Jong wrote: . . . It's a lot of code to look through. . . .
It's even worse with the double-spacing, which I have got rid of; that makes it harder to read.
Why have you got so many fields in your classes? Most of those buttons and components could be local variables in your constructor.
Also, I think this thread would sit better in our GUIs forum, so I shall move it.
|
 |
laurie Watson
Greenhorn
Joined: Jun 23, 2011
Posts: 5
|
|
okay I got it to read my text file but it won't calculate from those choices i will calculate the data i input still have the piechart problem.
I think this is the code you need
calculate.addActionListener(new ActionListener() {
I think it has to some how be tied into the combo box but I am not sure how
|
 |
 |
|
|
subject: I need to have my program take information from text file Plus my pie chart is in wrong place
|
|
|