import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Absolute extends JFrame implements ActionListener //Error: Absolute is not abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener

{
public JTextField textField1,textField2,textField3;
public JLabel label1;
    String Operatn[] = {"Add","Mult","Divide","Sub"};
    
    //Constructor
public Absolute()
{
    JFrame frame = new JFrame();
    frame.setLayout(null);
    
    JLabel label1 = new JLabel ("First Number:");
    label1.setBounds(20,25,100,20);
    label1.setForeground(Color.BLUE);
    
    JLabel label2 = new JLabel ("Second Number:");
    label2.setBounds(20,65,100,20);
    label2.setForeground(Color.BLUE);
    
    JLabel label3 = new JLabel ("Operator");
    label3.setBounds(20,105,100,20);
    label3.setForeground(Color.RED);
        
    JComboBox compBox = new JComboBox(Operatn);
    compBox.setBounds(124,105,100,20);
    
    JLabel label4 = new JLabel ("TOTAL :");
    label4.setBounds(20,200,100,20);
    label4.setForeground(Color.BLACK);
    
    JTextField textField1 = new JTextField();
    textField1.setBounds(124,25,100,20);
    textField1.setBackground(Color.YELLOW);
    
    JTextField textField2 = new JTextField();
    textField2.setBounds(124,65,100,20);
    textField2.setBackground(Color.YELLOW);
    
    JTextField textField3 = new JTextField();
    textField3.setBounds(124,200,100,20);
    textField3.setBackground(Color.YELLOW);
    
    JButton ok = new JButton("Calculate");
   ok.addActionListener(this);
   ok.setBounds(50, 150, 90, 25);
   
   JButton close = new JButton ("Close");
   close.setBounds(150, 150, 80, 25);
   
   frame.add(ok);
   frame.add(close);
   frame.add(label1);
   frame.add(label2);
   frame.add(label3);
   frame.add(compBox);
   frame.add(label4);
   frame.add(textField1);
   frame.add(textField2);
   frame.add(textField3);
   
   frame.setSize(400, 350);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setVisible(true);
                 }
    
  public void ActionPerformed(ActionEvent e)
    {
      try
      {
        String num1 = textField1.getText();
        String num2 = textField2.getText();
        
        int number1 = Integer.parseInt(num1);
        int number2 = Integer.parseInt(num2);
        
        int Total = number1 + number2;
        
        String dispTotal = Integer.toString(Total);
      }
      catch(Exception exp)
      {
        textField3.setText("Error");
      }
    
    }
}

this is the main method

import javax.swing.JFrame;
import java.awt.*;

public class main_method
  {
  
  public static void main(String[] args)
  {
    JFrame frame = new JFrame();   
    frame.add(new Absolute());
    
  }
}

1. Exactly what is the real text of the error message, including line numbers?
2. Why do you have three JFrames (one created in main, one created in the constructor, and one instance of Absolute which is itself a JFrame)?

implements ActionListener //Error: Absolute is not abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener

The text of the error message describes the problem.

Remember that java is case sensitive. Check your spelling.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.