Writing Netrexx programs using Java Swing


Part 1

"Netrexx is a programming language derived from both Rexx and Java(tm); it is a dialect of Rexx that retains the portability and efficiency of Java, while being as easy to learn and to use as Rexx"  (statement taken from the Ibm Netrexx site) Swing is a next generation GUI toolkit that Sun Microsystems created to enable large scale (enterprise) development in Java. Programmers can write large scale Java applications using a wide array of components, these components can easily be extended or modified to control their appearance or behaviour.  


The first release by the author Mike Cowlishaw was Rexx then came Object Rexx which introduced object oriented programming; the latest implementation is Netrexx, by  far the most powerful yet. The latest version available is 2.05 and this is the one being used in this series of articles. OS/2-eCS has two Java versions to choose from, one being from Innotek using Odin the other being a native OS/2 version sold by Golden Code, this latest being the one used in our examples.


This series will show how Java programs can be written in Netrexx using the Java Swing package, this series is not a Netrexx or Java language tutorial, these can be found easily on the internet.   It is assumed that some object oriented programming and Netrexx background is known, I have only been using Netrexx for less than a year and I do not consider myself an expert but someone who reads, searches and is always willing to learn therefore feel free to correct anything you believe that should be done another way in any of the examples by sending an email to me.


There are many Java GUI design programs on the internet but  there is currently no visual Netrexx program available but I suspect it is a matter of time before one is released, either way it is always good and useful to know/learn how to write programs without visual tools.   Netrexx compiles to native Java byte code meaning your programs become Java applications which can be run on any operating system with Java installed, this also means Netrexx can use all Java classes, which are plentiful. This was a problem with the previous versions of Rexx as there are no currently supported Rexx libraries available.

Netrexx does not have this problem, Java is becoming (if not already become) the number one programming language of choice and has/is improving in all areas upon every release, the latest being Java 6.0. Even if you decide to change operating system as many have, your programs will still run and can still be developed as all major operating systems have a version of Java, this being the only thing needed to run your programs.


The only Netrexx samples I could find on the Internet were those downloadable from the Netrexx site, these are very few and old as the Swing set has changed dramatically since.

(in fact Swing was desinged after the examples & Netrexx 1.0 was released)



In order to get you started the following list shows sites and books available.


Useful Stuff

Netrexx homepage



Writing Java applications using NetRexx


The Netrexx Language
ISBN 0-13-806332-X, 197pp, Prentice Hall, 1997


Rexx2Nrx   Rexx 2 Netrexx


Netrexxify Java 2 Netrexx




jEdit with Netrexx plugin installed





The official Netrexx site provides useful information as well as additional documentation to the one included in the downloadable package.

It is recommended the reading of "Writing Java applications using NetRexx" via the available pdf file or the on-line version from the above address.

I have not used the "Rexx2Nrx" or the "Java2Netrexx" programs therefore I cannot comment on these, they have been mentioned to let you know of their existence, as this may prove helpful to some users.

jEdit is a must for Netrexx programming, a Netrexx plugin is available and must be installed as this plugin allows the compilation and execution of your code from within the editor, your code is automatically colour coded making your program easy to read. In other words with this plugin there is no reason to use the command line.

I have realised that jEdit is now at version 4.3 but Java 1.5 is needed which means us eCS users must wait until our Java is updated. (currently in progress and expected before the new year)

For other users the plugins needed also will need updating,
(Sidekick, CommonControls & Errorlist) pls see this page for more information and latest news regarding jEdit and Netrexx.

All the code discussed, created and executed in these articles will be done using jEdit therefore, it will be assumed that jEdit, Java and Netrexx have been installed and working correctly on your system


As from part 2 we will begin to cover all of the Swing components therefore the best place to start is taking a quick look at the demos which come with Java,  in the \java\demo\jfc directory you will find various samples, the one we are interested in (at the moment) is the swingset2 demo. Change to this directory and load the jar file.

In OS/2 - eCS type from the command line "java -jar SwingSet2.jar" without the quotes, this should bring up the following frame.

SwingSet2 Demo

This demo shows what can be done using Java Swing, even though we will cover each component in this series of articles, it is a good idea to fully explore this demo component by component using the toolbar and menu options.

With all the above said, why not use Java directly instead of Netrexx? this is the question always asked; the reply can be summed up below.

  1. Netrexx is simple to code, read and understand
  2. Every thing done in Java can be done using Netrexx easier and with cleaner and less
  3. Extended string handling, if you have used the Rexx "Parse" function then no more
      explanation is needed.
  4. Arithmetic to any precision.
       plus much more…