Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-31 Thread Roman Kennke
Hi Audrius,

 Unfortunately, this brings us to the second 
 exception, related to the JFreeChart:
 
 java.lang.ClassCastException: gnu/java/awt/peer/gtk/GdkGraphics
 Probably our JFreeChart experts could look at this.

This is caused by missing support for Graphics2D. Try building and
running with cairo.

/Roman





Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-31 Thread Robert Schuster
Hey Audrius,
thanks for fixing this. Here is how jMemorize looks when using the cairo based
Graphics2D.

http://page.mi.fu-berlin.de/~rschuste/jMemorize-2006-03-31.png

configure with --enable-gtk-cairo and then run with:

jamvm -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -jar jMemorize-0.9.2.jar

It will be slow, there are some layout problems (one has to move the splitpane
dividers around) and the custom graphic in the upper frame is missing but it
starts. :)

I am not sure where this comes from but I find that our Free Swing apps look
very neat. Is there something special with our fonts?!?

cya
Robert

Roman Kennke wrote:
 Hi Audrius,
 
 
Unfortunately, this brings us to the second 
exception, related to the JFreeChart:

java.lang.ClassCastException: gnu/java/awt/peer/gtk/GdkGraphics
Probably our JFreeChart experts could look at this.
 
 
 This is caused by missing support for Graphics2D. Try building and
 running with cairo.
 
 /Roman
 
 
 
 


signature.asc
Description: OpenPGP digital signature


Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-31 Thread Roman Kennke
Hi Robert,

 I am not sure where this comes from but I find that our Free Swing apps look
 very neat. Is there something special with our fonts?!?

Yes. In constrast to Sun's JDK, we use the system fonts and the system
font settings, which is normally antialiased and optimized for LCD when
running on lcd screen. Sun paints its fonts un-anti-aliased thus looks
quite bad. However, you can turn on font-antialiasing using the
RenderingHints class. It's a bit tricky to do this application wide
though... (on the downside, I think classpath ignores the RenderingHints
altogether).

/Roman




Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-31 Thread Mark Wielaard
On Thu, 2006-03-30 at 23:06 +0100, David Gilbert wrote:
 I think many applications are going to fail on our implementation until 
 we get good Graphics2D support into our JComponent (many custom look and 
 feel implementations rely on it, for starters).

Agreed. Most of the things I am testing on top of our free swing do
actually work till they try using a Graphics2D environment. And our
current --enable-gtk-cairo/-Dgnu.java.awt.peer.gtk.Graphics=Graphics2D
implementation is too fragile to be really usable. There is a real plan
to get to a fully supported Graphics2D world:
http://developer.classpath.org/mediation/ClasspathGraphicsImagesText

But as David has shown we actually can get pretty nice results already
with a quick-and-dirty partial implementation based on
cairo/java-gnome: http://www.object-refinery.com/jfreechart/free.html

This is really an area were some experimentation with the various
implementation strategies can be helpful.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part


Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-31 Thread Mark Wielaard
On Fri, 2006-03-31 at 15:55 +0200, Roman Kennke wrote:
 However, you can turn on font-antialiasing using the
 RenderingHints class. It's a bit tricky to do this application wide
 though... (on the downside, I think classpath ignores the
 RenderingHints altogether). 

Ironically this is how I have seen a couple of applications fail. The
only reason they try casting to a Graphics2D object in their paint()
method is to set the RenderingHints to get anti-aliasing. Such
applications do work with the --enable-gtk-cairo
-Dgnu.java.awt.peer.gtk.Graphics=Graphics2D trick since then we accept
the cast and just ignore the hint :)

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part


Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-30 Thread Audrius Meskauskas
This is because jMemorize overrides the JTable.columnMarginChanged that 
is fired from the JTable constructor, when the user -  derived class is 
not yet initialised. This can be easily fixed by initialising the table 
column model befor the table listeners are installed on it, I have 
comitted such patch. Unfortunately, this brings us to the second 
exception, related to the JFreeChart:


java.lang.ClassCastException: gnu/java/awt/peer/gtk/GdkGraphics
  at org.jfree.chart.ChartPanel.paintComponent (ChartPanel.java:905)
  at javax.swing.JComponent.paint (JComponent.java:1583)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JSplitPane.paintChildren (JSplitPane.java:538)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JSplitPane.paintChildren (JSplitPane.java:538)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JLayeredPane.paint (JLayeredPane.java:647)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)

Probably our JFreeChart experts could look at this.

Regards
Audrius.

Robert Schuster wrote:


Hi,
I added jMemorize[0] to the list of Free Swing apps. I just stumbled over the
app and tried to run it but it fails with a NPE:

java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Method.invokeNative (Native Method)
  at java.lang.reflect.Method.invoke (Method.java:355)
  at jamvm.java.lang.JarLauncher.main (JarLauncher.java:50)
Caused by: java.lang.NullPointerException
  at jmemorize.gui.swing.CardTable.columnMarginChanged (Unknown Source)
  at javax.swing.table.DefaultTableColumnModel.fireColumnMarginChanged
(DefaultTableColumnModel.java:493)
  at javax.swing.table.DefaultTableColumnModel.setColumnMargin
