Visual Components don't appear when I run my application.

Scott Stanchfield

First, make sure there are no errors in any code in your class. You can do this by selecting the "All Problems" tab from the workbench.

If you're not getting any messages, uncomment the two lines in the handleException() method of your application that print out the exception information and run again. This usually displays the exception that is causing the problem. Note that you may also need to uncomment the handleException() method in beans you use in your application.

If you're getting java.lang.NoClassDefFound exceptions, most likely your runtime CLASSPATH isn't properly set. See How does VAJ handle CLASSPATH settings? for details on how to set it.

If you still have problems, check to see what your main() method does. If your application extends a visual component like Frame or Panel, you should see code that creates an instance of the class and displays it via setVisible(true). A common problem is that many programmers extend a non-visual class or don't have an extends clause. In cases like this, the main() simply creates an instance of the application and initializes it. It does not make it visible. You'll need to add a setVisible(true) call on the Frame, Window or Dialog to display. 


See also