你是不是使用了TextField来实例化JTextField啊??JTextField不是继承自TextField的!!!而是
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
明白!!?
javax.swing.JTextField cannot be cast to java.awt.TextField
JTextField f=new JTextField (10);