• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Real-time GUI and polling

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a main() which starts two threads, one which polls a device and populates a hashtable and the other an event-dispatcher GUI thread with uses a TableModel to take data from the hashtable and draw a table.

In debug mode an exception is thrown in the java.awt.Container class:

throw new ArrayIndexOutOfBoundsException("No such child: " + n);

at this line
javax.swing.SwingUtilities.invokeLater(new Runnable() {

I reckon I'm not initializing something in the GUI properly but can't think what.
I would be very gateful for any ideas on this.


public static void main(String[] args) {

WebPortalSimulator x = new WebPortalSimulator();
x.start();

javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
MainWindow mainWindow = new MainWindow();
}
});

}
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My guess is that unless your threads are synchronizing with each other, the reading thread might be trying to read something that isn't actually there.

Without seeing your code, I suspect this is why the index position is out of bounds on the reading thread.

Cheers, Jared.
[ January 25, 2005: Message edited by: Jared Cope ]
 
Trust God, but always tether your camel... to this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic