Google

IBM

Buttons application

This is a simple example of a stand-alone windowed application; when started, it displays a 'frame window' in the middle of the desktop with two buttons; pressing a button fills the window with the selected color. This example assumes that Java 1.1 is available: it uses dependent (inner) classes and the Java 1.1 event model.

Here's the source, as a plain ASCII file.

To run the program, create or copy the 'Buttons.nrx' file (note the first letter is a capital letter), and then enter the commands:


  java COM.ibm.netrexx.process.NetRexxC Buttons

  java Buttons

If you are using OS/2 or Windows, or other systems where a NetRexxC command is provided, you can use the single command

  netrexxc -run Buttons

to do this. This command would:
  1. Call the NetRexx translator to translate the program from NetRexx to Java
  2. Call the Java compiler (javac) to compile the program into a class file (this assumes you've installed the Java 1.1.2 or later toolkit)
  3. Call the Java interpreter (java) to interpret the class file, which should then display the buttons, which should then react to being clicked.

For a more sophisticated application, with a menu bar, multiple threads, and so on, see the Pinger example.


[ IBM | Help | Legal | Privacy ]