I hava my program working, but it will not display in the JTextArea of the GUI. I believe that I am missing a line of code. However for the life of me I just cannot figure it out. Please Help.
Here is my code:

Thank you for the help!!!

package my.tutoringreport;

import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

/**
 *
 * @author Ravenhawk
 */
public class TutoringReportUI extends javax.swing.JFrame {
        
        Double[][] timeWage;
        int timeWageIndex = 0;
        double minimumWage = 6.55;

    /** Creates new form TutoringReportUI */
    public TutoringReportUI() {
       	timeWage = new Double[3][2];
         final int ROWS = 10;
         final int COLUMNS = 30;
	
        initComponents();    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
  
                        
// TODO add your handling code here:
        double time = 0;
        double wage = 0;
        try {time = Double.parseDouble(jTextField1.getText());
		  } catch (NumberFormatException e1) {
	  JOptionPane.showMessageDialog(null, "The time must be a decimal  
                       number", "Invalid Input",JOptionPane.ERROR_MESSAGE);
			  }

        try {wage = Double.parseDouble(jTextField2.getText());
		  } catch (NumberFormatException e1) {
	  JOptionPane.showMessageDialog(null, "The wage must be a decimal 
                       number", "Invalid Input",JOptionPane.ERROR_MESSAGE);
			  }

        if(time<=0 || time>240){
	  JOptionPane.showMessageDialog(null, "The time must greater than 0 and 
                       less than or equal to 4 hours (240 min)",
		      "Invalid Input",JOptionPane.ERROR_MESSAGE);
			  }
        else{
        // proceed
       if(wage<=0){JOptionPane.showMessageDialog(null, "The wage must greater than 0",
       "Invalid Input",JOptionPane.ERROR_MESSAGE);
				  }
	else{
	// proceed
	timeWage[timeWageIndex][0] = time;
	timeWage[timeWageIndex][1] = wage;
	timeWageIndex++; // increase index for next time
 
         jTextField1.setText("");
         jTextField2.setText("");                         
    }
        }
    
    }                                        

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // TODO add your handling code here:


			
   String newline = "\n";
   double timeTotal = 0;
   double wageTotal = 0;

  // for each entry...
  for(int i = 0; i<=timeWageIndex-1; i++){
  double time = timeWage[i][0];
  double wage = timeWage[i][1];
  timeTotal += time;
  wageTotal += wage;

  System.out.print("Minutes: " + time + "    Earnings: $" + wage + newline);
			  }
  DecimalFormat df = new DecimalFormat("#.##");
  double average = wageTotal / (timeTotal/60);
  System.out.print(newline + newline + "*****************************" + newline + 
      newline + newline);
  System.out.print("Report of wages to date:" + newline + newline);
  System.out.print("Total time spent tutoring: " + timeTotal + newline);
  System.out.print("Total earnings: $" + wageTotal + newline);
  System.out.print("Average per hour wage: $" + (average) + newline + newline);
  System.out.print("Minimum wage is currently: $" + minimumWage + newline);

  if(average<minimumWage)
     System.out.println("Your average wages are less than average");

  else if(average>minimumWage && average < minimumWage*2.0)
	         System.out.print("Your average wages are average");

  else if(average >= minimumWage*2.0)
         System.out.print("Your average wages are above average");

}                                        



private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // TODO add your handling code here:

  System.exit(0);





}                                        

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TutoringReportUI().setVisible(true);
            }
        });
    }

Recommended Answers

All 2 Replies

when doing

System.out.println();

its not supposed to put it in a text area if thats your thinking

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.