feat: java-gtk dependency
This commit is contained in:
parent
3480aee84d
commit
d7c7b577ee
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
17
pom.xml
17
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>dev.ninjdai</groupId>
|
||||
<artifactId>stalgtk</artifactId>
|
||||
<artifactId>prosopagtk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
@ -13,5 +13,18 @@
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.bailuk</groupId>
|
||||
<artifactId>java-gtk</artifactId>
|
||||
<version>v0.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,17 +1,37 @@
|
||||
package dev.ninjdai;
|
||||
|
||||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||
import ch.bailu.gtk.gtk.Application;
|
||||
import ch.bailu.gtk.gtk.ApplicationWindow;
|
||||
import ch.bailu.gtk.gio.ApplicationFlags;
|
||||
import ch.bailu.gtk.gtk.Button;
|
||||
import ch.bailu.gtk.type.Strs;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
||||
// to see how IntelliJ IDEA suggests fixing it.
|
||||
System.out.printf("Hello and welcome!");
|
||||
var app = new Application("com.example.hello",
|
||||
ApplicationFlags.FLAGS_NONE);
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||
System.out.println("i = " + i);
|
||||
}
|
||||
app.onActivate(() -> {
|
||||
// Create a new window
|
||||
var window = new ApplicationWindow(app);
|
||||
|
||||
// Create a new button
|
||||
var button = new Button();
|
||||
|
||||
// Set button label
|
||||
button.setLabel("Hello, World!");
|
||||
|
||||
// When the button is clicked, close the window
|
||||
button.onClicked(window::close);
|
||||
|
||||
window.setChild(button);
|
||||
window.show();
|
||||
});
|
||||
|
||||
// Start application main loop
|
||||
var result = app.run(args.length, new Strs(args));
|
||||
|
||||
// Terminate with exit code
|
||||
System.exit(result);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user