Hi --

I've noticed a very strange phenomenon: If I attempt to run a swing app
using JDK1.2, I always get the following exception:

Exception occurred during event dispatching:
java.lang.IllegalArgumentException: Raster ShortInterleavedRaster: width
= 198 height = 78 #numDataElements 1 is incompatible with ColorModel
DirectColorModel: rmask=7c00 gmask=3e0 bmask=1f amask=0
        at java.awt.image.BufferedImage.<init>(BufferedImage.java:521)
        at sun.awt.image.OffScreenImage.<init>(OffScreenImage.java:70)
        at
sun.awt.motif.MComponentPeer.createImage(MComponentPeer.java:286)
        at java.awt.Component.createImage(Component.java:2079)
        at java.awt.Component.createImage(Component.java:2077)
        at
javax.swing.RepaintManager.getOffscreenBuffer(RepaintManager.java:517)
        at javax.swing.JComponent.paint(JComponent.java:506)
        at java.awt.Container.paint(Container.java:770)
        at javax.swing.JFrame.update(JFrame.java:255)
        at
sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:248)
        at java.awt.Component.dispatchEventImpl(Component.java:2429)
        at java.awt.Container.dispatchEventImpl(Container.java:1032)
        at java.awt.Window.dispatchEventImpl(Window.java:714)
        at java.awt.Component.dispatchEvent(Component.java:2289)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:258)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)

( BTW, I am also setting the os.name property to something like SunOS or
Windows, because otherwise I get a NullPointerException -- the UIManager
can not find the UIDefaults in the Hashtable.)

This occurs when I run the Blackdown port locally, and also when I run
the app on a Solaris box and set the remote display. My code simply
instantiates a blank JFrame and sets its bounds. I had the same problem
with a RedHat 5.1 and now the RedHat 6.0 system. The error does not
occur when I use awt only. Nothing of the sort occured with JDK1.1.7 and
the latest swing release.

My window manager is WindowMaker 0.51. I am using GNOME, from the RedHat
6 dist.

My code looks like this:


-------------------- begin TestFrame.java --------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TestFrame extends JFrame
{

 public TestFrame(String title)
 {
  super(title);

  addWindowListener(new WindowAdapter()
        {
         public void windowClosing(WindowEvent e)
         {
          TestFrame.this.dispose();
          System.exit(0);
         }
        });


  setBounds(250,250,200,100);
  setBackground(Color.white);
  show();
 }

 public static void main(String[] args)
 {
     try
     {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     }
     catch (Exception ex_ignored)
     {
         // default l&f left in place
     }

 new TestFrame("Test");
 }
}
--------------------- end -------------------------


--
Armen Yampolsky
Axiom Software Labs
New York



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to