This post originated from an RSS feed registered with Java Buzz
by Scott Delap.
Original Post: No Large Images Allowed In SWT
Feed Title: ClientJava.com
Feed URL: http://www.clientjava.com/archives/wireless_mobile.rdf
Feed Description: Client/Desktop Related Java Development
I spent a good portion of yesterday tracking down why this code doesn't work:
Display display = Display.getDefault();
Image image = new Image(display, 10000, 4400);
GC graphicContext = new GC(image);
It results in the following error:
org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:2717)
at org.eclipse.swt.graphics.Image.init(Image.java:1366)
at org.eclipse.swt.graphics.Image.(Image.java:161)
at com.clientjava.SampleTable.main(SampleTable.java:9)
This is one of the more useful errors I have ever seen =). Upon doing a little investigation, I found a little more to work with. It turns out the Image constructor ultimately makes an os call:
OS.CreateCompatibleBitmap(hDC, width, height);
According to Microsoft this bitmap can be a maximum of 16M on Windows 95/98/Me. It says nothing about Windows 2000 or XP. However, there has to be a limit because I've found it. The Eclipse mailing lists seems to be little help as well.