Responsive Applets 1: Don't Freeze



Problem: Java uses single thread to deliver events (e.g. mouse click)

  • Easy: in called method, perform network (HTTP) transaction

  • Result: buttons, repaints and type-ins freeze until server responds

  • Good: in called method, wake up thread to perform network transaction

  • Hard: how to respond to clicks before transaction completes

  • Opportunity: allow user to cancel actions
 
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22