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