を設定し、JTable
18列を含めるようにしました。当初、13カラムのときは、にぴったりとはまり、JTable
破れはありませんでした。ただし、18個のテーブルを含めるようにし、自動サイズ変更をオフに設定すると、水平スクロールバーを使用して他の列をスクロールしようとすると、次のJTable
図に示すように、ティアリングが発生し始めました。
Netbeansは、次のような多くのエラーメッセージも表示し始めました。
スレッド「AWT-EventQueue-0」の例外java.lang.ArrayIndexOutOfBoundsException:14 javax.swing.JTable $ 1.getValueAt(JTable.java:689)で javax.swing.JTable.getValueAt(JTable.java:2720)で javax.swing.JTable.prepareRenderer(JTable.java:5718)で javax.swing.plaf.synth.SynthTableUI.paintCell(SynthTableUI.java:684)で javax.swing.plaf.synth.SynthTableUI.paintCells(SynthTableUI.java:581)で javax.swing.plaf.synth.SynthTableUI.paint(SynthTableUI.java:365)で javax.swing.plaf.synth.SynthTableUI.update(SynthTableUI.java:276)で javax.swing.JComponent.paintComponent(JComponent.java:778)で javax.swing.JComponent.paint(JComponent.java:1054)で javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)で javax.swing.RepaintManager $ PaintManager.paintDoubleBuffered(RepaintManager.java:1482)で javax.swing.RepaintManager $ PaintManager.paint(RepaintManager.java:1413)で javax.swing.RepaintManager.paint(RepaintManager.java:1206)で javax.swing.JComponent.paintForceDoubleBuffered(JComponent.java:1090)で javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1598)で javax.swing.JViewport.windowBlitPaint(JViewport.java:1559)で javax.swing.JViewport.setViewPosition(JViewport.java:1102)で javax.swing.plaf.basic.BasicScrollPaneUI $ Handler.hsbStateChanged(BasicScrollPaneUI.java:1087)で javax.swing.plaf.basic.BasicScrollPaneUI $ Handler.stateChanged(BasicScrollPaneUI.java:1038)で javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:364)で javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:302)で javax.swing.DefaultBoundedRangeModel.setValue(DefaultBoundedRangeModel.java:168)で javax.swing.JScrollBar.setValue(JScrollBar.java:463)で javax.swing.plaf.basic.BasicScrollBarUI $ TrackListener.setValueFrom(BasicScrollBarUI.java:1253)で javax.swing.plaf.basic.BasicScrollBarUI $ TrackListener.mouseDragged(BasicScrollBarUI.java:1195)で java.awt.Component.processMouseMotionEvent(Component.java:6553)で javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339)で java.awt.Component.processEvent(Component.java:6274)で java.awt.Container.processEvent(Container.java:2229)で java.awt.Component.dispatchEventImpl(Component.java:4861)で java.awt.Container.dispatchEventImpl(Container.java:2287)で java.awt.Component.dispatchEvent(Component.java:4687)で java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)で java.awt.LightweightDispatcher.processMouseEvent(Container.java:4509)で java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)で java.awt.Container.dispatchEventImpl(Container.java:2273)で java.awt.Window.dispatchEventImpl(Window.java:2719)で java.awt.Component.dispatchEvent(Component.java:4687)で java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)で java.awt.EventQueue.access $ 000(EventQueue.java:102)で java.awt.EventQueue $ 3.run(EventQueue.java:662)で java.awt.EventQueue $ 3.run(EventQueue.java:660)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:87)で java.awt.EventQueue $ 4.run(EventQueue.java:676)で java.awt.EventQueue $ 4.run(EventQueue.java:674)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.awt.EventQueue.dispatchEvent(EventQueue.java:673)で java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)で java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)で java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)で java.awt.EventDispatchThread.run(EventDispatchThread.java:97)で スレッド「AWT-EventQueue-0」の例外java.lang.ArrayIndexOutOfBoundsException:14 javax.swing.JTable $ 1.getValueAt(JTable.java:689)で javax.swing.JTable.getValueAt(JTable.java:2720)で javax.swing.JTable.prepareRenderer(JTable.java:5718)で javax.swing.plaf.synth.SynthTableUI.paintCell(SynthTableUI.java:684)で javax.swing.plaf.synth.SynthTableUI.paintCells(SynthTableUI.java:581)で javax.swing.plaf.synth.SynthTableUI.paint(SynthTableUI.java:365)で javax.swing.plaf.synth.SynthTableUI.update(SynthTableUI.java:276)で javax.swing.JComponent.paintComponent(JComponent.java:778)で javax.swing.JComponent.paint(JComponent.java:1054)で javax.swing.JComponent.paintChildren(JComponent.java:887)で javax.swing.JComponent.paint(JComponent.java:1063)で javax.swing.JViewport.paint(JViewport.java:731)で javax.swing.JComponent.paintChildren(JComponent.java:887)で javax.swing.JComponent.paint(JComponent.java:1063)で javax.swing.JComponent.paintChildren(JComponent.java:887)で javax.swing.JComponent.paint(JComponent.java:1063)で javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)で javax.swing.RepaintManager $ PaintManager.paintDoubleBuffered(RepaintManager.java:1482)で javax.swing.RepaintManager $ PaintManager.paint(RepaintManager.java:1413)で javax.swing.RepaintManager.paint(RepaintManager.java:1206)で javax.swing.JComponent._paintImmediately(JComponent.java:5169)で javax.swing.JComponent.paintImmediately(JComponent.java:4980)で javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:770)で javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728)で javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:677)で javax.swing.RepaintManager.access $ 700(RepaintManager.java:59)で javax.swing.RepaintManager $ ProcessingRunnable.run(RepaintManager.java:1621)で java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)で java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701)で java.awt.EventQueue.access $ 000(EventQueue.java:102)で java.awt.EventQueue $ 3.run(EventQueue.java:662)で java.awt.EventQueue $ 3.run(EventQueue.java:660)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.awt.EventQueue.dispatchEvent(EventQueue.java:671)で java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)で java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)で java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)で java.awt.EventDispatchThread.run(EventDispatchThread.java:97)で スレッド「AWT-EventQueue-0」の例外java.lang.ArrayIndexOutOfBoundsException:14 javax.swing.JTable $ 1.getValueAt(JTable.java:689)で javax.swing.JTable.getValueAt(JTable.java:2720)で javax.swing.JTable.prepareRenderer(JTable.java:5718)で javax.swing.plaf.synth.SynthTableUI.paintCell(SynthTableUI.java:684)で javax.swing.plaf.synth.SynthTableUI.paintCells(SynthTableUI.java:581)で javax.swing.plaf.synth.SynthTableUI.paint(SynthTableUI.java:365)で javax.swing.plaf.synth.SynthTableUI.update(SynthTableUI.java:276)で javax.swing.JComponent.paintComponent(JComponent.java:778)で javax.swing.JComponent.paint(JComponent.java:1054)で javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)で javax.swing.RepaintManager $ PaintManager.paintDoubleBuffered(RepaintManager.java:1482)で javax.swing.RepaintManager $ PaintManager.paint(RepaintManager.java:1413)で javax.swing.RepaintManager.paint(RepaintManager.java:1206)で javax.swing.JComponent.paintForceDoubleBuffered(JComponent.java:1090)で javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1598)で javax.swing.JViewport.windowBlitPaint(JViewport.java:1559)で javax.swing.JViewport.setViewPosition(JViewport.java:1102)で javax.swing.plaf.basic.BasicScrollPaneUI $ Handler.hsbStateChanged(BasicScrollPaneUI.java:1087)で javax.swing.plaf.basic.BasicScrollPaneUI $ Handler.stateChanged(BasicScrollPaneUI.java:1038)で javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:364)で javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:302)で javax.swing.DefaultBoundedRangeModel.setValue(DefaultBoundedRangeModel.java:168)で javax.swing.JScrollBar.setValue(JScrollBar.java:463)で javax.swing.plaf.basic.BasicScrollBarUI $ TrackListener.setValueFrom(BasicScrollBarUI.java:1253)で javax.swing.plaf.basic.BasicScrollBarUI $ TrackListener.mouseDragged(BasicScrollBarUI.java:1195)で java.awt.Component.processMouseMotionEvent(Component.java:6553)で javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339)で java.awt.Component.processEvent(Component.java:6274)で java.awt.Container.processEvent(Container.java:2229)で java.awt.Component.dispatchEventImpl(Component.java:4861)で java.awt.Container.dispatchEventImpl(Container.java:2287)で java.awt.Component.dispatchEvent(Component.java:4687)で java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)で java.awt.LightweightDispatcher.processMouseEvent(Container.java:4509)で java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)で java.awt.Container.dispatchEventImpl(Container.java:2273)で java.awt.Window.dispatchEventImpl(Window.java:2719)で java.awt.Component.dispatchEvent(Component.java:4687)で java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)で java.awt.EventQueue.access $ 000(EventQueue.java:102)で java.awt.EventQueue $ 3.run(EventQueue.java:662)で java.awt.EventQueue $ 3.run(EventQueue.java:660)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:87)で java.awt.EventQueue $ 4.run(EventQueue.java:676)で java.awt.EventQueue $ 4.run(EventQueue.java:674)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.awt.EventQueue.dispatchEvent(EventQueue.java:673)で java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)で java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)で java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)で java.awt.EventDispatchThread.run(EventDispatchThread.java:97)で スレッド「AWT-EventQueue-0」の例外java.lang.ArrayIndexOutOfBoundsException:14 javax.swing.JTable $ 1.getValueAt(JTable.java:689)で javax.swing.JTable.getValueAt(JTable.java:2720)で javax.swing.JTable.prepareRenderer(JTable.java:5718)で javax.swing.plaf.synth.SynthTableUI.paintCell(SynthTableUI.java:684)で javax.swing.plaf.synth.SynthTableUI.paintCells(SynthTableUI.java:581)で javax.swing.plaf.synth.SynthTableUI.paint(SynthTableUI.java:365)で javax.swing.plaf.synth.SynthTableUI.update(SynthTableUI.java:276)で javax.swing.JComponent.paintComponent(JComponent.java:778)で javax.swing.JComponent.paint(JComponent.java:1054)で javax.swing.JComponent.paintChildren(JComponent.java:887)で javax.swing.JComponent.paint(JComponent.java:1063)で javax.swing.JViewport.paint(JViewport.java:731)で javax.swing.JComponent.paintChildren(JComponent.java:887)で javax.swing.JComponent.paint(JComponent.java:1063)で javax.swing.JComponent.paintChildren(JComponent.java:887)で javax.swing.JComponent.paint(JComponent.java:1063)で javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)で javax.swing.RepaintManager $ PaintManager.paintDoubleBuffered(RepaintManager.java:1482)で javax.swing.RepaintManager $ PaintManager.paint(RepaintManager.java:1413)で javax.swing.RepaintManager.paint(RepaintManager.java:1206)で javax.swing.JComponent._paintImmediately(JComponent.java:5169)で javax.swing.JComponent.paintImmediately(JComponent.java:4980)で javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:770)で javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728)で javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:677)で javax.swing.RepaintManager.access $ 700(RepaintManager.java:59)で javax.swing.RepaintManager $ ProcessingRunnable.run(RepaintManager.java:1621)で java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)で java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701)で java.awt.EventQueue.access $ 000(EventQueue.java:102)で java.awt.EventQueue $ 3.run(EventQueue.java:662)で java.awt.EventQueue $ 3.run(EventQueue.java:660)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.awt.EventQueue.dispatchEvent(EventQueue.java:671)で java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)で java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)で java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)で java.awt.EventDispatchThread.run(EventDispatchThread.java:97)で スレッド「AWT-EventQueue-0」の例外java.lang.ArrayIndexOutOfBoundsException:14 javax.swing.JTable $ 1.getValueAt(JTable.java:689)で javax.swing.JTable.getValueAt(JTable.java:2720)で javax.swing.JTable.prepareRenderer(JTable.java:5718)で javax.swing.plaf.synth.SynthTableUI.paintCell(SynthTableUI.java:684)で javax.swing.plaf.synth.SynthTableUI.paintCells(SynthTableUI.java:581)で javax.swing.plaf.synth.SynthTableUI.paint(SynthTableUI.java:365)で javax.swing.plaf.synth.SynthTableUI.update(SynthTableUI.java:276)で javax.swing.JComponent.paintComponent(JComponent.java:778)で javax.swing.JComponent.paint(JComponent.java:1054)で javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)で javax.swing.RepaintManager $ PaintManager.paintDoubleBuffered(RepaintManager.java:1482)で javax.swing.RepaintManager $ PaintManager.paint(RepaintManager.java:1413)で javax.swing.RepaintManager.paint(RepaintManager.java:1206)で javax.swing.JComponent.paintForceDoubleBuffered(JComponent.java:1090)で javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1598)で javax.swing.JViewport.windowBlitPaint(JViewport.java:1559)で javax.swing.JViewport.setViewPosition(JViewport.java:1102)で javax.swing.plaf.basic.BasicScrollPaneUI $ Handler.hsbStateChanged(BasicScrollPaneUI.java:1087)で javax.swing.plaf.basic.BasicScrollPaneUI $ Handler.stateChanged(BasicScrollPaneUI.java:1038)で javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:364)で javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:302)で javax.swing.DefaultBoundedRangeModel.setValue(DefaultBoundedRangeModel.java:168)で javax.swing.JScrollBar.setValue(JScrollBar.java:463)で javax.swing.plaf.basic.BasicScrollBarUI $ TrackListener.setValueFrom(BasicScrollBarUI.java:1253)で javax.swing.plaf.basic.BasicScrollBarUI $ TrackListener.mouseDragged(BasicScrollBarUI.java:1195)で java.awt.Component.processMouseMotionEvent(Component.java:6553)で javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339)で java.awt.Component.processEvent(Component.java:6274)で java.awt.Container.processEvent(Container.java:2229)で java.awt.Component.dispatchEventImpl(Component.java:4861)で java.awt.Container.dispatchEventImpl(Container.java:2287)で java.awt.Component.dispatchEvent(Component.java:4687)で java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)で java.awt.LightweightDispatcher.processMouseEvent(Container.java:4509)で java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)で java.awt.Container.dispatchEventImpl(Container.java:2273)で java.awt.Window.dispatchEventImpl(Window.java:2719)で java.awt.Component.dispatchEvent(Component.java:4687)で java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)で java.awt.EventQueue.access $ 000(EventQueue.java:102)で java.awt.EventQueue $ 3.run(EventQueue.java:662)で java.awt.EventQueue $ 3.run(EventQueue.java:660)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:87)で java.awt.EventQueue $ 4.run(EventQueue.java:676)で java.awt.EventQueue $ 4.run(EventQueue.java:674)で java.security.AccessController.doPrivileged(ネイティブメソッド)で java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:76)で java.awt.EventQueue.dispatchEvent(EventQueue.java:673)で java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)で java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)で java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)で java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)で java.awt.EventDispatchThread.run(EventDispatchThread.java:97)で
なんでそうなの?この問題の解決策はありますか?ありがとう!
ごめんなさい!テーブルを初期化するために使用されるコードは次のとおりです。お役に立てば幸いです。
jp.setLayout(new BorderLayout());
JTable jt = new JTable(data, column);// data and columns are just 2D and 1D String arrays each
JTableHeader th = jt.getTableHeader();
th.setBackground(java.awt.Color.pink);
th.setEnabled(true);
jt.setTableHeader(th);
jt.setEnabled(false);
jp.add(jt, BorderLayout.CENTER);
JScrollPane scrollPane = new JScrollPane(jt, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
scrollPane.setEnabled(false);
jp.add(scrollPane, BorderLayout.CENTER);