added method from TopLevelDemo.java to HelloWorldSwing.java