[kaffe] swing support in kaffe

Dalibor Topic robilad at kaffe.org
Thu Dec 20 17:08:36 PST 2007

zhang_xu_bing wrote:
> hello: 
> in the site : 
> http://www.kaffe.org/pipermail/kaffe/2006-October/104687.html
> /*********************************************************
> I am trying to run swing examples with kaffe+nanox but it is giving
> error as:
> java.lang.NoSuchMethodError: java/awt/Toolkit.addAWTEventListener(Ljava/awt/event/AWTEventListener;J)V
>    at javax.swing.JPanel.<init> (JPanel.java:109)
>    at javax.swing.JPanel.<init> (JPanel.java:85)
>    at javax.swing.JRootPane.createGlassPane (JRootPane.java:567)
>    at javax.swing.JRootPane.getGlassPane (JRootPane.java:474)
>    at javax.swing.JRootPane.<init> (JRootPane.java:526)
>    at javax.swing.JFrame.createRootPane (JFrame.java:221)
>    at javax.swing.JFrame.getRootPane (JFrame.java:205)
>    at javax.swing.JFrame.frameInit (JFrame.java:152)
>    at javax.swing.JFrame.<init> (JFrame.java:114)
>    at test2.main (test2.java:8)
> so during its analysis i found that the program crash when it internally try
> to call any UImamager.java function. I also found inside UIManager.java it 
> stuct inside static{} block when a call to functoin setLookAndFeel(LookAndFeel newLookAndFeel)
> is made. Inside setLookAndFeel stuck at:
> newLookAndFeel.initialize();
> I found this function is defined in BasicLookAndFeel.java file. Inside
> this intialize() function it stuck at:
> toolkit.addAWTEventListener(popupHelper, AWTEvent.MOUSE_EVENT_MASK);
> Here i found there are two Toolkit.java file:
> 1)/software/kaffe-1.1.7/libraries/javalib/awt-implementations/kaffe/java/awt/Toolkit.java
> 2)/software/kaffe-1.1.7/libraries/javalib/external/classpath/java/awt/Toolkit.java
> I found that this function defined in (2)Toolkit.java but it try to include
> (1)Toolkit.java and hence not able to find the function addAWTEventListener(popupHelper, AWTEvent.MOUSE_EVENT_MASK)
> SUGGEST some methods or clue so that i can get out of this problem.

The problem is that the native Kaffe AWT implementations like the nano-X 
one haven't been updated to work with the Swing implementation from GNU 
as you have noticed from the missing methods. Patches to make them work 
GNU Classpath's Swing implementation would be very appreciated.

dalibor topic

More information about the kaffe mailing list