Jump to content

Freely Available Code

From EDM2
Revision as of 21:56, 9 December 2016 by Martini (talk | contribs)

By Dion Gillard

This page is a collection of applets and classes written in NetRexx, complete with source code, for you to use freely. It is intended as a source of information on relating NetRexx to Java, as some of the samples here are ported from the book Java in a Nutshell by O'Reilly and Associates. I recommend the book strongly if you're looking to understand Java.

You can download the entire FAC source here.

Using the samples provided here, you can take the Java source and samples provided in JIAN, and learn how to write NetRexx code that uses Java classes. Some of the sample code provided can be run as an Applet within a Java-enabled Browswer, others must be run standalone using java, javapm or a Java Applet Reference in OS/2 Warp v4.0. If you're using a Java-enabled browser, you should be able to use the applets below if you have NetRexx available. If your browser can't run Java applets, use either the applet viewer that came with the JDK or one of the methods above.

Users of OS/2 v4.0 with Java support installed, using Netscape for OS/2, should be able to see the apps in the links provided. WebExplorer users of OS/2 v4.0 should try to drag the applet pages to their desktops.


  1. Notebook class from Visual NetRexx. A 'notebook' or 'tabbed dialog' class that lets you click on 'tabs' to show one of a number of mutually exculsive components.

Uses the DrawUtils class.
The Applet
The Code

  1. BorderPanel class from Visual NetRexx. A panel that has a three dimensional border around it. The border can be raised or sunken, three-d or etched.

Uses the DrawUtils class.
The Applet
The Code

  1. MessageBox class from Visual NetRexx.

Uses the MultiLineLabel class.
The Code

  1. JDKConvertDir class to convert a directory with Javadoc generated html into NetRexx syntax.

Run using java JDKConvertDir somedir output will go to the current directory. Uses the JDKDocConverter class.
The Code

  1. JDKConvertFile class to convert a Javadoc generated file into NetRexx syntax.

Run using java JDKConvertFile somefile.html output will go to a file called temp.htm in the current directory. Uses the JDKDocConverter class
The Code

  1. Toolbar from Visual NetRexx for Java

A toolbar class. Requires NonSizingGridLayout.Nrx.
The Code

  1. ImageButton from Visual NetRexx for Java

An image button class. Requires GrayButton.Nrx and DrawUtils.Nrx classes.
The Applet
The Code
Test Code

  1. RxDate from Bob Keller

This is a class for date manipulation.
The Code
Test Code

  1. The ArcTest class from the JDK demos

This class shows you how to draw lines and arcs. See /?/demo/ArcTest in your JDK (the ? means where your JDK is installed, i.e. java or javaos2 etc)
The Code

  1. The Animator class from the JDK demos

This class is an all purpose animator. It has a soundtrack and sounds to play in the background, can repeat the animation indefinitely and many other things. See /?/demo/Animator in your JDK (the ? means where your JDK is installed, i.e. java or javaos2 etc)
The Code

  1. Syntax Highlighting for OS/2's EPM (NOT NETREXX CODE)

NetRexx Syntax File

  1. The Pipes class ported from 'Java in a Nutshell (Section 6)'

