• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing:Custom Cursor Changes for all the Jframes

 
Greenhorn
Posts: 9
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic