error in these two(addActionListener) in Main class line 36,37import javax.swing.JTextField; public class code { String new_code1 = ""; String new_code2 = ""; char[] alphabet; final int NUM_ALPHA; public void init(String new_code1, String new_code2) { this.new_code1=new_code1; this.new_code2=new_code2; } public code() { char a = 122; NUM_ALPHA = 26; alphabet=new char[NUM_ALPHA]; for(int i1=0; i1<NUM_ALPHA; i1++) { alphabet[i1]= a--; } } public void code_make(JTextField textField1) { String textField11 = textField1.getText(); for(int i = 0; i < textField11.length(); i++) { char ch = textField11.charAt(i); int index = ch - 97; if(index < 0) { new_code1 += ch; } else if (index > 25) { new_code1 += ch; } else { char new_ch = alphabet[index]; new_code1 += new_ch; } } } public void code_make_result_show(JTextField textField3) { textField3.setText(new_code1); } public void code_solve(JTextField textField2) { String textField22 = textField2.getText(); for(int i = 0; i < textField22.length();i++) { char ch = textField22.charAt(i); int index = ch - 97; if(index < 0) { new_code2 += ch; } else if (index > 25) { new_code2 += ch; } else { char new_ch = alphabet[index]; new_code2 += new_ch; } } } public void code_solve_result_show(JTextField textField4) { textField4.setText(new_code2); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; public abstract class Main implements ActionListener { static code code=new code(); public static void main(String[] args) { while(true) { code.init("",""); JFrame make =new JFrame("암호화"); //ignore "암호화" (it is Korean) JFrame solve =new JFrame("암호해석"); //ignore "암호해석" (it is Korean) JButton btn1 = new JButton("make!"); JButton btn2 = new JButton("make!"); JTextField TextField1 = new JTextField(); JTextField TextField2 = new JTextField(); JTextField TextField3 = new JTextField(); JTextField TextField4 = new JTextField(); make.setBounds(120, 120, 300, 150); solve.setBounds(420, 120, 300, 150); make.setLayout(new GridLayout(2,3)); solve.setLayout(new GridLayout(2,3)); make.add(new JLabel("sentance:")); make.add(TextField1); make.add(btn1); make.add(new JLabel("code:")); make.add(TextField3); solve.add(new JLabel("code:")); solve.add(TextField2); solve.add(btn2); solve.add(new JLabel("sentance:")); solve.add(TextField4); btn1.addActionListener(code.code_make(TextField1), code.code_make_result_show(TextField3)); btn2.addActionListener(code.code_solve(TextField2), code.code_solve_result_show(TextField4)); make.setVisible(true); solve.setVisible(true); } } }
"The method addActionListener(ActionListener) in the type AbstractButton is not applicable for the
arguments (void, void)"