不是抽象的,并且未覆盖 ,是什么错误??
import java.awt.*;import java.text.*;
import javax.swing.*;
import java.awt.event.*;
public class NianFen
{
public static void main(String args[])
{
NianFrame frame=new NianFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class NianFrame extends JFrame implements ActionListener
{
JTextField T1,T2;
JButton A;
JLabel a,b;
JPanel p;
public NianFrame()
{
setTitle("Nian Fen");
Container con=getContentPane();
con.setLayout(new BorderLayout());
a=new JLabel("input year:");
p=new JPanel();
p.setLayout(new GridLayout(5,1));
p.add(a);
T1=new JTextField(20);
p.add(T1);
b=new JLabel("result:");
p.add(b);
T2=new JTextField(20);
p.add(T2);
A=new JButton("Yes");
p.add(A);
con.add(p,BorderLayout.CENTER);
A.addActionListener(this);
setVisible(true);
setSize(200,200);
pack();
}
public void actionporformed(ActionEvent e)
{
double t;
try
{
t=Double.parseDouble(T1.getText());
}
catch ( NumberFormatException numberFormat )
{
JOptionPane.showMessageDialog( this,"Invalid Operand", "Invalid Number Format",
JOptionPane.ERROR_MESSAGE );
return;
}
if(e.getSource()==A)
{
if((t%400==0||(t%4==0&&t%100!=0)))
T2.setText("Yes");
else
T2.setText("No");
}
}
}
//就象是这个程序,是什么意思???
斑竹在吗??
----------------解决方案--------------------------------------------------------
这问题不用回答了,解决了
斑竹可以沉底了
!!~~~
----------------解决方案--------------------------------------------------------