bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22864] "Grahics2D not implemented" with simple Swing apps


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22864] "Grahics2D not implemented" with simple Swing apps if cairo is disabled
Date: 16 Oct 2005 01:27:30 -0000

A simple Swing testcase suddenly stopped working when I upgraded from classpath
cvs 2005-02-07 to 2005-02-10,

/* Testcase: The window opens only with a probability of about 40%              
 * with kaffe from cvs 2005-01-29 while jamvm 1.2.4 with gnu classpath          
 * from cvs 2005-01-27 opens the window every time */                           

import javax.swing.*;                                                           

public class Test4 extends JFrame {                                             
        public Test4() {                                                        
                JLabel label = new JLabel("foo");                               
                JPanel panel = new JPanel();                                    
                panel.add(label);                                               
                this.setContentPane(panel);                                     
                this.pack();                                                    
        }                                                                       
        public static void main(String[] args) {                                
                new Test4().setVisible(true);                                   
        }                                                                       
}                                                                               


$
CLASSPATH=/home/lindi/installdir-2005-02-07/classpath/share/classpath/glibj.zip:$CLASSPATH:.
/home/lindi/installdir-2005-02-07/jamvm/bin/jamvm Test4
[window shows up correctly]
$

$
CLASSPATH=/home/lindi/installdir-2005-02-10/classpath/share/classpath/glibj.zip:$CLASSPATH:.
/home/lindi/installdir-2005-02-10/jamvm/bin/jamvm Test4
java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
   at java.awt.Toolkit.getDefaultToolkit (Toolkit.java:535)
   at java.awt.EventQueue.invokeLater (EventQueue.java:357)
   at javax.swing.SwingUtilities.invokeLater (SwingUtilities.java:920)
   at javax.swing.RepaintManager.addInvalidComponent (RepaintManager.java:275)
   at javax.swing.JComponent.revalidate (JComponent.java:1912)
   at javax.swing.JComponent.setOpaque (JComponent.java:2142)
   at javax.swing.JPanel.<init> (JPanel.java:83)
   at javax.swing.JPanel.<init> (JPanel.java:57)
   at javax.swing.JRootPane.createGlassPane (JRootPane.java:521)
   at javax.swing.JRootPane.getGlassPane (JRootPane.java:432)
   at javax.swing.JRootPane.<init> (JRootPane.java:484)
   at javax.swing.JFrame.createRootPane (JFrame.java:137)
   at javax.swing.JFrame.getRootPane (JFrame.java:122)
   at javax.swing.JFrame.frameInit (JFrame.java:86)
   at javax.swing.JFrame.<init> (JFrame.java:73)
   at Test4.<init> (Test4.java:8)
   at Test4.main (Test4.java:16)
Caused by: java.lang.Error: Grahics2D not implemented. Cairo was not found or
disabled at configure time
   at gnu.java.awt.peer.gtk.GdkGraphics2D.<clinit> (GdkGraphics2D.java:107)
   at gnu.java.awt.peer.gtk.GtkToolkit.gtkInit (Native Method)
   at gnu.java.awt.peer.gtk.GtkToolkit.<clinit> (GtkToolkit.java:126)
   at java.lang.VMClass.forName (Native Method)
   at java.lang.Class.forName (Class.java:159)
   at java.awt.Toolkit.getDefaultToolkit (Toolkit.java:521)
   ...16 more

This seems to be caused by the following change:

http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java.diff?r1=1.29&r2=1.30

Shouldn't GdkGraphics2D not be built at all if cairo is disabled? I don't know
much about configure/auto* stuff myself.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-02-10 
20:20 -------
I tried 25 times with current classpath CVS and jamvm 1.2.4. I workd always.
GdkGraphics2D should only be used when use add
-Dgnu.java.awt.peer.gtk.Graphics=Graphics2D to the command line.

BTW: added glibj.zip to the classpath is not needed as this should be built
into jamvm with the --with-classpath-install-dir configure option.


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-02-10 
20:48 -------
This comes from native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c which
tries to get the Graphics2D class and initComponentGraphics2D methods ID.

Caching at this point is probably the wrong thing to do.

Maybe just moving the check that throws the Error to the GdkGraphics2D
constructor or initstate() methods is the easiest solution. But there are a lot
of constructors and a few variants of initstate().


------- Comment #3 from from-classpath at savannah dot gnu dot org  2005-02-10 
21:57 -------
Can you please try the attached patch ? it should remove the Graphics2D stuff
when CAIRO support is not compiled in.


------- Comment #4 from from-classpath at savannah dot gnu dot org  2005-02-10 
22:04 -------
Fixed in CVS.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22864





reply via email to

[Prev in Thread] Current Thread [Next in Thread]