BSF4ooRexx Samples (Using Java Classes from Rexx)

Hint: if you wish to look at the ooRexx code with syntax highlighting, then you can use the free and open-source editor "[g]vim", which is available for practically all platforms and can be downloaded from its homepage at http://www.vim.org/. The leading number in the file names in this directory indicate how difficult the example is to be expected:
Name starts with Difficulty
1 beginner (very easy)
2 beginner (easy)
3 advanced
4 sophisticated
9 maybe quite challenging
. <directory> (List of this directory)
Display all of this directory's files and directories.
apache_bsf_samples <directory>
Original examples from Apache's BSF 2.x distributions, augmented with Rexx variants.
classicRexxSamples <directory>
Demonstrates how to use the external BSF functions without taking advantage of ooRexx.
CLR/.Net <directory>
This directory may only be available on Windows installations of BSF4ooRexx, which adds support to using CLR/.Net classes. This subdirectory contains ooRexx samples that demonstrate how to use .Net classes.
DOM <directory>
Scripts that demonstrate how to use Java's "DOM (Document Object Model)" classes to process XML files.
Java <directory>
Java programs that demonstrate how one can invoke ooRexx from Java and how easy this is. There are examples that interact with ooRexx objects from Java, including ooRexx condition objects.
JavaFX <directory>
JavaFX allows creating GUIs either "manually" or by defining an XML file that contains FXML markup that defines the GUI with interesting options. This directory and its subdirectories contain small nutshell Rexx programs that demonstrate how one can take advantage of JavaFX, making it fairly easy to create and manage (portable) GUI interfaces. JavaFX has become part of the Java runtime environment (JRE) with Java 1.7/7. JavaFX is also able to employ JSR-223 and therefore invoke Rexx scripts on its own.
LeePeedin <directory>
Scripts created by Lee Peedin for a presentation on one of the International Rexx Symposiums organized by the Rexx Language Association (cf. http://www.RexxLA.org). Stresses GUI programming and Java menus.
NetRexx <directory>
NetRexx programs that demonstrate how one can invoke ooRexx from NetRexx and how easy this is. There are examples that interact with ooRexx objects from NetRexx, including ooRexx condition objects.
OOo <directory>
Examples for driving OpenOffice.org applications.
ReneJansen <directory>
René Jansen's examples for demonstrating the usage of "XSLT;" and "JDBC (Java Database Connectivity)" to access relational databases.
SAX <directory>
Scripts that demonstrate how to use Java's "SAX (Simple API for XML)" classes to process XML files.
1-010_HelloWorld.rxj
Creates a window with a button which allows to close the window.
1-020_demo.BSF.dialog.rxj
Demonstrates the usage of the BSF.CLS' built in class .BSF.dialog, which allows to create popup and input dialogs for information purposes, but also to get user input in a platform independent manner.
1-030_JavaVersion.rxj
Fetch the system property "java.version" and display its value.
1-040_list_charsets.rxj
List available character set names with their aliases.
1-050_DateRgf.rxj
ooRexx program to test access to the class org.oorexx.datergf.DateTimeRGF, which is contained in the "bsf-rexx-engine.jar" archive; the documentation of the BSF4ooRexx Date/Time classes can be found in the archive "docs_bsf4rexx.zip".
You may want to try this link to the documentation as well: http://wi.wu-wien.ac.at/rgf/rexx/bsf4oorexx/current/docs/docs.bsf4oorexx/
1-060_DateRgfSample.rxj
Demonstrates the usage of the routine BSF.wrapStaticFields for accessing Java constants. This public routine gets defined by the ooRexx package BSF.CLS.
1-062_DateRgfCatholicEaster.rxj
Demonstrates the usage of the DateRgf class (part of the BSF4ooRexx samples distribution) for calculating the Catholic Easter Sunday and dependent holidays.
1-064_DateRgfOrthodoxEaster.rxj
Demonstrates the usage of the DateRgf class (part of the BSF4ooRexx samples distribution) for calculating the Orthodox Easter Sunday and dependent holidays.
1-070_demoDoOver.rxj
Demonstrates the usage of MAKEARRAY and SUPPLIER on the Java class java.lang.Enum (defines enum values; this sample uses the Enum class org.oorexx.misc.OldGreekAlphabetEnum) and the Java objects of type java.lang.Iterable, java.util.Collection, java.util.Enumeration, java.util.Iterator and java.util.Map.
1-080_charsetTranslations.rxj
Demonstrate how to use the public routine bsf.iconv(string,inCharset,outCharset) on German umlauts and German sharp-s.
1-090_formattingDateDecimal.rxj
Demonstrate how to use localization for formatting dates and decimal numbers.
1-100_setGetClibboard.rxj
Demonstrate how to set and get a string to/from the system's clipboard.
1-110_messageDigest.rxj
Demonstrate how to create a SHA-256 digest from data, taking advantage of the external Rexx function BsfRawData() to turn a Rexx string into a Java byte array and a Java byte array into a Rexx string.
1-120_JDOR_bw.rxj
Demonstrates how to use JDOR commands to draw a cross, a string (text) and superimpose a filled rectangle on it using a single (black) color. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-120_JDOR_color_text.rxj
Demonstrates how to use JDOR commands to draw a cross, a string (text) and superimpose a filled rectangle on it using different colors. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-130_JDOR_rotate.rxj
Demonstrates how to use JDOR commands to draw rectangles employing translation (moving the origin 0,0 around) and rotation. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-140_JDOR_images.rxj
Demonstrates the use of the JDOR commands loadImage and drawImage. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-140_JDOR_images_reversed.rxj
Demonstrate the use of the scale JDOR command to reverse the y-axis, causing the co-ordinates and images to be reversed. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-150_JDOR_string_circle.rxj
Demonstrates the use of the rotate JDOR command to draw strings in a circle. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-160_JDOR_getState.rxj
Demonstrates the use of the getState JDOR command and interacting with return values via the RC Rexx variable. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-170_JDOR_lineHeight.rxj
Demonstrates the use of the JDOR command font to fetch and query the size of it in order to calculate the necessary line height to draw multiple strings with the same line height. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-180_JDOR_sandGlass.rxj
Demonstrates the use of JDOR for drawing a sand glass using different colors and strokes. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-180_JDOR_sandGlass_log.rxj
Demonstrates the use of output redirection saved to a file named "1-180_JDOR_sandGlass_commands.log" (a text file) in order to create a log (recording) of all JDOR commands in canonized form.
1-180_JDOR_sandGlass_commands.log
The JDOR commands that created by 1-180_JDOR_sandGlass_log.rxj and used in 1-180_JDOR_sandGlass_replay_log.rxj to (re-)create the sand glass.
1-180_JDOR_sandGlass_replay_log.rxj
Demonstrates the use of input redirection from a file named "1-180_JDOR_sandGlass_commands.log" (a text file created by "1-180_JDOR_sandGlass_log.rxj" above). If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-190_JDOR_shapes.rxj
Demonstrates the use of JDOR to create, fill and draw Java2D Shapes (Arc2D, CubicCurve2D, Ellipse2D, Line2D, Path2D, Polygon, QuadCurve2D, Rectangle2D, RoundRectangle2D). If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-200_listFonts.rxj
Lists all font families installed on the system.
1-210_JDOR_area_cag.rxj
Demonstrates the use of JDOR for creating Area shapes from circles and the JDOR commands areaAdd (synonym: areaUnion), areaIntersect, areaSubtract, and areaExclusiveOr (synonym: areaXor). If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-220_JDOR_area_cag.rxj
Demonstrates the use of JDOR for combining two areas and have the resulting areas filled with colors to highlight them as well as drawing a border at the concluding area. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
1-230_show_clipBoard.rxj
Demonstrates using the .bsf.clipboard class. This sample will list all currently offered data flavors of the data in the system's clipboard if it is not empty.
1-240_Clipboard.rxj
Demonstrates using the .bsf.clipboard class which allows for interacting with the system clipboard, copying strings or images to it and getting strings or images from it. This sample will concentrate on demonstrating various string encodings which play an important role when copying and pasting strings to and from the system clipboard.
1-250_JDOR_to_clipboard.rxj
This program creates an image and copies it to the system clipboard using JDOR.
1-250_swriter_bsf_clipboard.rxj
This program creates an OpenOffice/LibreOffice swriter document, defines UTF-8 encoded symbols, copies them to the system clipboard and pastes them into the document, then has an image created and copied to the clipboard (by calling 1-250_JDOR_to_clipboard.rxj above) which then gets pasted into the document again.
Note: This program runs on all operating systems where Apache OpenOffice or LibreOffice are installed together with BSF4ooRexx850's support for them. If these applications were installed after BSF4ooRexx850 was installed, then run BSF4ooRexx850 -> Installation -> Reinstall BSF4ooRexx850 which installs the necessary support.
1-250_windows_swriter_ole_clipboard.rxj
This program creates an OpenOffice/LibreOffice swriter document, defines UTF-8 encoded symbols, copies them to the system clipboard and pastes them into the document, then has an image created and copied to the clipboard (by calling 1-250_JDOR_to_clipboard.rxj above) which then gets pasted into the document again.
Note: This program runs on Windows only as it exploits OLE (Object Linking and Embedding), Apache OpenOffice or LibreOffice need to be installed on the system.
1-250_windows_word_ole_clipboard.rxj
This program creates an OpenOffice/LibreOffice swriter document, defines UTF-8 encoded symbols, copies them to the system clipboard and pastes them into the document, then has an image created and copied to the clipboard (by calling 1-250_JDOR_to_clipboard.rxj above) which then gets pasted into the document again.
Note: This program runs on Windows only as it exploits OLE (Object Linking and Embedding), MS Word needs to be installed on the system.
1-260_getJavaMembers.rxj
Demonstrate how to create a utility that lists the members of a Java class. Either run it from the command line and supply a fully qualified Java class name or require it in your programs and use its public routines to get the members listed in form of a string.
2-010_demoJavaArrays.rxj
Demonstrate how to create and use Java array objects.
2-020_getFileInfo.rxj
Demonstrate using the Java class java.io.File to gain information about files/directories.
2-030_GetJavaSystemProperties.rxj
List all Java system properties of your Java installation. Loads explicitly the Java class java.lang.System and interrogates it.
2-031_GetJavaSystemProperties_doWith.rxj
List all Java system properties of your Java installation. Loads explicitly the Java class java.lang.System and demonstrates using the supplier 'do with ... over' introduced with ooRexx 5.0 with the Java system properties (an instance of java.util.Properties)
2-040_GetJavaSystemProperties1.rxj
List all Java system properties of your Java installation. Uses the existing reference to the Java class java.lang.System, which gets set up by the ooRexx package BSF.CLS and stored to an ooRexx directory that is always available by its environment symbol .BSF4Rexx and its entry System.class.
2-050_GetJavaSystemProperties2_sortWithTreeSet.rxj
Same as GetJavaSystemProperties.rxj but lists the properties alphabetically sorted in ascending order by employing the Java class java.util.TreeSet.
2-051_GetJavaSystemProperties2_sortWithRexx.rxj
Same as GetJavaSystemProperties.rxj but lists the properties alphabetically sorted in ascending order by turning the system properties keys into an ooRexx array which then gets sorted.
2-060_GetJavaSystemProperties3_toXML.rxj
Same as GetJavaSystemProperties.rxj but uses the methods store and storeToXML of the Java class java.lang.System to print all properties to the standard output (console).
2-070_RegexTestHarness.rxj
Allows for interactive experimenting with Java's regular expressions; the Java tutorial on regular expressions can be found at: http://java.sun.com/docs/books/tutorial/essential/regex/index.html.
2-080_ShowCount.rxj
Creates a little resizable window with a push button to count and reveal the number of times the button got pressed.
2-090_ShowSize.rxj
Creates a little resizable window with a push button to reveal the actual size; adds EventListeners in order for Rexx to be notified, if a button gets pressed.
2-100_functionsPerFile.rxj
Lists which BSF4ooRexx functions are used in which script in a folder.
2-110_JDOR_listShowPrintFonts.rxj
Demonstrates the use of the JDOR commands to create visual samples of all font families installed which can optionally printed. Each page with the font samples gets stored as a gif bitmap. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
2-120_JDOR_shear.rxj
Demonstrates the use of the JDOR commands to create arrowed axes with ticks (every 0.5cm and 1.0cm) arrows and a rectangle (one by two centimeters). The same drawing gets created at a different location demonstrating the effect of shear. This sample can be used to compare the Rexx commands directly with a Java program that achieves the same drawing by using the Java2D APIs directly. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
2-130_JDOR_animate_two_frames.rxj
Demonstrates the use of the JDOR commands to create two JDOR command handlers, moving their windows (frames) to the top left and top right hand side (that window has its frame removed) of the current screen, being always displayed on top of all other windows. The first (top left) handler is used to load three logos and draw them at different sizes, using the resulting image to draw it on the second (top right) window repeatedly after rotating and briefly sleeping, such that the top right window gets animated (approximately 30 times per second). If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
3-010_clock.rxj
Creates and updates a graphical clock using a JPanel. Demonstrates extending the javax.swing.JPanel class at runtime such that the extended methods in the new class will forward their invocation as Rexx messages to a Rexx proxy. This Rexx proxy must be supplied when creating an instance of the extended JPanel class. This allows to transfer control for updateComponent to the Rexx proxy, whenever the Java GUI infrastructure invokes the update mechanism.
3-020_Greetings.rxj
Creates a window with a choice-object and two text-fields and buttons; if the ok-button gets pressed then another window pops up and displays what was chosen and entered by the user.
3-030_info2html.rxj
Creates a HTML file that renders all BSF4ooRexx relevant version information as a HTML document. The generated file name starts with "info2thml_as_of_" followed by the date and time of running this program followed by ".html". The resulting HTML file can be inspected with any web browser.
3-040_quiz1.rxj
Demonstrates how to create a Java GUI version of Walter Pachl's quiz program. Employing in this case the GridBagLayout, cf. the tutorial at http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html (as of 2012-12-16).
3-050_quiz2.rxj
Demonstrates how to create a Java GUI version of Walter Pachl's quiz program. This version makes sure that the cells do not change in size, once a button text gets changed, also inserts space before the buttons using insets.
3-060_quiz3.rxj
Demonstrates how to create a Java GUI version of Walter Pachl's quiz program. This version makes sure that the cells do not change in size, once a button text gets changed, also inserts space before the buttons using insets. Employing in this case the GridBagLayout, cf. the tutorial at http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html (as of 2012-12-16). This version demonstrates how to exploit Actions, key bindings, and fonts.
3-070_ShootOut.rxj
Creates a window with a choice-object and two text-fields and buttons. Entering a question (indicated by a trailing question mark) will give a "magic-ball" answer. Originally developed at an International Rexx Symposium to meet the "Magic 8-Ball" challenge set forth by Chip Davis.
3-080_ShootOut2.rxj
Extends ShootOut.rxj above with the ability to edit the answer file after answering successfully a password popup (correct password: "hey").
3-090_update_awtSwing_GUI-from-non-GUI-thread.rxj
An awt GUI application that demonstrates how to update an awt/swing GUI object (a Label) from a non awt (non-GUI) thread using the methods of the public class .AwtGuiThread defined in BSF.CLS.
3-100_create_bitmap.rxj
Demonstrates how to create a bitmap (an image) with Java's Graphics2D and draw images (bsf4oorexx_256.png, oorexx4ooo_256.png, oorexx_256.png) in original and 50% size, how to draw lines, strings (text), polygons and some more...
The resulting bitmap gets saved in the user's home directory under the name 3-100_create_bitmap.png and shown using the appropraite operating system's command.
3-100_create_bitmap_JDOR_commands.rxj
Demonstrate the new JDOR Rexx command handler to achieve the same graphic as the one in "3-100_create_bitmap_JDOR.rxj" above. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
3-110_JDOR_animate_composite.rxj
Demonstrates the usage of the "composite" command to realize fade-in animation effects as well as moving out bitmaps (images) over the bottom edge, over the left edge and diagonally to the upper right hand corner. The window (frame) to demonstrate the animation effects gets positioned without a frame to the lower right hand of the screen. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.
4-010_demo-j8-lambda.rxj
Demonstrates how to use ooRexx code to be used in Java 8's lambda-related functional programming patterns.
Attention! This example needs at least Java 8 (1.8)
4-020_EuroCalcJava.rxj
Using Java's "awt (abstract window toolkit)" classes to create a portable GUI for converting Euro amounts to/from any of the original Euro currencies.
4-030_demoJSO.rxj
Demonstrates Please read the comments in the prolog of this program.
4-040_PrintFile.rxj
Allows to pick a file that then gets printed (user is allowed to pick the printer as well). Java "awt" version.
4-050_JPrintFile.rxj
Allows to pick a file that then gets printed (user is allowed to pick the printer as well). Java "swing" version.
4-060_runJavaClassMainMethod.rxj
Demonstrates how to invoke the static main() method of the given Java class, supplying optionally arguments given on the command line to Rexx (by Jack Woehr). If the Java class does not contain a public static main()-method, then an appropriate runtime error will be generated.
4-070_BezierCurves.rxj
ooRexx solution of Ruurd Idenburg's NetRexx BezierCurves demo program.
4-500_compileAndRunEmbeddedNetRexx.rxj
Demonstrates how to compile and use a NetRexx class in ooRexx:
4-600_compileAndRunEmbeddedNetRexx1.rxj
Demonstrates how to compile and use a NetRexx class in ooRexx: This program needs Java 8 (introduced streams) or later.
4-601_compileAndRunEmbeddedJava1.rxj
Demonstrates how to compile and use a Java class in ooRexx: This program needs Java 8 (introduced streams) or later.
4-610_compileAndUseEmbeddedNetRexx2.rxj
Demonstrates how to compile and use a NetRexx program embedded in the ooRexx program: the compiled NetRexx program can create abmysal sized arrays quickly (sometimes even faster than compiled C++!), but uses ooRexx to work on that array using Java streams that were introduced with Java 8
Demonstrates how to compile and use a NetRexx class in ooRexx: This program needs Java 8 (introduced streams) or later.
4-611_compileAndUseEmbeddedJava2.rxj
Demonstrates how to compile and use a Java program embedded in the ooRexx program: the compiled Java program can create abmysal sized arrays quickly (sometimes even faster than compiled C++!), but uses ooRexx to work on that array using Java streams that were introduced with Java 8
Demonstrates how to compile and use a Java class in ooRexx: This program needs Java 8 (introduced streams) or later.
4-700_compileAndUseEmbeddedNetRexx3.rxj
Demonstrates how to store a NetRexx class in source code with the help of the ooRexx RESOURCE directive, compile it at runtime with the public routine bsf.compile(...) from "BSF.CLS" and immediately use it from the running Rexx program.
4-701_compileAndUseEmbeddedJava3.rxj
Demonstrates how to store a Java class in source code with the help of the ooRexx RESOURCE directive, compile it at runtime with the public routine bsf.compile(...) from "BSF.CLS" and immediately use it from the running Rexx program.
9-020_swt_snippet108.rxj
Transcription of the Eclipse GUI class library "swt (Standard Widget Toolkit)" Java example "Snippet108.java" to ooRexx.
Attention! This example needs Eclipse's swt library (see section entitled "Releases"/"Stable") installed on your system and the environment variable CLASSPATH point to the swt.jar library!
jdor.rxj
A utility to turn JDOR into a tool: this filter reads JDOR commands from stdin and executes them. If supplying the argument ? (question mark) on the command line the executed JDOR commands get written to stdout in a canonized form.

The source of JDOR commands to execute may be a text file or any program that creates them and writes them to stdout.


Rony G. Flatscher, 2010-08-22, ..., 2023-07-16, Wien/Vienna, Austria, Europe