![]() |
|||
4 Say Method
Since the launcher's only functionality is to run the component, it shouldn't contain the methods to display the "Hello World!" message.
The latter is clearly a task of our module controller.
That's why we now create a new public method
All that the HelloWorldLauncher.java has to do now is to create an instance of HelloWorldControllerImpl c = new HelloWorldControllerImpl(); if (c != null) { c.sayHelloWorld(); } else { throw new NullPointerException("Could not say 'Hello World!'. The Hello World application is null."); } As a rule of Component Oriented Programming, you should always use the standard constructor to create a new instance and avoid handing over parameters to it. Any parameters will be forwarded later, using special "Lifecycle" methods.
As always, when some method is called on some instance in the form Our sample screenshot still hasn't changed:
|
|||
Copyright (c) 1999-2002. The Res Medicinae Webmasters. All rights reserved. GNU FDL license. Last Update: 07.05.2002 |