aspose file tools*
The moose likes Beginning Java and the fly likes Mouse Cursor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Mouse Cursor " Watch "Mouse Cursor " New topic
Author

Mouse Cursor

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Hi,
How to change the Mouse Cursor? If you can explain me by sample code.
Thanks in advance,
angela
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
I solved it
Thanks
angela
octavyn pittman
Ranch Hand

Joined: Mar 06, 2001
Posts: 134
Angela,
Any way you could quickly describe your initial problem, and then quickly tell how you solved it?
It would be helpful to everyone here,
OP
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
After I post it, I went to www.google.com. I had search on Mouse Cursor in java.
I got very good appropriate sample code.
SO I posted back that i got it..
Thanks,
angela
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You can't post it for us??


"JavaRanch, where the deer and the Certified play" - David O'Meara
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Hi Cindy,
Definitely I can post for Javaranch.
Here is sample:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.net.*;
public class OpenPage1 extends Applet implements MouseListener
{
Label openLink;
Font f;
Cursor c;

public void init()
{
f = new Font("Serif",Font.BOLD,12);
openLink = new Label("Click Here");
openLink.setFont(f);
openLink.setForeground(Color.black);
openLink.addMouseListener(this);
add(openLink);
}
public void paint(Graphics g)
{
g.drawLine(67,29,120,29);
g.setColor(Color.red);
}
public void mouseClicked(MouseEvent e)
{
if( e.getSource() == openLink)
{
try
{
URL theURL = new URL("http://www.yahoo.com");
getAppletContext().showDocument(theURL);
}
catch(MalformedURLException me)
{
System.out.println("Bad URL: ");
}
}
}
public void mouseEntered(MouseEvent e)
{
if( e.getSource() == openLink)
{
openLink.setForeground(Color.red);
c = new Cursor ( Cursor.HAND_CURSOR );
this.setCursor (c);
}
}
public void mouseExited(MouseEvent e)
{
c = new Cursor (Cursor.DEFAULT_CURSOR );
openLink.setForeground(Color.black);
this.setCursor (c);
}
public void mouseReleased(MouseEvent e)
{}
public void mousePressed(MouseEvent e)
{}
}

Thanks,
Angela
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mouse Cursor