This class demonstrates using Filters to emulate 'piping' information between filters.
Run using java Pipes , e.g. java Pipes LANG c:\config.sys
Please note that the original java file was split into separate NetRexx files, as NetRexx only allows one public class per file. All these files are available here.
You will need NetRexx 0.86 or higher to compile the code. Many thanks to Mike Cowlishaw for fixing bugs in NetRexx and discussing/implementing suggestions.
The Code The LayoutCard class by Kai Schmidt
This class shows you how to use a CardLayout layout manager. It is a port from the book Java Programming for the Internet.
The Applet
The Code The ThreadLister class ported from 'Java in a Nutshell (Section 9)'.
This class shows you how to list information about threads and thread groups. It is used by the AppletThreadLister class below.
The Code The Server class ported from 'Java in a Nutshell (Section 9)'.
This class uses sockets to provide a simple service to clients attached to a network.It is used by the Client class mentioned below. The service this server provides is reversing the string sent to it.
This class is an enhancement of the Server class from Java in a Nutshell Section 7.
Run using java Server, and then start the client.
The Code The Client class ported from 'Java in a Nutshell (Section 9)'.
This is a class that is a client to the Server class. It shows how to use sockets in a text mode NetRexx program.
Remember that the Server class must be started before running this Client.
Run using java Client
This class is an enhancement of the Client class from Java in a Nutshell Section 7.
The Code The AppletThreadLister class ported from 'Java in a Nutshell (Section 9)'.
This class shows how to get information about threads and thread groups.
The Applet
The Code The GrayButton class ported from 'Java in a Nutshell (Section 8)'.
This class shows how to filter an image to provide graphical effects.
The Applet
The Code The Animator2 class ported from 'Java in a Nutshell (Section 8)'.
This class shows how to use threads and the MediaTracker class to allow the loading of multiple images over a network and track their progress, and possible failure.
The Applet
The Code The Smooth class ported from 'Java in a Nutshell (Section 8)'.
This class shows how to use threads and 'clipping rectangles' to achieve smooth animation.
The Applet
The Code The UDPSend class ported from 'Java in a Nutshell (Section 7)'.
This class uses datagrams to send a packet to another machine on the network.It is the partner of the UDPReceive class mentioned below.
Run using java UDPSend hostname message, after starting UDPReceive.
The Code The UDPReceive class ported from 'Java in a Nutshell (Section 7)'.
This class uses datagrams to receive a packet from another machine on the network.It is the partner of the UDPSend class mentioned below.
Run using java UDPReceive, and then start UDPSend.
The Code The Server class ported from 'Java in a Nutshell (Section 7)'.
This class uses sockets to provide a simple service to clients attached to a network.It is used by the Client class mentioned below. The service this server provides is reversing the string sent to it. It is also used by the AppletClient class.
Run using java Server, and then start one of the clients.
The Code The GetURLInfo class ported from 'Java in a Nutshell (Section 7)'.
This is a class that shows how to query information about URLs using NetRexx.
Run using java GetURLInfo http://www.multitask.com.au/netrexx/fac/FirstApplet.Nrx
The Code The FetchTest class ported from 'Java in a Nutshell (Section 7)'.
This is a class that shows how to use the Fetch class.
Run using javapm FetchTest http://www.multitask.com.au/netrexx/fac/FirstApplet.Nrx
The Code The FetchImageTest class ported from 'Java in a Nutshell (Section 7)'.
This is a class that shows how to use the Fetch class.
Run using javapm FetchImageTest http://www.multitask.com.au/multitsk.gif
The Code The Fetch class ported from 'Java in a Nutshell (Section 7)'.
This is a class that shows how to use the URL class' getContent method.
Don't run this class - it's a helper class only.
The Code The Client class ported from 'Java in a Nutshell (Section 7)'.
This is a class that is a client to the Server class. It shows how to use sockets in a text mode java program.
Remember that the Server class must be started before running this Client.
Run using java Client
The Code The AppletClient class ported from 'Java in a Nutshell (Section 7)'.
This is a class that is a client to the Server class. It shows how to use sockets in an applet.
Run locally using the applet viewer.
The Code The GrepInputStream class ported from 'Java in a Nutshell (Section 6)'.
This is a class that shows how to write a class to filter text from a stream.
This class is used by Grep.
The Code The Grep class ported from 'Java in a Nutshell (Section 6)'.
This is a class that shows how to use a filter class to select text from a stream.
Run using java Grep substring filename
The Code The FileViewer class ported from 'Java in a Nutshell (Section 6)'.
This is a class that shows how to load a file into a text area. This class is also used by The Code The FileLister class ported from 'Java in a Nutshell (Section 6)'.
This is a class that shows java's input output capabilities, in a graphical application.
Run using javapm FileLister
The Code The FileCopy class ported from 'Java in a Nutshell (Section 6)'.
This is a class that shows java's input output capabilities, and some of the methods you can use to access and control files.
Run using java FileCopy file1 file2
The Code The YesNoDialog class ported from 'Java in a Nutshell (Section 5)'.
This is a custom dialog class for use in applets and AWT applications. It is used in the AllEvents class.
The Code The ScrollableScribble class ported from 'Java in a Nutshell (Section 5)'.
This is a custom control class for use in applets and AWT applications. It is used in the AllEvents and AllComponents classes.
The Code The ReallyQuitDialog class ported from 'Java in a Nutshell (Section 5)'.
This is a custom dialog class for use in applets and AWT applications.
The Code The MultiLineLabel class ported from 'Java in a Nutshell (Section 5)'.
This is a custom component class for use in applets and AWT applications.
The Code The InfoDialog class ported from 'Java in a Nutshell (Section 5)'.
Run this class using javapm. It will not close under the OS/2 JDK 1.0.1.
The Code The AllEvents class ported from 'Java in a Nutshell (Section 5)'.
Run this class using javapm.
The Code The AllComponents class ported from 'Java in a Nutshell (Section 5)'.
Run this class using javapm. It will not close under the OS/2 JDK 1.0.1.
The Code The StandaloneScribble class ported from 'Java in a Nutshell (Section 4)'.
Run this class using javapm.
The Code The SecondApplet class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The ImageMap class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The FirstApplet class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The EventTester class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The ColorScribble class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The ClearableScribble class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The AudioAnimator class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The Animator class ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The Scribble applet ported from 'Java in a Nutshell (Section 4)'.
The Applet
The Code The throwtest class ported from 'Java in a Nutshell (Section 4)'.
Run using java.
The Code A class I use to synchronise my laptop and network config.sys files.
Run using java mtc.config.Synch
The Code A class I use to run native commands, which places output in a stem.
The Code


----------------------------------------------