Examples for Java-GI
  • Java 69.8%
  • Kotlin 26.9%
  • Scala 2%
  • Clojure 0.8%
  • Ruby 0.5%
Find a file
2026-06-02 21:25:24 +02:00
Browser Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
Calculator Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
CodeEditor Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
ColumnViewDatagrid Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
GettingStarted Update to java-gi 1.0.0-RC1 2026-05-25 21:09:55 +02:00
HelloTemplate Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
HelloWorld Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
HelloWorldClojure Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
HelloWorldRuby Add Ruby example 2026-06-02 21:25:24 +02:00
HelloWorldScala Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
ImageViewer Update .gitignore 2026-05-25 21:00:31 +02:00
Javascript Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
ListViewer Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
Logging Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
MediaStream Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
Notepad Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
OpenGL Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
PegSolitaire Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
PlaySound Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
ScreenRecorder Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
Spacewar Update to java-gi 1.0.0-RC1 2026-05-25 20:58:47 +02:00
.gitignore Update .gitignore 2026-05-25 21:00:31 +02:00
LICENSE Initial commit 2023-05-10 22:52:02 +02:00
README.md Add Ruby example 2026-06-02 21:25:24 +02:00

Examples for Java-GI

This repository contains small example applications made with Java-GI, the Java bindings for GTK and many other GObject-Introspection-based libraries. Each example can be separately built and run:

Hello World

A typical "Hello World" example that displays a Gtk window with a button. When you click the button, the application quits.

Hello World - template based

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.

Calculator

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.

ColumnView Datagrid

An example GtkColumnView displaying a long grid of items.

List integration

This example demonstrates how you can use a Java ArrayList to implement the GListModel interface, which is central to all modern Gtk list widgets.

Notepad

A very basic Adwaita plain-text editor, that can load and save files using GIO.

Image Viewer

A basic Adwaita image viewer written in Scala with a clickable button that opens a file dialog.

Code editor

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.

Peg Solitaire

This game is a direct port of the Peg-Solitaire drag-and-drop example in the Gtk Demo.

WebkitGtk Web browser

This example creates a very basic web browser using WebkitGtk. It was inspired by the browser example in GNOME Workbench.

WebkitGtk Javascript callback

This example is a small WebkitGtk application that runs a Java callback function from a Javascript function in the webpage.

Mediastream

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.

GStreamer sound player

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.

GStreamer screen recorder

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.

Logging adapter

A small experiment to redirect the output of the GLib logging functions to the Java logging framework SLF4J.

Spacewar

The classic Spacewar game, ported from the cairo SVG Spacewar demo to Gtk4 and Kotlin, using Java-GI.

OpenGL

An OpenGL demo demonstrating how to achive 3D rendering using Gtk.GLArea together with LWJGL.