Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 1510 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>(Surface.java:59)
       at test.TestLevel.run(TestLevel.java:69)
       at test.TestLevel.main(TestLevel.java:54)
Caused by: java.lang.IndexOutOfBoundsException: invalid hotSpot
       at sun.awt.CustomCursor.<init>(CustomCursor.java:61)
       at sun.awt.X11CustomCursor.<init>(X11CustomCursor.java:26)
       at sun.awt.X11.XCustomCursor.<init>(XCustomCursor.java:27)
       at sun.awt.X11.XToolkit.createCustomCursor(XToolkit.java:742)
       at apollo.CursorManager.createInvisibleCursor(CursorManager.java:68)
       at apollo.CursorManager.<clinit>(CursorManager.java:37)
       ... 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 »

Thanks,

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: 434
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

Online Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


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

you have a Point there. <ho ho>

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (51 views)
2014-12-03 16:27:13

CopyableCougar4 (49 views)
2014-11-29 21:32:03

toopeicgaming1999 (115 views)
2014-11-26 15:22:04

toopeicgaming1999 (105 views)
2014-11-26 15:20:36

toopeicgaming1999 (31 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org 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‑gaming.org
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!