problem with JPanel interface

S

someone

I`m trying to add an MouseListener to a JPanel

Here is the Code:

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

public class CalPanel extends JPanel implements MouseEvent
{
// somecode
}

but BlueJ says:

"interface expected here"

And highlights the header

any thoughts?


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
M

Monique Y. Mudama

I`m trying to add an MouseListener to a JPanel

Here is the Code:

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

public class CalPanel extends JPanel implements MouseEvent
{
// somecode
}

but BlueJ says:

"interface expected here"

And highlights the header

any thoughts?

I'm not sure what you mean by "header", but I think I get what yuo
mean.

You don't want to implement MouseEvent. You want to implement
MouseListener. MouseEvent is a concrete class, not an interface, so
you can't implement it.
 
E

Eric Sosman

I`m trying to add an MouseListener to a JPanel

Here is the Code:

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

public class CalPanel extends JPanel implements MouseEvent
{
// somecode
}

but BlueJ says:

"interface expected here"

And highlights the header

any thoughts?

s/Event/Listener/
 
I

IchBin

I`m trying to add an MouseListener to a JPanel

Here is the Code:

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

public class CalPanel extends JPanel implements MouseEvent
{
// somecode
}

but BlueJ says:

"interface expected here"

And highlights the header

any thoughts?


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

Guess because MouseEvent is not an interface. You want implement an
interface not a class.

Maybe this is a better error messge "The type MouseEvent cannot be a
superinterface of CalPanel; a superinterface must be an interface'


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top