Java Demo Projects
The layout of Java samples are profiled in workspace \samples\java\Demo1.vpw. Open it by "File / Open" command.
\samples\java\Example1.vpp
- Demo1: Hello Java World - the most simple console application
- use properties of item "Java project" to select a compiler and interpreter and customize their options
- how to include directives (see class HelloWorld which contains import java.io.* directive)
- output of compiler is parsed to show errors if they occur and highlight the position in source code editor
- invoke class diagram by Shift+F11 (it consists of the single class HelloWorld)
\samples\java\Example2.vpp
- Demo2: Use of WinOut - illustrates the use of simple trace utility for debugging purposes
- WinOut for Java is supported by means of native classes defined in package "tc"
- take note of import tc.* directive (this package is located in \lib\tcUtils.zip)
- tcUtils.zip must be added to the environment variable CLASSPATH
- use macro @VP(ci) to print information about current context of source code (ci stands for "class item")
- invoke "WinOut Trace Utility" from the Start Menu, then run example
- the calls to function tc.winout will produce messages in the WinOut window
\samples\java\Example3.vpp
- Demo3: Hello Swing World - the most simple Swing application
- classes SwingApplic[1,2] implement interface ActionListener
- how to build the same GUI is designed in a different ways
- class SwingApplic2 is the clone of SwingApplic1
- class SwingApplic2 introduces GUI designer (invoked by popup menu or key F11 while positioning within its subtree)
- look at static variable "labelPrefix" and its initialization by property "= Body"
- how to create the top-level container of JFrame class
- method actionPerformed of ActionListener is overriden in classes SwingApplic[1,2]
\samples\java\Example4.vpp
- Demo4: AWT Application - lot of AWT components layouted by means of GUI designer
- how to use different layouts and constraints in your application
- how to define additional properties of component - go to editor of item "cmbComboBox" by F5 or Num5
- inspect source code generated by GUI designer by popup menu or toolbar button "View Source"
- invoke GUI designer by popup menu or key F11 while positioning within its subtree
\samples\java\Example5.vpp
- Demo5: Swing Application - lot of JFC components layouted by means of GUI designer
- the clone of previous Demo4 - the same GUI is designed with a different toolkit
\samples\java\Example6.vpp
- Demo6: HTML Viewer - another Swing application