ryanqq / macwidgets

Automatically exported from code.google.com/p/macwidgets
0 stars 0 forks source link

drawing/painting errors #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
  I am not able to reproduce the problem every time I run, but can reproduce it intermittently 
enough to hopefully be useful.

What is the expected output? What do you see instead?
 The expected output is a normally formatted source list with about 506 categories and probably 
20 or so items.  What I see varies, but is anything from an only halfway drawn 
source list to a 
source list with items drawing overtop of other items in a jumbled mess.  In 
the former case I 
also see this stack trace below whenever the frame is repainted.

Exception in thread "AWT-EventQueue-0" 
java.lang.ArrayIndexOutOfBoundsException: 4 >= 4
    at java.util.Vector.elementAt(Vector.java:432)
    at javax.swing.tree.DefaultMutableTreeNode.getChildAt(DefaultMutableTreeNode.java:230)
    at javax.swing.tree.DefaultTreeModel.getChild(DefaultTreeModel.java:156)
    at 
javax.swing.tree.FixedHeightLayoutCache$SearchInfo.getPath(FixedHeightLayoutCach
e.java:1448
)
    at 
javax.swing.tree.FixedHeightLayoutCache.getPathForRow(FixedHeightLayoutCache.jav
a:193)
    at javax.swing.plaf.basic.BasicTreeUI.getPathForRow(BasicTreeUI.java:527)
    at javax.swing.JTree.getPathForRow(JTree.java:1708)
    at 
com.explodingpixels.macwidgets.plaf.SourceListTreeUI.isItemRow(SourceListTreeUI.
java:305)
    at 
com.explodingpixels.macwidgets.plaf.SourceListTreeUI.isCategoryRow(SourceListTre
eUI.java:301)
    at 
com.explodingpixels.macwidgets.plaf.SourceListTreeUI.access$1700(SourceListTreeU
I.java:93)
    at 
com.explodingpixels.macwidgets.plaf.SourceListTreeUI$SourceListTreeCellRenderer.
getTreeCellR
endererComponent(SourceListTreeUI.java:383)
    at javax.swing.plaf.basic.BasicTreeUI.paintRow(BasicTreeUI.java:1413)
    at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1203)
    at com.explodingpixels.macwidgets.plaf.SourceListTreeUI.paint(SourceListTreeUI.java:239)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:154)
    at javax.swing.JComponent.paintComponent(JComponent.java:743)
    at javax.swing.JComponent.paint(JComponent.java:1006)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JViewport.paint(JViewport.java:728)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:34)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
    at java.awt.Container.paint(Container.java:1722)
    at sun.awt.RepaintArea.paintComponent(RepaintArea.java:276)
    at sun.awt.RepaintArea.paint(RepaintArea.java:241)
    at apple.awt.ComponentModel.handleEvent(ComponentModel.java:268)
    at apple.awt.CWindow.handleEvent(CWindow.java:260)
    at java.awt.Component.dispatchEventImpl(Component.java:4144)
    at java.awt.Container.dispatchEventImpl(Container.java:2068)
    at java.awt.Window.dispatchEventImpl(Window.java:1801)
    at java.awt.Component.dispatchEvent(Component.java:3903)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

What version of the product are you using? On what operating system?
 the latest build as of 2009-04-12.  On Mac OS X leopard (up to date) with Java 1.5.0_16.

Please provide any additional information below.
 I am dealing with the source list model in a way that may be different than others.  I am adding 
a bunch of categories to the model, then in the initial run, and whenever the 
data is changed I 
remove all items from each category, add back the items that should be in each 
category, and 
then remove any categories that have zero items.  Even using the same data set 
the source list 
will sometimes redraw properly and sometimes not, seemingly at random.

Original issue reported on code.google.com by seandrei...@gmail.com on 12 Apr 2009 at 2:23

GoogleCodeExporter commented 9 years ago
Make sure that you're creating and manipulating all your UI on the event 
dispatch
thread. I ran into a very similar issue recently, and using
SwingUtilities.invokeLater solved the problem.

Original comment by sten...@gmail.com on 14 Apr 2009 at 2:16

GoogleCodeExporter commented 9 years ago
Jon beat me to it -- it appears that you're not creating your UI on the EDT. 
I'm closing this issue for now, but if 
creating your UI on the EDT doesn't fix the issue, feel free to reopen this 
issue.

Original comment by kenneth....@gmail.com on 14 Apr 2009 at 2:52