Yes, I'm completely mad.
Yes, I know about Wakefield, and Caciocavallo, both have been in progress(ish) for years... nothing has arrived in mainline JDK to fix the internal JDK bugs that prevent a proper Wayland AWT Toolkit. There is a horrid fix in Caciocavallo which uses reflection to monkey about inside the JDK, and needs many command line switches to circumvent security controls...
Yes, I know about XWayland - it's horribly broken for Swing applications (try one!) and is intended as a stop gap, not a long term solution.
By re-using the interfaces of Swing, and providing completely new implementations that lean on Wayland and maybe a component toolkit..
Presently, we build a new module / package com.ashbysoft.swingland
, so client code will have to adjust imports to use us - this is by design
and also avoids horrible pain in replacing a system module (java.desktop
) which is apparantly impossible without rebuilding the whole JDK..
I've chosen to use Ant as it provides just enough build tooling, is self contained, plus I know how to drive it.
Build/clean:
% ant [clean|compile|package (default)] [...]
.....
Test:
% ant [test-wayland|test-swingland|test]
.....
where the test-wayland
target directly creates a Wayland window on screen, fills it with random dots for a few seconds and terminates.
The test-swingland
target runs a Swing GUI application that extends a JComponent
and draws stuff in the paintComponent()
method.
It has a working menu bar that demonstrates the popup windows and menuing logic, you can exit via it! test-swingland
also demonstrates
a couple of pop up JDialog
s (Swing flavour), one with some JLabel
s and JButton
s in a JSplitPane
, one with a JTabbedPane
...
more to come as I write it! The test
target runs both tests.
test.jar
)I have started importing some of the standard Swing demos as additional test applications, they should work largely unaltered apart from import statements..
Run one:
% java -cp bin/test.jar com.ashbysoft.test.[TopLevelDemo|ButtonDemo]
fed.jar
)Font EDitor is a dogfooding application written with swingland
to edit bitmap font files (res/fonts
and res/cursors
) used by swingland
..
Run it:
% java -jar bin/fed.jar -f <font file> [--help]
test.jar
)FontTest was written to test both the PCF font support and font transformations (ie: rotation), run it:
% java -cp bin/test.jar [--help] [-r] <font name> [...]
where -r
rotates the specified fonts instead of simply printing a line of each, font name
can be one of: a logical name eg: MONOSPACED
;
a resource path in the swingland.jar
file for built-in bitmap fonts eg: /cursors/CURLY
; a file path for PCF fonts, either absolute or
relative to paths in XDG_DATA_DIRS
(by default: /usr/local/share:/usr/share
), eg: /path/to/font.pcf
, X11/fonts/misc/10x20.pcf.gz
.
I've ported my own applications to Swingland, noteably:
See LICENCE.md