RingJavafor Ring

Applications

Forty-seven complete programs written in Ring with Swing: games, tools, database and web applications. Each has a screenshot made by the program itself.

Every application has its own folder: for example cd samples/UsingJava/applications/TicTacToe, then ring TicTacToe.ring. Set RINGJAVA_AUTOCLOSE to a number of milliseconds to close the window by itself.

ApplicationWhat it shows
TicTacToebuttons in a grid, the state of a game
Stopwatcha timer, formatting time
UnitConvertercombo boxes and a text field
PasswordGeneratorsecure random numbers, the clipboard
ColorMixersliders, a painted swatch
SnakeGamekey events, a timer, drawing on an image
GameOfLifea grid, mouse events, a timer
MemoryGamea grid of buttons and a timer that turns cards back
FileExplorera tree that loads folders when you expand them, a table
AddressBookan H2 database, a table, search while typing
WordCountera document listener and word statistics
Notepada menu, file dialogs and Java file I/O
TodoListJavaDatabase and the window builders
PaintBoardJCanvas: tools, colours, mouse events, saving a picture
SalesExplorerjQuery: filter, sort, group and total, shown in a table
WebDashboardJavaWebServer started and stopped from a window
ExpenseTrackerJavaDatabase, a table and a bar chart on JCanvas
LogAnalyzerjQuery over the lines of a log file, a table, an open dialog
Minesweepera grid of buttons, flood fill, flag mode
ImageViewerJava2D operations on a picture: gray, invert, flip, half size
Game2048arrow keys, sliding and joining tiles drawn on JCanvas
Tetriskey events, a falling piece on a timer, full rows that clear
Pongkeys held down and released, a ball and two paddles on a fast timer
Sudokua grid of text fields, a key listener for each, a backtracking solver
FifteenPuzzlesliding tiles on a grid of buttons, a shuffle that is always solvable
LightsOutbuttons that change a neighbourhood, painted button colours
Sokobanlevels as text, pushing boxes, squares drawn on JCanvas from picture files (loadImage, drawImage)
Hangmana gallows drawn on JCanvas, a keyboard of buttons
Calendara month grid and date facts from java.time
Calculatorbuttons and the keyboard (key events), a number display
TowersOfHanoimouse presses on JCanvas, a recursive solver that a timer plays, JSpinner
EightQueensa board of buttons, backtracking, counting the 92 solutions
TypingQuiza document listener, timing and mistakes
TemperatureConverterkey listeners that keep three text fields in step
BMICalculatora combo box, units, a history list
LoanCalculatora JTable filled from a loan formula
NumberGuessJSpinner, hints and a history
RockPaperScissorsbuttons, a score, a history
EpochTimeUnix time and java.time, both directions
JulianDayspinners that follow each other, Julian day arithmetic
AsciiTablea JTable with a filter that works while you type
Countdowna timer, a progress bar and spinners
DiceRollerdice drawn on JCanvas, statistics
LoginFormJPasswordField, a SHA-256 hash, validation, a limit of attempts
Contactsa console program with JavaDatabase (no window)
WebApia console web application: a page and a JSON API on JavaWebServer (no window)
AnalogClockJCanvas lines and circles, the time of java.time.LocalTime

Self test#

Every application checks itself: ring TicTacToe.ring --selftest builds the window, presses its buttons, compares what it shows with what it should show, prints a line for each check and ends with status 0 (all passed) or 1.

ring TicTacToe.ring --selftest
ok   after five moves
ok   X completes the line
ok   New game
3 passed, 0 failed

The checks are in the function selfTest() at the end of the program: it returns a list of [name, actual, expected]. jAutoClose() (called before jMainLoop()) runs it when the argument --selftest or the variable RINGJAVA_SELFTEST is present, so the same works in an application of your own, and in a program made by ring2exe. The test t25_selftest.ring runs the forty-seven applications this way.

RingJava - use Java classes and methods from Ring programs.