After compiling this code, I am getting a "cannot find symbol constructor Timer(int,Morning)" on line 17.

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

public class Morning extends JFrame
  private EasySound rooster;
  private int time;

   *   Constructor

  public Morning (int time)
  	time = 0;
  	Timer clock = new Timer(30, this);
  public Morning()
    rooster = new EasySound("roost.wav");;

    Container c = getContentPane();

  public static void main(String[] args)
    Morning morning = new Morning();
    morning.setSize(300, 150);

Because the class "Timer" constructor prototype doesn't have the type you are declaring. Where is your Timer class? And what are its constructors?

// do you have this type of constructor in your Timer class?
public Timer(int anInt, Morning aMonringObj) {

Edited 5 Years Ago by Taywin: n/a

The problem is, I don't know what to put in place of super("Morning"). Does anyone know what that means. -From our computer to yours- zach&kody

Which Timer class do you really want to use? Is it from javax.swing.Timer, java.util.Timer, or your own customized class? You may need to look at the classes' constructor. They are different.

By the way, implementing only ActionListener() inside the Morning class won't solve the whole problem if you still pass in the "Morning" class to the Timer as it is now.

Edited 5 Years Ago by Taywin: n/a

This article has been dead for over six months. Start a new discussion instead.