I want to create an off-screen image in a Swing application.
The program compiles without errors, but createImage() always
returns null.
The only examples from the tutorial that contain createImage() are
applets (not swing applications) and seem to work fine.
For verification, I included the relevant code snippet (as shown
below) in a swing application example from the tutorial -- same
result.
Am I missing something??? or is that a swing bug?
I am using jdk117_v1a, swing-1.1.1-beta1
----------8><----------------------------------------------------
// extracted from ".../tutorial/ui/swingComponents/example-swing/"
public class ScrollDemo extends JPanel
{
:
:
public ScrollDemo()
{
:
:
//--------------------
Image offScrImage = createImage(100,100);
if (offScrImage == null)
System.err.println("createImage() returns null!");
JPanel offScrPanel2 = new JPanel();
Image offScrImage2 = offScrPanel2.createImage(100,100);
if (offScrImage2 == null)
System.err.println("createImage() returns null!");
//--------------------
:
:
}
}
----------8><----------------------------------------------------
$ java ScrollDemo
createImage() returns null!
createImage() returns null!
----------8><----------------------------------------------------
Any feedback appreciated
--
Manfred