If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > Override abstract method mouseExited

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-06, 04:42
ravindramall ravindramall is offline
Registered User
 
Join Date: Sep 2004
Posts: 76
Override abstract method mouseExited

I am getting following error at the time of compilation of java code

D:\JAVAPRG>javac MouseClickExample.java
MouseClickExample.java:5: MouseClickExample is not
abstract and does not override abstract method mouseExited(java.awt.event.MouseEvent) in java.awt.event.Mouse
Listener
public class MouseClickExample extends Applet implements MouseListener

Code as under
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class MouseClickExample extends Applet implements MouseListener
{
int xpos;
int ypos;

int rect1xco, rect1yco, rect1width, rect1height ;
boolean mouseEntered;
boolean rect1Clicked;

public void init()
{
rect1xco = 20;
rect1yco = 20;
rect1width = 100;
rect1height = 50;
addMouseListener(this);
}

public void paint(Graphics g)
{
g.setColor(Color.green);
g.fillRect(rect1xco,rect1yco,rect1width,rect1heigh t);
g.setColor(Color.red);
g.drawString("("+xpos+"."+ypos+")",xpos,ypos);
if (rect1Clicked)g.drawString("You clicked in the rectangle",20,120);
else g.drawString("Mouse is the outside of applet area",20,160) ;
}

public void mouseClicked(MouseEvent me)
{
xpos = me.getX();
ypos = me.getY();

if (xpos > rect1xco && ypos < rect1xco+rect1width && ypos > rect1yco && ypos < rect1yco+rect1height) rect1Clicked = true ;
else
rect1Clicked = false ;
repaint();
}

public void mouseReleased (MouseEvent me)
{
}

public void mouseEntered (MouseEvent me)
{
mouseEntered = false;
repaint();
}
}
Reply With Quote
  #2 (permalink)  
Old 11-02-06, 18:14
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
And your question is?
Reply With Quote
  #3 (permalink)  
Old 11-10-06, 03:58
Pinto Pinto is offline
Registered User
 
Join Date: Dec 2003
Posts: 51
Re

just add these methods to avoid compilation error.. and proceed......

/////////////////////////////////////////
public void mouseExited(MouseEvent e)
{

}

public void mousePressed(MouseEvent e)
{
}
/////////////////////////////////////////
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On