高手请入!有个小问题!
[code]
import javax.swing.*;
import java.awt.*;
import java.text.*;
import java.awt.event.*;
public class WageCalculator extends JFrame
{
private JLabel hourlyWageJLabel;
private JTextField hourlyWageJTextField;
private JLabel hoursWorkedJLabel;
private JTextField hoursWorkedJTextField;
private JLabel grossWagesJLabel;
private JTextField grossWagesJTextField;
private JButton calculateJButton;
double hourlyWage;
double hoursWorked;
double wages;
final double HOUR_LIMIT=40.0;
DecimalFormat dollars;
public WageCalculator()
{
createUserInterface();
}
public void createUserInterface()
{
Container contentPane=this.getContentPane();
contentPane.setLayout(null);
hourlyWageJLabel=new JLabel();
hourlyWageJLabel.setBounds(16,16,90,21);
hourlyWageJLabel.setText( "Hourly wage ");
contentPane.add(hourlyWageJLabel);
hourlyWageJTextField=new JTextField();
hourlyWageJTextField.setBounds(115,16,90,21);
hourlyWageJTextField.setHorizontalAlignment(JTextField.RIGHT);
contentPane.add(hourlyWageJTextField);
hourlyWageJTextField.addKeyListener(
new KeyAdapter()
{
public void keyPressed(KeyEvent Event)
{
hourlyWageJTextFieldKeyPressed(Event);
}
});
hoursWorkedJLabel=new JLabel();
hoursWorkedJLabel.setBounds(16,57,90,21);
hoursWorkedJLabel.setText( "Hours worked ");
contentPane.add(hoursWorkedJLabel);
hoursWorkedJTextField=new JTextField();
hoursWorkedJTextField.setBounds(115,57,90,21);
hoursWorkedJTextField.setHorizontalAlignment(JTextField.RIGHT);
contentPane.add(hoursWorkedJTextField);
hoursWorkedJTextField.addKeyListener(
new KeyAdapter()
{
public void KeyPressed(KeyEvent Event)