This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing Worker?

 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we use the SwingWorker? It is not part of the JFC but is quite useful. Any suggestions?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never heard of it. What does it do?
And you can use anything you want as long as you feel you can justify it and defend it on your design.txt and essay exam.
Mark
 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A SwingWorker is a convinience tool put out on the sun site that helps do data intesive task and handle Swing Event queues convinittly. Forexample, if we had to do a database read of records, we would not like to execute that on the Event queue as it would create the blank screen effect. The way to do it, is run the task on a separate thread and then use the SwingUtitilies.invokeLater() to update the screen.
The SwingWorker does that for you:
public class MyWorker extends SwingWorker {
public Object construct() {
//Fethc rows...blah blah
return rows;
}

public void finished() {
Object rows = get();
table.update(rows);
}
}
The construct method will run on its own thread but will invoke the finished method on the event queue. I am however not sure if this is allowed for use
 
Andre Mermegas
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used, I just handed in my assignment. When I get a grade back, I'll let you know what happened.
@see
ME
[ January 31, 2002: Message edited by: Andre Mermegas ]
 
Nick Cooper
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kalichar,
I see no reason why you would loose marks if you use the SwingWorker class. The assignment spec says nothing about not using standard helper classes. Though I would document where you sourced it from. I plan to do this for my assignment. EG

Nick
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic