J
joealey2003
Hi all...
I wrote an applet that shows mouse position using showStatus().
It works well on IE but on Netscape and mozilla it fails.
I know that it's running because that is another command that i use to
change the location of the browser to www.google.com onclicked that is
working.
Any hints???
Here goes the code by the way...
//----------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.applet.*;
public class mouseEvent extends JApplet implements MouseListener,
MouseMotionListener
{
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
setCursor(new Cursor(Cursor.HAND_CURSOR));
}
public void mouseClicked(MouseEvent e)
{
super.showStatus("Mouse has been clicked at " + e.getX()+ "," +
e.getY());
if(e.getButton() == MouseEvent.BUTTON1) {
//----------------
try
{
AppletContext ac = getAppletContext();
ac.showDocument ( new URL("http://www.google.com") );
}
catch (Exception e2)
{
}
//----------------
}
}
public void mouseEntered(MouseEvent e)
{
super.showStatus("Mouse has been Entered at " + e.getX()+ "," +
e.getY());
// For loop:to make sure mouse entered is on status bar for a few
sec
// for (int i= 0; i<10000000; i++);
}
public void mouseExited (MouseEvent e)
{
super.showStatus ("Mouse has been Exited at " + e.getX()+ "," +
e.getY());
}
public void mousePressed(MouseEvent e)
{
super.showStatus ("Mouse pressed at " + e.getX()+ "," + e.getY());
}
public void mouseReleased(MouseEvent e)
{
super.showStatus("Mouse released at " + e.getX()+ "," + e.getY());
}
public void mouseDragged(MouseEvent e)
{
super.showStatus("Mouse dragged at " + e.getX()+ "," + e.getY());
}
public void mouseMoved(MouseEvent e)
{
super.showStatus("Mouse moved at " + e.getX()+ "," + e.getY());
}
}
//-----------------------------------------------------------------------
I wrote an applet that shows mouse position using showStatus().
It works well on IE but on Netscape and mozilla it fails.
I know that it's running because that is another command that i use to
change the location of the browser to www.google.com onclicked that is
working.
Any hints???
Here goes the code by the way...
//----------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.applet.*;
public class mouseEvent extends JApplet implements MouseListener,
MouseMotionListener
{
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
setCursor(new Cursor(Cursor.HAND_CURSOR));
}
public void mouseClicked(MouseEvent e)
{
super.showStatus("Mouse has been clicked at " + e.getX()+ "," +
e.getY());
if(e.getButton() == MouseEvent.BUTTON1) {
//----------------
try
{
AppletContext ac = getAppletContext();
ac.showDocument ( new URL("http://www.google.com") );
}
catch (Exception e2)
{
}
//----------------
}
}
public void mouseEntered(MouseEvent e)
{
super.showStatus("Mouse has been Entered at " + e.getX()+ "," +
e.getY());
// For loop:to make sure mouse entered is on status bar for a few
sec
// for (int i= 0; i<10000000; i++);
}
public void mouseExited (MouseEvent e)
{
super.showStatus ("Mouse has been Exited at " + e.getX()+ "," +
e.getY());
}
public void mousePressed(MouseEvent e)
{
super.showStatus ("Mouse pressed at " + e.getX()+ "," + e.getY());
}
public void mouseReleased(MouseEvent e)
{
super.showStatus("Mouse released at " + e.getX()+ "," + e.getY());
}
public void mouseDragged(MouseEvent e)
{
super.showStatus("Mouse dragged at " + e.getX()+ "," + e.getY());
}
public void mouseMoved(MouseEvent e)
{
super.showStatus("Mouse moved at " + e.getX()+ "," + e.getY());
}
}
//-----------------------------------------------------------------------