This repository contains small example applications made with Java-GI. Each example can be separately built and run with gradle run
:
A typical "Hello World" example that displays a Gtk window with a button. When you click the button, the application quits.
This is a bit more complete "Hello World" example that is based on the default application that GNOME Builder generates for new Vala projects. It uses Gtk composite template classes to define the user interface in XML files. It also includes a Flatpak manifest and instructions to install and run the example as a Flatpak application.
A basic calculator that uses Gtk and LibAdwaita. There's a header bar, and a grid-based layout for the buttons. The app reacts to key presses as expected.
An example GtkColumnView displaying a long grid of items.
This example demonstrates how you can use a Java ArrayList to implement the GListModel interface, which is central to all modern Gtk list widgets.
A very basic Adwaita plain-text editor, that can load and save files using GIO.
A source code editor. It is mostly the same application as the Notepad example above, but this one uses GtkSourceview as the text widget and enables line numbers and syntax highlighting.
This game is a direct port of the Peg-Solitaire drag-and-drop example in the Gtk Demo.
This example creates a very basic web browser using WebkitGtk. It was inspired by the browser example in GNOME Workbench.
This example is a small WebkitGtk application that runs a Java callback function from a Javascript function in the webpage.
The Mediastream example is ported from GtkDemo. It paints a simple image using Cairo, and then rotates the image in a GtkVideo widget. The Cairo draw commands use the Cairo Java bindings.
This example demonstrates how to use GStreamer and is ported from the GStreamer tutorials. It creates a GStreamer pipeline that will play sound from an Ogg Vorbis file.
A command-line screen recording utility that records the screen for 5 seconds into an Ogg/Theora file. It also demonstrates how to add a Tee and an AppSink to the pipeline so you can trigger custom actions on the recorded data.
A small experiment to redirect the output of the GLib logging functions to the Java logging framework SLF4J.
The classic Spacewar game, ported from the cairo SVG Spacewar demo to Gtk4 and Kotlin, using Java-GI.