0

我有一个 Swing 应用程序,其中包含一组中间复杂的嵌套布局。(多个拆分窗格和滚动窗格)SplitPane 中的 ScrollPane 中的一个 Jpanel 包含一个 Jpanel 列表,其中包含各种控件。

时不时地,当我调整窗口大小或用一组新面板重新填充它时,该面板会变得闪烁着疯狂。两个滚动条都显示并且需要,并且面板刚刚开始闪烁/摇晃,因为其中的控件稍微调整大小。

我什至在调试器中发现了这一点——我的代码都没有被调用。这一切都在 Swing/AWT 代码中。在此期间也没有调用我的 Swing.invokeLater 调用。我没有任何自定义控件或绘画发生。这是我暂停 AWT EventQueue 线程时调试器向我显示的堆栈跟踪。

Thread [AWT-EventQueue-0] (Suspended)   
X11TextRenderer.doDrawGlyphList(long, long, Region, GlyphList) line: not available [native method]  
X11TextRenderer.drawGlyphList(SunGraphics2D, GlyphList) line: 62    
X11TextRenderer(GlyphListPipe).drawChars(SunGraphics2D, char[], int, int, int, int) line: 86    
SunGraphics2D.drawChars(char[], int, int, int, int) line: 2843  
SwingUtilities2.drawChars(JComponent, Graphics, char[], int, int, int, int) line: 780   
Utilities.drawTabbedText(View, Segment, int, int, Graphics, TabExpander, int, int[]) line: 170  
Utilities.drawTabbedText(View, Segment, int, int, Graphics, TabExpander, int) line: 89  
PlainView.drawUnselectedText(Graphics, int, int, int, int) line: 137    
PlainView.drawElement(int, Element, Graphics, int, int) line: 96    
PlainView.drawLine(int, Graphics, int, int) line: 65    
PlainView.paint(Graphics, Shape) line: 288  
BasicTextUI$RootView.paint(Graphics, Shape) line: 1422  
BasicTextAreaUI(BasicTextUI).paintSafely(Graphics) line: 722    
BasicTextAreaUI(BasicTextUI).paint(Graphics, JComponent) line: 869  
BasicTextAreaUI(BasicTextUI).update(Graphics, JComponent) line: 848 
JTextArea(JComponent).paintComponent(Graphics) line: 752    
JTextArea(JComponent).paint(Graphics) line: 1029    
JPanel(JComponent).paintChildren(Graphics) line: 862    
JPanel(JComponent).paint(Graphics) line: 1038   
JPanel(JComponent).paintChildren(Graphics) line: 862    
JPanel(JComponent).paint(Graphics) line: 1038   
JPanel(JComponent).paintChildren(Graphics) line: 862    
JPanel(JComponent).paint(Graphics) line: 1038   
JViewport(JComponent).paintChildren(Graphics) line: 862 
JViewport(JComponent).paint(Graphics) line: 1038    
JViewport.paint(Graphics) line: 747 
JScrollPane(JComponent).paintChildren(Graphics) line: 862   
JScrollPane(JComponent).paint(Graphics) line: 1038  
JPanel(JComponent).paintChildren(Graphics) line: 862    
JPanel(JComponent).paint(Graphics) line: 1038   
JViewport(JComponent).paintChildren(Graphics) line: 862 
JViewport(JComponent).paint(Graphics) line: 1038    
JViewport.paint(Graphics) line: 747 
JScrollPane(JComponent).paintChildren(Graphics) line: 862   
JScrollPane(JComponent).paint(Graphics) line: 1038  
JScrollPane(JComponent).paintToOffscreen(Graphics, int, int, int, int, int, int) line: 5124 
BufferStrategyPaintManager.paint(JComponent, JComponent, Graphics, int, int, int, int) line: 278    
RepaintManager.paint(JComponent, JComponent, Graphics, int, int, int, int) line: 1224   
JScrollPane(JComponent)._paintImmediately(int, int, int, int) line: 5072    
JScrollPane(JComponent).paintImmediately(int, int, int, int) line: 4882 
RepaintManager.paintDirtyRegions(Map<Component,Rectangle>) line: 785    
RepaintManager.paintDirtyRegions() line: 713    
RepaintManager.seqPaintDirtyRegions() line: 693 
SystemEventQueueUtilities$ComponentWorkRequest.run() line: 125  
InvocationEvent.dispatch() line: 209    
EventQueue.dispatchEventImpl(AWTEvent, Object) line: 641    
EventQueue.access$000(EventQueue, AWTEvent, Object) line: 84    
EventQueue$1.run() line: 602    
EventQueue$1.run() line: 600    
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]    
AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: 87    
EventQueue.dispatchEvent(AWTEvent) line: 611    
EventDispatchThread.pumpOneEventForFilters(int) line: 269   
EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: 184    
EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 174   
EventDispatchThread.pumpEvents(int, Conditional) line: 169  
EventDispatchThread.pumpEvents(Conditional) line: 161   
EventDispatchThread.run() line: 122 
4

0 回答 0