View Single Post
  #1 (permalink)  
Old 07-06-2009, 04:32 PM
Tucan Tucan is offline
Member
 
Join Date: Jul 2009
Location: Rotterdam
Posts: 8
Rep Power: 0
Tucan is on a distinguished road
Send a message via Yahoo to Tucan
Unhappy class problen with java Applet
On complilation I am givven: JDemoCteateGraphicsObject3 is not abstract and does not override abstract method actionPreformed (java.awt.event.ActionEvent) in java.awt.event.ActionListener.

Code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class JDemoCreateGraphicsObject3 extends JApplet implements ActionListener
{
String companyName = new String("Event Handlers Incorperated ");
JButton moveButton = new JButton("Move it ");
Font helv12Font = new Font("Helvetica ", Font.ITALIC, 12);
int x = 10, y = 50;

public void init ()
{
setBackground(Color.YELLOW);
Container con = getContentPane();
con.setLayout(new FlowLayout() );
con.add(moveButton);
moveButton.addActionListener(this);
}
public void ActionerPerformed(ActionEvent e)
{
Object source = e.getSource();
if (source == moveButton)
{
Graphics pen = getGraphics();
pen.setFont(helv12Font);
pen.setColor(Color.MAGENTA);
if(x <250)
pen.drawString(companyName, x +=20, y += 20);
else
moveButton.setEnabled(false);
pen.setColor(Color.BLACK);
pen.drawOval(50, 170, 70, 70);
pen.drawLine(85, 240, 110, 300);
pen.drawOval(100, 170, 70, 70);

}//end if
}//end actionPreformed()
}//end JDemoCreateGraphicsObject class
Reply With Quote