日期:2014-05-20  浏览次数:20863 次

请问cannot resolve symbol的一个问题
import   java.awt.*;
import   java.awt.event.*;
import   javax.swing.*;
import   ch08.Time3;

public   class   TimeTest5   extends   JApplet   implements   ActionListener{

private   Time3   time;
private   JLabel   hourLabel,   minuteLabel,   secondLabel;
private   JTextArea   hourField,   minuteField,   secondField,   displayField;
private   JButton   tickButton;

public   void   init()
{
time   =   new   Time3();

Container   container   =   getContenPane();
container.setLayout(   new   FlowLayout()   );

hourLabel   =   new   JLabel(   "Set   Hour "   );
hourField   =   new   JTextArea(   10   );
hourField.addActionListener(   this   );
container.add(   hourLabel   );
container.add(   hourField   );

minuteLabel   =   new   JLabel(   "Set   minute "   );
minuteField   =   new   JTextArea(   10   );
minuteField.addActionListener(   this   );
container.add(   minuteLabel   );
container.add(   minuteField   );

secondLabel   =   new   JLabel(   "Set   second "   );
secondField   =   new   JTextArea(   10   );
secondField.addActionListener(   this   );
container.add(   secondLabel   );
container.add(   secondField   );

displayField   =   new   JTextArea(   30   );
displayField.setEditable(   false   );
container.add(   displayField   );

tickButton   =   new   JButton(   "Add   1   to   second "   );
tickButton.addActionListener(   this   );
container.add(   tickButton   );

updateDisplay();
}

public   void   actionPerformed(   ActionEvent   actionEvent   )
{
if   (   actionEvent.getSource()   ==   tickButton   )
tick();
else   if   (   actionEvent.getSource()   ==   hourField   )
{
time.setHour(   Integer.parseInt(   actionEvent.getActionCommand()   )   );
hourField.setText(   " "   );
}
else   if   (   actionEvent.getSource()   ==   minuteField   )
{
time.setMinute(   Integer.parseInt(   actionEvent.getActionCommand()   )   );
minuteField.setText(   " "   );
}
else   if   (   actionEvent.getSource()   ==   secondField   )
{
time.setSecond(   Integer.parseInt(   actionEvent.getActionCommand()   )   );
secondField.setText(   " "   );
}
updateDisplay();  
}

public   void   updateDisplay()
{
displayField.setText(   "Hour: "   +   time.getHour()   +  
";   Minute:   "   +   time.getMinute()   +  
";   Second:   "   +   time.getSecond()   );

showStatus(   "Standard   time   is:   "   +   time.toString()   +
";   Universal   time   is:   "   +   time.toUniversalString()   );