• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NOT Abstract ERROR

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Clock/JFrameTime.java [19:1] Clock.JFrameTime is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class JFrameTime extends javax.swing.JFrame implements ActionListener, ItemListener, Observer
^
1 error
I'm getting this error in a boundry class that the Sun One IDE generated for me to create a JFrame for a clock. I cant' seem to find this error anywhere on the web and it's really stumping me.
Hopefully someone out there has seen something like this before.
Rick Katka
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are actually implementing the ActionListener interface which has "action Performed(java.awt.event.ActionEvent)" declared in it.
And when we implement any interface we will have to define the methods declared in that interface otherwise we have to declare our class as abstract.
So you will have to implement that method.
 
Rick Katka
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the code :
It seems like there already is an action Performed method for the jButton1 which is the submit button. And it has an actionListener so it's confusing me right now.
//Boundry Class
/*
* JFrame.java
*
* Created on April 19, 2004, 8:03 PM
*/
package Clock;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/**
*
* @author Rick Katka
*/
public class JFrameTime extends javax.swing.JFrame implements ActionListener, ItemListener, Observer
{
private MyTime myTime; //reference to mytime
private JFrameTime jfTime; //reference to jframeTime
/** Creates new form JFrame */
public JFrameTime()
{
initComponents();
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
getContentPane().setLayout(new java.awt.GridLayout(1, 0));
setTitle("Clock");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel1.setText("Hours:");
getContentPane().add(jLabel1);
jTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField1.setText("1");
getContentPane().add(jTextField1);
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel2.setText("Minutes:");
getContentPane().add(jLabel2);
jTextField2.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField2.setText("0");
getContentPane().add(jTextField2);
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel3.setText("Seconds:");
getContentPane().add(jLabel3);
jTextField3.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jTextField3.setText("0");
getContentPane().add(jTextField3);
jButton1.setText("SUBMIT");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("12:00:00");
getContentPane().add(jLabel4);
pack();
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
//submit button-->triggers to setTime and possibly to beging incrementing the time
myTime.setHour(Integer.parseInt(jfTime.jTextField1.getText() ) ); //setsHour by getting whats in the textfield
myTime.setMinute(Integer.parseInt(jfTime.jTextField2.getText() ) ); //setsMinute by getting whats in the textfield
myTime.setSecond(Integer.parseInt(jfTime.jTextField3.getText() ) ); //setsSecond by getting whats in the textfield

myTime.setTime(myTime.getHour(),myTime.getMinute(),myTime.getSecond()); //sets the time officially
}

/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
public void update()
{
jLabel4.setText(myTime.getTime() );
}

// Variables declaration - do not modify
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField jTextField3;
private javax.swing.JLabel jLabel2;
private javax.swing.JButton jButton1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField1;
// End of variables declaration

}
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That actionPerformed() is in an anonymous inner class, not in the JFrameTime class. The easiest way out of this mess is just to remove the "implements ActionListener" from the class declaration.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic