Results 1 to 2 of 2
  1. #1
    xander5511 is offline Member
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Exclamation ActionListener Applet problem

    I am having a problem getting a applet to work. The applet is supposed to increse the text size of a string that the user types in the text box every time a Button is clicked. The error i keep gettning is:
    "ClickMe is not abstract and does not override abstract method actionPerformed (java.awt.event.ActionEvent) in java.awt.event.ActionListener."

    I am fairly new at this so i have no idea what its saying the problem is. Im not really sure where the problem is in the code so ill just put up the whole darn thing. If you see anything that i have done wrong please let me know i would really appreciate it. Thank You!

    Java Code:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ClickMe extends Applet implements ActionListener
    {
    	Label nameLable= new Label("enter your name");
    	Label display =  new Label();
    	TextField nameText= new TextField(25);
    	Button clickMe = new Button("Click Me!");
    	int fontSize= 10;
    	public void init()
    	{
    		add(nameLable);
    		add(nameText);
    		add(clickMe);
    		clickMe.addActionListener(this);
    	}
    	public void paint(Graphics g)
    	{
    		setBackground(Color.black);
    	}
    	
    	public void actionPreformed(ActionEvent e)
    	{
    		Font myfont= new Font("arial", Font.BOLD, fontSize);
    		fontSize++;
    		String name= nameText.getText();
    		display.setText(name);
    		add(display);
    		invalidate();
    		validate();
    	}
    			
    }

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

Similar Threads

  1. Java actionlistener help
    By justsomeguy in forum AWT / Swing
    Replies: 1
    Last Post: 05-27-2008, 05:42 AM
  2. Demonstrating the ActionListener
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 04-23-2008, 08:20 PM
  3. How to use KeyListener and ActionListener
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 04-23-2008, 08:19 PM
  4. ActionListener interface
    By tsantana in forum New To Java
    Replies: 2
    Last Post: 03-30-2008, 10:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •