Summary

Chapter 4 - Implementing Runnable Versus Extending Thread

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Extending Thread and JComponent?
Using the event handling thread to run the timer proved to be an impossible idea. Another thread has to be used to run the timer. Based on what has been explored in earlier chapters, it would be nice if SecondCounter could inherit from both JComponent and Thread , as illustrated in Figure 4.4.
Figure 4.4: Inheriting from both JComponent and Threadimpossible in Java!
Because multiple inheritance is not permitted in Java, this approach wont work. It is most important that SecondCounter IS-A Component so that it can be added to a Container , like JPanel . How can it also allow a thread to run within it?

Toc


Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors: Paul Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net