hi Group,
The below program compiles and runs perfectly in appletviewer on
windows but gives below error on LINUX
------------ERROR ON LINUX------------
javac MouseEvents.java
MouseEvents.java: In class `MouseEvents':
MouseEvents.java: In method
`MouseEvents.mouseDragged(java.awt.event.MouseEvent)':
MouseEvents.java:72: No method named `showStatus' in scope.
showStatus("Dragging mouse at "+ me.getX() +","+ me.getY());
^
MouseEvents.java: In method
`MouseEvents.mouseMoved(java.awt.event.MouseEvent)':
MouseEvents.java:79: No method named `showStatus' in scope.
showStatus("Moving mouse at "+ me.getX() + "," + me.getY());
^
2 errors
-------------------------------------
I am using j2sdk1.4.2 on both windows and linux.
---------THE PROGRAM--------------------
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.String;
/*
<applet code="MouseEvents" width=300 height=100>
</applet>
*/
public class MouseEvents extends Applet implements MouseListener,
MouseMotionListener{
String msg="";
int mouseX=0,mouseY=0; //coordinates of mouse
public void init(){
addMouseListener(this);
addMouseMotionListener(this);
}
//handle mouse clicked.
public void mouseClicked(MouseEvent me){
//save coordinates
mouseX=0;
mouseY=10;
msg="Mouse Clicked";
repaint();
}
//handle mouse entered
public void mouseEntered(MouseEvent me){
//save coordinates
mouseX=0;
mouseY=10;
msg="Mouse Entered";
repaint();
}
//handle mouse exited
public void mouseExited(MouseEvent me){
//save coordinates
mouseX=0;
mouseY=10;
msg="Mouse Exited";
repaint();
}
//handle mouse pressed
public void mousePressed(MouseEvent me){
//save coordinates
mouseX=me.getX();
mouseY=me.getY();
msg="Mouse Pressed";
repaint();
}
//handle mouse released
public void mouseReleased(MouseEvent me){
//save coordinates
mouseX=me.getX();
mouseY=me.getY();
msg="Mouse Released";
repaint();
}
//handle mouse dragged
public void mouseDragged(MouseEvent me){
//save coordinates
mouseX=me.getX();
mouseY=me.getY();
msg="*";
showStatus("Dragging mouse at "+ me.getX() +","+ me.getY());
repaint();
}
//handle mouse moved
public void mouseMoved(MouseEvent me){
//show status
showStatus("Moving mouse at "+ me.getX() + "," + me.getY());
}
//display message in applet window at current X,Y location
public void paint(Graphics g){
g.drawString(msg,mouseX,mouseY);
}
}
----------------------------------------
what could be the reason.
regards,
SIDDHARTH
John McGrath - 06 Nov 2004 22:21 GMT
> The below program compiles and runs perfectly in appletviewer on
> windows but gives below error on LINUX
[quoted text clipped - 17 lines]
>
> I am using j2sdk1.4.2 on both windows and linux.
It compiles correctly for me under Linux, using JDK 1.4.2_05. I suspect
that your JDK is corrupted. You might want to try a re-install.

Signature
Regards,
John McGrath
siddh_ptl@yahoo.com - 07 Nov 2004 09:27 GMT
hi John,
Thank you for your response. Actually I was wrong. Today I found out
that I was using GCJ (GNU compiler for java). The path for
j2sdk1.4.2_04 was not set. Using javac from j2sdk1.4.2_04, the program
now compiles. But I still _dont_ see the showStatus() message in the
mozilla browser caption in LINUX. I _can_ see the showStatus() message
in appletviewer in LINUX.
Thank you very much.
regards,
SIDDHARTH
John McGrath - 08 Nov 2004 00:55 GMT
> But I still dont see the showStatus() message in the mozilla
> browser caption in LINUX. I can see the showStatus() message
> in appletviewer in LINUX.
That sounds like a Mozilla issue. I know that support for Applets in
browsers is rather inconsistent, but I have done very little with Applets,
so I cannot help on this.

Signature
Regards,
John McGrath