problem with printing to text area
I have created a gui which is supposed to print calculations in a text area, however nothing prints when I hit the run report button.
This is the snippet of code I am using. I am very new to java and to programming, so any help would be appreciated.
[code]
int columns = 2;
int rows = earnings.length;
double totalTime = 0.00;
double totalPayment = 0.00;
double averageWages =0.00;
double minWage =7.00;
String report = new String();
for (int j=0;j<columns;j++){
for(int i=0;i<rows;i++){
if (j==0){
totalTime+= earnings[i][j];
}
else if(j==1){
totalPayment+= earnings[i][j];
}
}
}
jTextArea1.append("\n\n");
jTextArea1.append("Report of your wages to Date\n\n");
jTextArea1.append("\n");
if (earnings.length>0){
averageWages = totalPayment/(totalTime/60);
}
//Displays in text area
jTextArea1.append("Average Per Hour Wage $ " + averageWages + "\n");
jTextArea1.append("\n\n");
jTextArea1.append("Minimum Wage is currently $6.55");
jTextArea1.append("\n\n");
if(averageWages<minWage){
jTextArea1.append("Your average wages per hour are below Average");
}else if(averageWages>=minWage && averageWages<=minWage * 2.00){
jTextArea1.append("Your average wages per hour are average");
}else if(averageWages > minWage * 2.00){
jTextArea1.append("Your average wages per hour are above Average");
}
jTextArea1.append("Total Minutes Spent Tutoring = " +totalTime + "\n");
jTextArea1.append("Total Earnings = $ " +totalPayment+ "\n");
//calculates average per hour wage
jTextArea1.append(report);
}
[code]
Re: problem with printing to text area
Is any of the code you have posted executing? Add some printlns that will show if the code is being executed.
All the calls to append() are inside of if tests. Are any of the if tests true?
Add some printlns to show the values of the variables that control the if statement.
Please Edit your post and wrap your code with[code=java]<YOUR CODE HERE>[/code] to get highlighting
Re: problem with printing to text area
Re: problem with printing to text area
Yes, I posted both topics. Wasn't sure if they were the same thing or different problems.
Re: problem with printing to text area
What about the questions I asked in post#2?