473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Abstract error

44
hi get this error
[HTML]C:\Aprac\TableInsert.java:4: TableInsert is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class TableInsert implements ActionListener
^
1 error[/HTML]

when i compile this code
Expand|Select|Wrap|Line Numbers
  1. import java.sql.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4.  
  5. public class TableInsert implements ActionListener
  6. {
  7.  
  8.     Frame f;
  9.     TextField tf1,tf2,tf3;
  10.     Button b;
  11.     Statement s;
  12.     Connection c;
  13.  
  14.     public    TableInsert()
  15.     {
  16.         try
  17.         {
  18.  
  19.             tf1=new    TextField(10);
  20.             tf2=new TextField (10);
  21.             tf3=new TextField (10);            
  22.             b=new Button("Insert");
  23.  
  24.             f.add(b);
  25.             f.add(tf1);
  26.             f.add(tf2);
  27.             f.add(tf3);
  28.  
  29.             f.setLayout (new FlowLayout());
  30.  
  31.  
  32.             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  33.             c=DriverManager.getConnection("jdbc:odbc:mak");
  34.             s=c.createStatement();
  35.  
  36.             f.setSize(400,400);
  37.             f.setVisible(true);
  38.         }
  39.         catch(Exception e)
  40.         {
  41.             e.printStackTrace();
  42.         }
  43.     }
  44.  
  45.     public void ActionPerformed(ActionEvent ae)
  46.     {
  47.  
  48.             if    (ae.getSource()==b)
  49.             {
  50.             String s1=tf1.getText();
  51.             String s2=tf2.getText();
  52.             String s3=tf3.getText();
  53.                 int a=Integer.parseInt(s1);
  54.                 try
  55.                 {
  56.                 s.execute("insert into student vlaues("+a+",'"+s2+"','"+s3+"')");
  57.                 System.out.println("Inserted");
  58.                 }
  59.                 catch(Exception e)
  60.                 {
  61.                     e.printStackTrace();
  62.                 }    
  63.             }
  64.     }
  65.     public static void main (String[] args) 
  66.     {
  67.         TableInsert x=new TableInsert();
  68.  
  69.     }
  70. }
please suggest proper reason for this
thank in advance
Aug 3 '07 #1
2 1400
blazedaces
284 100+
Java is case sensitive, and it's telling you that it doesn't know what to do with action commands because you didn't make a method called actionPerformed you made one called ActionPerformed.

Try changing the upper case A to a lower case a.

I hope that fixed your problem. Good luck,
-blazed
Aug 3 '07 #2
praveen2gupta
201 100+
Hi
after first try block use following code
tf1=new TextField(10);
tf1.addActionListener(this);
tf2=new TextField(10);
tf2.addActionListener(this);
tf3=new TextField(10);
tf3.addActionListener(this);

you have not used addActionListener with the text box.
Aug 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Rob Long | last post by:
Hey I've noticed a somewhat annoying feature in PHP5 when it comes to extended classes and types. If I declare an interface and a class that implements it, I get a "compile" error (read parse...
17
by: Medi Montaseri | last post by:
Hi, Given a collection of similar but not exact entities (or products) Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern to provide a common interface to these products....
8
by: Claire | last post by:
I have a base abstract class A which contains several abstract functions I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions Finally I...
6
by: Dan Sikorsky | last post by:
If we were to define all abstract methods in an abstract class, thereby making that class non-abstract, and then override the heretofore 'abstract' methods in a derived class, wouldn't that remove...
2
by: Carlos Lozano | last post by:
Hi, I have an OCX I need to use in an implementation and always gets a protection level error saying: I get an error message saying: OCXReference.InterfaceClass is inaccessible due to its...
2
by: Fergal Moran | last post by:
Hello Guys I'm a C++ programmer moving to C# and I'm trying to do something which I regularly do in C++ and am wondering why it doesn't work in C#. Basically in C++ I can do something similar...
9
by: silversurfer2025 | last post by:
Hello everyone, I am currently having problems with a C++ abstract class. I have a class FrameWork.h which defines some methods (of which some are abstract, i.e. virtual void method() = 0). In...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
52
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
17
by: Jess | last post by:
Hello, If I have a class that has virtual but non-pure declarations, like class A{ virtual void f(); }; Then is A still an abstract class? Do I have to have "virtual void f() = 0;"...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.