• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread problem?

 
Dwayne King
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have a problem with a very simple swing app I've written, and I think I will need a thread to solve it. I am still new to swing though, and don't want to reinvent the wheel.
My app connects to an Oracle database and picks up messages off of a database pipe. My interface has a slider that lets the user determine how often to poll the database for new messages.
My code that gets the messages works fine (it just keeps appending them to a text area), but when I go to sleep(), the whole app freezes while it is sleeping.
I need the app to be able to respond while it is between intervals, so that the user can click on the stop button.
I know this must be a common problem. Can anyone help? Is a separate thread the answer to my problem?
[ June 03, 2002: Message edited by: Dwayne King ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would guess that a separate thread is the answer to your problem.
Take a look in The Code Barn for introductory examples on using threads. And don't miss The Threads Lesson of Sun's Java Tutorial.
Good Luck.
[ June 03, 2002: Message edited by: Dirk Schreckmann ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!