This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes erropr Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

erropr

jayaprakash Rengaswamy
Greenhorn

Joined: Nov 27, 2006
Posts: 9
pls. find below the coding and error follows
============================================

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

public class App2 implements ActionListener
{
Container con;
JFrame f1;
JLabel l1, l2;
JTextField t1, t2;
JButton b1, b2;

App2()
{
f1 = new JFrame();
con = f1.getContentPane();
con.setDetault(null);
l1 = new JLabel ("Name : ");
l2 = new JLabel ("Age : ");

t1 = new JTextField(10);
t2 = new JTextField(5);

b1 = new JButton ("Ok");
b2 = new JButton ("Cancel");
b1.AddListener(this);
b2.AddListener(this);

l1.setBounds (30,30,150,30);
l2.setBounds (30,70,150,30);

t1.setBounds (200,30,150,30);
t2.setBounds (200,70,150,30);


b1.setBounds (400,270,150,30);
b2.setBounds (400,310,150,30);

con.add(l1);
con.add(l2);
con.add(t1);
con.add(t2);
con.add(b1);
con.add(b2);

f1.setVisible (true);
f1.setSize (700,700);
f1.setLocation (20,20);

}
public void actionperformed (ActionEvent ae)
{
if (ae.getSource() == b1)
{
System.out.print("Ok");
}
if (ae.getSource() == b2)
{
System.out.print("Cancel");
}
}
public static void main (String args[])
{
new App2();
}
}

ERROR
======

App2.java:6: App2 is not abstract and does not override abstract met
rformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Howdy, ranchers,

In your posting there is missing something in the error report.
You should show some more effort when posting some code. At least, if you copy and paste, do it completely.

Nevertheless: your class implements ActionListener, but doesn't have a method


For your indentations (tabs and spacing at the beginning of a line) to be displayed properly on the ranch, use the
- button before you post.

There are some more errors in your code.

Yours,
Bu.


all events occur in real time
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
You need to implement the method actionPerformed(ActionEvent e) because you state that you implement the interface ActionListener.

In your code you implement the method actionperformed. So change the p into a P


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Please don't post the same question in multiple forums. It creates duplicate conversations and wastes the time of the people trying to help you.

Thanks,
Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: erropr
 
Similar Threads
JDBC - Applet - Swing
Getting sql error [Microsoft ][odbc microsoft access driver]numeric index out of range
Calculator Problem
why its not running or how to run it
How to add components to JFrame after coloring the JFrame