(DefaultTableColumnModel.java:171)
  at javax.swing.JTable.setIntercellSpacing (JTable.java:2950)
  at javax.swing.JTable.initializeLocalVars (JTable.java:1720)
  at javax.swing.JTable.init (JTable.java:1664)
  at javax.swing.JTable.init (JTable.java:1582)
  at jmemorize.gui.swing.CardTable.init (Unknown Source)
  at jmemorize.gui.swing.FindFrame.init (Unknown Source)
  at jmemorize.gui.swing.MainFrame.init (Unknown Source)
  at jmemorize.core.Main.run (Unknown Source)
  at jmemorize.core.Main.main (Unknown Source)
  at java.lang.reflect.Method.invokeNative (Native Method)
  ...2 more

Since there are some Swing hackers who frequently work on JTable this might be a
low hanging fruit for them.

cya
Robert

[0] - http://riad.de/jmemorize
 






Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-30 Thread David Gilbert
The ChartPanel class overrides paintComponent(Graphics) and casts the 
incoming Graphics object the Graphics2D subclass - this is very common 
in Swing apps as a way to gain access to Java2D features for drawing on 
Swing components.  I'm almost certain that the Graphics object is 
guaranteed to be a Graphics2D instance, and the original method 
signature is maintained for backwards compatibility only, although this 
isn't mentioned in the API specification.  The only reference I've been 
able to find is this one in the Java tutorial:


http://java.sun.com/docs/books/tutorial/uiswing/14painting/practice.html

I think many applications are going to fail on our implementation until 
we get good Graphics2D support into our JComponent (many custom look and 
feel implementations rely on it, for starters).


Regards,

Dave

Audrius Meskauskas wrote:

This is because jMemorize overrides the JTable.columnMarginChanged 
that is fired from the JTable constructor, when the user -  derived 
class is not yet initialised. This can be easily fixed by initialising 
the table column model befor the table listeners are installed on it, 
I have comitted such patch. Unfortunately, this brings us to the 
second exception, related to the JFreeChart:


java.lang.ClassCastException: gnu/java/awt/peer/gtk/GdkGraphics
  at org.jfree.chart.ChartPanel.paintComponent (ChartPanel.java:905)
  at javax.swing.JComponent.paint (JComponent.java:1583)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JSplitPane.paintChildren (JSplitPane.java:538)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JSplitPane.paintChildren (JSplitPane.java:538)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)
  at javax.swing.JComponent.paint (JComponent.java:1585)
  at javax.swing.JLayeredPane.paint (JLayeredPane.java:647)
  at javax.swing.JComponent.paintChildren (JComponent.java:1700)

Probably our JFreeChart experts could look at this.

Regards
Audrius.

Robert Schuster wrote:


Hi,
I added jMemorize[0] to the list of Free Swing apps. I just stumbled 
over the

app and tried to run it but it fails with a NPE:

java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Method.invokeNative (Native Method)
  at java.lang.reflect.Method.invoke (Method.java:355)
  at jamvm.java.lang.JarLauncher.main (JarLauncher.java:50)
Caused by: java.lang.NullPointerException
  at jmemorize.gui.swing.CardTable.columnMarginChanged (Unknown Source)
  at javax.swing.table.DefaultTableColumnModel.fireColumnMarginChanged
(DefaultTableColumnModel.java:493)
  at javax.swing.table.DefaultTableColumnModel.setColumnMargin
(DefaultTableColumnModel.java:171)
  at javax.swing.JTable.setIntercellSpacing (JTable.java:2950)
  at javax.swing.JTable.initializeLocalVars (JTable.java:1720)
  at javax.swing.JTable.init (JTable.java:1664)
  at javax.swing.JTable.init (JTable.java:1582)
  at jmemorize.gui.swing.CardTable.init (Unknown Source)
  at jmemorize.gui.swing.FindFrame.init (Unknown Source)
  at jmemorize.gui.swing.MainFrame.init (Unknown Source)
  at jmemorize.core.Main.run (Unknown Source)
  at jmemorize.core.Main.main (Unknown Source)
  at java.lang.reflect.Method.invokeNative (Native Method)
  ...2 more

Since there are some Swing hackers who frequently work on JTable this 
might be a

low hanging fruit for them.

cya
Robert

[0] - http://riad.de/jmemorize
 











Re: jMemorize - exception in JTable code: Fixed, but JFreeChart internal problem follows.

2006-03-30 Thread Audrius Meskauskas

Regards,

David Gilbert wrote:

The ChartPanel class overrides paintComponent(Graphics) and casts the 
incoming Graphics object the Graphics2D subclass - this is very common 
in Swing apps as a way to gain access to Java2D features for drawing 
on Swing components.  I'm almost certain that the Graphics object is 
guaranteed to be a Graphics2D instance, and the original method 
signature is maintained for backwards compatibility only, although 
this isn't mentioned in the API specification.  The only reference 
I've been able to find is this one in the Java tutorial:


http://java.sun.com/docs/books/tutorial/uiswing/14painting/practice.html


There it is written you can cast the |Graphics| parameter into a 
|Graphics2D| object., and this is java.sun.com. Looks like documented 
behavior. Probably it is time to fill in the bug report.


Audrius.