편집 기록

편집 기록
  • 프로필 알 수 없는 사용자님의 편집
    날짜2018.07.03

    머리를쥐어짜서 겨우해보았는데 메소드오류가납니다 도와주세요


    package glephic; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField;

    public class sums extends JFrame{ private static JTextField TF = new JTextField(20); private static JTextField TA = new JTextField(20); private JButton BT = new JButton("꾸욱");

    public sums(){
        setTitle("입력된 값의 1까지의 합");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container c = getContentPane();
        c.setLayout(new FlowLayout());
        c.add(new JLabel("입력후 버튼을누르세요"));
        c.add(TF);
        c.add(BT);
        c.add(TA);
        c.setBackground(Color.green);
    
        BT.addActionListener(new ActionListener(){
            public static int actionPerformed(ActionEvent e){ //<-여기에서 오류가납니다
                String from = TF.getText();
                int to = Integer.parseInt(from);
                if(to >=1){
                    return (to -1) * to;}
                else{
                    return to;
            }       
    
                from = Integer.toString(to);
                TA.setText(from);
                TF.setText("");
            }
        });
    
        setSize(250,250);
        setVisible(true);
    }
    
    public static void main(String[] args) {
        new sums();
        }
    }
    

    오류내용은 This static method cannot hide the instance method from ActionListener 이것 구글링해도 안나오는데 어찌하면 좋을까요.......ㅗㅜㅑ