• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Mouse Cursor

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How to change the Mouse Cursor? If you can explain me by sample code.
Thanks in advance,
angela
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved it
Thanks
angela
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't post it for us??
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic