![]() |
|||
7 View ClassOur next aim is to get a graphical output. In a first step, we have to create a new class HelloWorldViewImpl which inherits most functionality from its AbstractApplicationView parent class. However, one addition has to be made: Inserting a constructor method (Example 5.1) to create a panel containing a label which finally keeps the "Hello World!" string. The "sayHello" method of HelloWorldControllerImpl should now be renamed to "createView". Instead of the Console output commands "System.out.println", we will now add just one line to return a new instance of HelloWorldViewImpl (Example 5.2). Because of the renamed "createView" method in HelloWorldControllerImpl, we also need to change the corresponding method call in HelloWorldLauncher (Example 5.3). At first, the view is created. Then, it is handed over as parameter of the "show" method which HelloWorldControllerImpl inherits from AbstractApplication.
|
|||
Copyright (c) 1999-2002. The Res Medicinae Webmasters. All rights reserved. GNU FDL license. Last Update: 07.05.2002 |