Thread: Using a cursor
View Single Post
  #4 (permalink)  
Old 11-26-2007, 11:56 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,146
hardwired is on a distinguished road
It was pseudo code. If I have a gui with a component displayed and I want to set the cursor for the component, ie, when the mouse is over that particular component the cursor will be set according to what I specified for the component, and if the component is:
Code:
JPanel panel = new JPanel(); // The "panel" is the reference to the Component that we use to set the cursor. // Since JPanel extends from Component we can use the (inherited) Component // method setCursor on the "panel" reference. panel.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
If you do not like the System cursor you can make an image of what you want and use it with the Toolkit.createCustomCursor method to make what you want.
Reply With Quote