Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2004

Tip: Looking for answers? Try searching our database.

showStatus() works in windows but not in LINUX ?

Thread view: 
siddh_ptl@yahoo.com - 06 Nov 2004 13:39 GMT
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.