Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
strange "bug" after saving a figure with a uitable

Subject: strange "bug" after saving a figure with a uitable

From: matt dash

Date: 11 Jan, 2011 20:45:05

Message: 1 of 3

Hello all,

This is a pretty obscure problem, but maybe someone can make something of it. I havent yet figured out the simplest program that recreates the error as it's difficult to extract the relevant code from the larger gui. Anyway, here's what's happening:

 I have an exceedingly complicated gui that contains a uitable in which I have replaced the TableModel, TableCellRenderers, header renderers, and probably some other stuff with custom java classes. When I try to save the state of the gui using saveas, I get a bunch of "could not serialize object" warnings related to the uitable. Ok, I can deal with that (just need to recreate the table after opening the saved .fig file).

Here's where it gets weird... after using saveas, I want to be able to keep working with the gui. However, (after using saveas) every time the gui needs to redraw, I get the java exceptions listed below, usually about a hundred times in a row, basically making the gui unusable. (Though if i open the saved version and recreate the table, it works fine.) Any ideas why using saveas would break the table? I wouldnt expect saveas to make any permanent changes to the figure, but that's what seems to be happening.

here are the java errors:

[ConditionalEventPump] Exception occurred during event dispatching:
java.lang.NullPointerException
at com.jidesoft.plaf.basic.BasicCellSpanTableUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

or if the table's visibility is "off":

[ConditionalEventPump] Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTableUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
at java.awt.Container.layout(Unknown Source)
at java.awt.Container.doLayout(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validate(Unknown Source)
at com.mathworks.hg.peer.FigureClientProxy.validateFigure(FigureClientProxy.java:1017)
at com.mathworks.hg.peer.FigureMediator.validateFigure(FigureMediator.java:370)
at com.mathworks.hg.peer.FigurePeer.validateFigure(FigurePeer.java:520)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.run(HGPeerQueue.java:281)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Subject: strange "bug" after saving a figure with a uitable

From: Husam Aldahiyat

Date: 11 Jan, 2011 21:04:05

Message: 2 of 3

uitable is very very buggy, especially when it was first introduced (I think R2008b). Which version of MATLAB are you using?

"matt dash" wrote in message <igifgh$emu$1@fred.mathworks.com>...
> Hello all,
>
> This is a pretty obscure problem, but maybe someone can make something of it. I havent yet figured out the simplest program that recreates the error as it's difficult to extract the relevant code from the larger gui. Anyway, here's what's happening:
>
> I have an exceedingly complicated gui that contains a uitable in which I have replaced the TableModel, TableCellRenderers, header renderers, and probably some other stuff with custom java classes. When I try to save the state of the gui using saveas, I get a bunch of "could not serialize object" warnings related to the uitable. Ok, I can deal with that (just need to recreate the table after opening the saved .fig file).
>
> Here's where it gets weird... after using saveas, I want to be able to keep working with the gui. However, (after using saveas) every time the gui needs to redraw, I get the java exceptions listed below, usually about a hundred times in a row, basically making the gui unusable. (Though if i open the saved version and recreate the table, it works fine.) Any ideas why using saveas would break the table? I wouldnt expect saveas to make any permanent changes to the figure, but that's what seems to be happening.
>
> here are the java errors:
>
> [ConditionalEventPump] Exception occurred during event dispatching:
> java.lang.NullPointerException
> at com.jidesoft.plaf.basic.BasicCellSpanTableUI.paint(Unknown Source)
> at javax.swing.plaf.ComponentUI.update(Unknown Source)
> at javax.swing.JComponent.paintComponent(Unknown Source)
> at javax.swing.JComponent.paint(Unknown Source)
> at javax.swing.JComponent.paintChildren(Unknown Source)
> at javax.swing.JComponent.paint(Unknown Source)
> at javax.swing.JViewport.paint(Unknown Source)
> at javax.swing.JComponent.paintChildren(Unknown Source)
> at javax.swing.JComponent.paint(Unknown Source)
> at javax.swing.JComponent.paintToOffscreen(Unknown Source)
> at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
> at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
> at javax.swing.RepaintManager.paint(Unknown Source)
> at javax.swing.JComponent._paintImmediately(Unknown Source)
> at javax.swing.JComponent.paintImmediately(Unknown Source)
> at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
> at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
> at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
> at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
> at java.awt.event.InvocationEvent.dispatch(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
>
> or if the table's visibility is "off":
>
> [ConditionalEventPump] Exception occurred during event dispatching:
> java.lang.NullPointerException
> at javax.swing.plaf.basic.BasicTableUI.getPreferredSize(Unknown Source)
> at javax.swing.JComponent.getPreferredSize(Unknown Source)
> at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
> at java.awt.Container.layout(Unknown Source)
> at java.awt.Container.doLayout(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validateTree(Unknown Source)
> at java.awt.Container.validate(Unknown Source)
> at com.mathworks.hg.peer.FigureClientProxy.validateFigure(FigureClientProxy.java:1017)
> at com.mathworks.hg.peer.FigureMediator.validateFigure(FigureMediator.java:370)
> at com.mathworks.hg.peer.FigurePeer.validateFigure(FigurePeer.java:520)
> at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.run(HGPeerQueue.java:281)
> at java.awt.event.InvocationEvent.dispatch(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)

Subject: strange "bug" after saving a figure with a uitable

From: Yair Altman

Date: 12 Jan, 2011 07:22:06

Message: 3 of 3

For anyone interested, Matt fixes the problem by a method he describes here:
http://undocumentedmatlab.com/blog/handle2struct-struct2handle-and-matlab-8/comment-page-1/#comment-29110

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us