Results 1 to 3 of 3
  1. #1
    bptsj is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default abstract error using implements

    I'm reading 'Teach yourself Java in 24hrs' and am trying to adapt some of the examples to a data logging program. I'm getting an error (compiling in Netbeans):

    A partial listing is below. The error is on the line defining the class DataLoggerEvent. The compiler says "labjack.DataLoggerEvent is not abstract and does not overide abstract method ItemStateChanged in java.awt.event.ItemListener"

    package labjack;
    * GUI Frame Event handler for Labjack data logger.
    * Sept. 3, 2011

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

    public class DataLoggerEvent implements java.awt.event.ItemListener, ActionListener, <==== error here
    Runnable {
    DataLogger gui;
    public DataLoggerEvent(DataLogger in){
    gui = in;
    Thank you for any help you can give; what does this error mean?


  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power


    You have declared your DataLoggerEvent class to implement ItemListener. But if you have a look at the javadocs for this interface you will see that the DataLoggerEvent class is supposed to implement an itemStateChanged() method. (That's the whole point of the ItemListener interface: it is a way of promising that you will implement this method.)


    It's not really clear why you would want an event (==thing that happens) to be a listener (==thing that responds to events).

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    Also, whenever seeking help with an error, copy and paste the full text of the error message here. This one's clear enough, but that's not always the case.


Similar Threads

  1. Replies: 4
    Last Post: 04-14-2011, 11:42 AM
  2. having error with implements.
    By hoangx87 in forum New To Java
    Replies: 9
    Last Post: 03-30-2011, 05:58 AM
  3. Replies: 4
    Last Post: 02-19-2011, 04:32 AM
  4. Replies: 3
    Last Post: 08-13-2010, 04:57 AM
  5. Replies: 6
    Last Post: 10-27-2008, 12:25 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