Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Invisible cursor and X 11  (Read 2111 times)
0 Members and 1 Guest are viewing this topic.
Offline altair

Senior Newbie

« Posted 2004-10-09 23:00:58 »

Trying to hide the cursor with JDK1.5.0 on linux, I get

Exception in thread "main" java.lang.ExceptionInInitializerError
       at apollo.Surface.<init>(
       at test.TestLevel.main(
Caused by: java.lang.IndexOutOfBoundsException: invalid hotSpot
       at sun.awt.CustomCursor.<init>(
       at sun.awt.X11CustomCursor.<init>(
       at sun.awt.X11.XCustomCursor.<init>(
       at sun.awt.X11.XToolkit.createCustomCursor(
       at apollo.CursorManager.createInvisibleCursor(
       at apollo.CursorManager.<clinit>(
       ... 3 more

The code looks like this:
private static Cursor createInvisibleCursor()
   // Create the invisible cursor
   MemoryImageSource memIm = new MemoryImageSource(1, 1, new int[] { 0 }, 0, 1);
   Component c = new Component() { };
   Image im = c.createImage(memIm);
   Point spot = new Point(1, 1);
   return c.getToolkit().createCustomCursor(im, spot, INVISIBLE_CURSOR_NAME);

Has anybody experienced the same problem ? Any solution ?
Offline trembovetski

Senior Devvie

If only I knew what I'm talking about!

« Reply #1 - Posted 2004-10-10 05:44:01 »

It looks like you're creating a 1x1 image, and trying to use 1,1 point as a hotspot. (1,1) is out of bounds for a 1x1 image.
You should use 0,0 instead.
Offline altair

Senior Newbie

« Reply #2 - Posted 2004-10-10 23:05:59 »


Actually what surprised me is that the same code worked with JDK 1.4.2 (Windows). I guess something has changed in the JDK 1.5 that now exposes my misuse of the hotspot.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline trembovetski

Senior Devvie

If only I knew what I'm talking about!

« Reply #3 - Posted 2004-10-11 02:40:10 »

I'm guessing that the awt team has fixed some bug, so now the exception is thrown if the hotspot is invalid..
Offline princec

« JGO Spiffy Duke »

Medals: 893
Projects: 3
Exp: 16 years

Eh? Who? What? ... Me?

« Reply #4 - Posted 2004-10-11 15:59:41 »

But... it shouldn't be invalid!!! A hotspot can be anywhere relative to the actual image really... even outside of it.

Cas Smiley

Offline Abuse

JGO Ninja

Medals: 55

falling into the abyss of reality

« Reply #5 - Posted 2004-10-11 16:52:51 »

you have a Point there. <ho ho>
Offline trembovetski

Senior Devvie

If only I knew what I'm talking about!

« Reply #6 - Posted 2004-10-14 03:23:23 »

That's why I shouldn't be allowed to answer non-java2d related questions, at least, w/o reading the javadoc first =)

Looks like it could be a new bug,  likely to be caused by XAWT, assuming the Dimension returned by getBestCursorSize is more than 0x0- see the javadoc for createCustomCursor.

Try running your app with -Dawt.toolkit=sun.awt.motif.MToolkit
to see if it works with motif toolkit.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

numerical (163 views)
2017-02-21 07:32:16

numerical (163 views)
2017-02-21 07:31:46

theagentd (270 views)
2017-02-18 13:42:33

theagentd (272 views)
2017-02-18 13:35:16

h.pernpeintner (1439 views)
2017-01-24 22:39:11

h.pernpeintner (1424 views)
2017-01-24 22:38:32

Galdo (1987 views)
2017-01-12 13:44:09

Archive (2042 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2579 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2331 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!