• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing:Custom Cursor Changes for all the Jframes

 
zm khan
Greenhorn
Posts: 9
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making a small Jframe named CursorFrame which will allows the user to change the cursor.I already know how to make a custom cursor but the issue is that this method works for only one specific Jframe.So i created a class and tried to modified the code but still there's no luck.Below is the code:



This is the method call behind a label.



When i click the label , the cursor doesn't change.Any help would be most appreciated.
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're setting the cursor to new instances of four classes, and those new instances are probably not part of your GUI, since you don't retain any references to them.

Aside, most applications need just one JFrame, auxiliary displays being JDialog, either created independently or as a result of invoking a static method of JOptionPane.

To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
 
zm khan
Greenhorn
Posts: 9
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So is there any other possible way?In CursorFrame if i create a method and call it behind a Jlabel,the cursor will change.This effect will stay valid within this frame only.
Below is the code..

Calling this method behind a Jlabel

Whereas my objective is that the custom cursor should remain same through out the software.See below

 
zm khan
Greenhorn
Posts: 9
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Mr.Darryl,i used a Jdialog and it seems that main JFrame and the Jdialog seems to change the cursor into a custom one.Now i only need to know is that how do i set cursors for other Jframes as well.Here's the code.

I have two more Jframes "Feedback" and "About".What should i code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!