NetRexx - NetRexx Sample Code


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.
You are visitor since November 18,1996

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

  2. 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

  3. MessageBox class from Visual NetRexx.
    Uses the MultiLineLabel class.
    The Code

  4. 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

  5. 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

  6. Toolbar from Visual NetRexx for Java
    A toolbar class. Requires NonSizingGridLayout.Nrx.
    The Code

  7. ImageButton from Visual NetRexx for Java
    An image button class. Requires GrayButton.Nrx and DrawUtils.Nrx classes.
    The Applet
    The Code
    Test Code

  8. RxDate from Bob Keller
    This is a class for date manipulation.
    The Code
    Test Code

  9. 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

  10. 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

  11. Syntax Highlighting for OS/2's EPM (NOT NETREXX CODE)
    NetRexx Syntax File

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. 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

  21. 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

  22. 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

  23. 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

  24. 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

  25. 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

  26. 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

  27. 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

  28. 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

  29. 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

  30. 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

  31. 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

  32. 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

  33. 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

  34. 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

  35. 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

  36. 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

  37. 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

  38. 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

  39. 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

  40. The AllEvents class ported from 'Java in a Nutshell (Section 5)'.
    Run this class using javapm.
    The Code

  41. 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

  42. The StandaloneScribble class ported from 'Java in a Nutshell (Section 4)'.
    Run this class using javapm.
    The Code

  43. The SecondApplet class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  44. The ImageMap class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  45. The FirstApplet class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  46. The EventTester class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  47. The ColorScribble class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  48. The ClearableScribble class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  49. The AudioAnimator class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  50. The Animator class ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  51. The Scribble applet ported from 'Java in a Nutshell (Section 4)'.
    The Applet
    The Code

  52. The throwtest class ported from 'Java in a Nutshell (Section 4)'.
    Run using java.
    The Code

  53. A class I use to synchronise my laptop and network config.sys files.
    Run using java mtc.config.Synch
    The Code

  54. A class I use to run native commands, which places output in a stem.
    The Code

----------------------------------------------
Home| Software| News| Services| Links| Resellers| Feedback| Orders
----------------------------------------------