Results 1 to 3 of 3
  1. #1
    DaBananaboat is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default Need some help with ActionListener error

    Hey there, I'm a bit newb when it comes to this so I'll ask you guys.

    Every time I'm busy with my home course Java, I get the same ActionListener error. I really don't understand what it means.

    Here is the error:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: 
    	The type EtiketPaneel must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
    
    	at H024.EtiketPaneel.actionPerformed(EtiketPaneel.java:6)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    And here is the coding where the error occurs:
    Java Code:
    package H024;
    
    import javax.swing.*;
    import java.awt.event.*;
    
    public class EtiketPaneel extends JPanel implements ActionListener
    {
    	private JTextField LabelAmount;
    	private JTextField PaperAmount;
    	private JButton CalculateButton;
    	private JTextArea ResultField;
    	
    	public EtiketPaneel()
    	{
    		CalculateButton = new JButton("Calculate");
    		CalculateButton.addActionListener(this);
    		
    		LabelAmount = new JTextField("", 8);
    		PaperAmount = new JTextField("", 8);
    		
    		ResultField = new JTextArea(6, 25);
    		
    		add(new JLabel("How many labels would you like to print?"));
    		add(LabelAmount);
    		
    		add(new JLabel("How many labels per paper?"));
    		add(PaperAmount);
    		
    		add(CalculateButton);
    		add(ResultField);
    	}
    	
    	public void ShowResult(int LabelAmount, int PaperAmount)
    	{
    		int PaperNeeded = ((LabelAmount - 1) / PaperAmount + 1);
    		int Remaining = PaperNeeded * PaperAmount - LabelAmount;
    		String Result = "Amount of paper needed: " + PaperNeeded + "\n" + "Unprinted labels: " + Remaining;
    		ResultField.setText(Result);
    	}
    	
    	public void actionPreformed(ActionEvent e)
    	{
    		int Label = Integer.parseInt(LabelAmount.getText());
    		int Paper = Integer.parseInt(PaperAmount.getText());
    		ShowResult(Label, Paper);
    		
    	}
    }
    I hope you guys can help me on this.

    Thanks in advance, DaBananaboat.

  2. #2
    Join Date
    May 2011
    Location
    Munich
    Posts
    15
    Rep Power
    0

    Default

    try spelling actionPreformed right. (actionPerformed!)

  3. #3
    DaBananaboat is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default

    Aww shit lol you're kidding!
    Stupid typo.

    Thanks for the quick response. :P

Similar Threads

  1. ActionListener NOT working
    By zed420 in forum New To Java
    Replies: 3
    Last Post: 12-20-2009, 04:40 PM
  2. exception error in a ActionListener class
    By aserothbw in forum AWT / Swing
    Replies: 3
    Last Post: 09-22-2009, 01:59 PM
  3. exception error in a ActionListener class
    By aserothbw in forum AWT / Swing
    Replies: 6
    Last Post: 09-04-2009, 04:07 PM
  4. exception error in actionlistener
    By aserothbw in forum AWT / Swing
    Replies: 1
    Last Post: 09-01-2009, 12:24 AM
  5. ActionListener Error
    By blackstormattack in forum New To Java
    Replies: 1
    Last Post: 03-05-2009, 09:36 AM

Posting Permissions

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