Null device configuration

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
christian_cowgirlGSR
Posts: 1
Joined: Wed Nov 16, 2011 7:44 pm
antibot: No, of course not.

Null device configuration

Post by christian_cowgirlGSR » Thu Nov 17, 2011 3:53 pm

I have a line chart, which is on a ChartPanel. I am extending the ChartPanel class so I can override paintComponent(...). I am overriding the paintComponent(...) method in an attempt to reduce the number of paints. However, when I call super.paintComponent(...), I get a NPE exception because The graphics2D's device configuration is null. I get this when I do anything except simply call super.paintcomponent(...). I get it even when simply doing the following. I originally wanted to store the unique graphics and print them later, in a job that calls the SwingUtilities.invokeLater(). Any ideas or help would be greatly appreciated.

/** @see org.jfree.chart.ChartPanel#paintComponent(java.awt.Graphics) */
@Override
public void paintComponent(final java.awt.Graphics g)
{
SwingUtilities.invokeLater(new Runnable(){

@Override
public void run()
{
System.out.println(String.format("Paint component Thread id: %s", Thread.currentThread().getId()));
DelayedChartPanel.super.paintComponent(g);
}

});
}

Locked