Inceptum/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/TestStart.java

42 lines
1.7 KiB
Java

package io.gitlab.jfronny.inceptum.gtk;
import org.gtk.gio.ApplicationFlags;
import org.gtk.gtk.*;
import io.gitlab.jfronny.commons.ref.R;
public class TestStart {
public static void main(String[] args) {
var app = new Application(GtkMain.ID, ApplicationFlags.FLAGS_NONE);
app.onActivate(() -> {
var button = Button.newWithLabel("Test");
button.onClicked(TestStart::test);
var window = new ApplicationWindow(app);
window.setDefaultSize(200, 50);
window.title = "Inceptum";
window.child = button;
window.show();
GtkEnvBackend.INSTANCE.dialogParent = window;
window.onCloseRequest(() -> {
GtkEnvBackend.INSTANCE.dialogParent = null;
return false;
});
});
System.exit(app.run(args.length, args));
}
private static void test() {
GtkEnvBackend backend = GtkEnvBackend.INSTANCE;
backend.getInput("Ae", "IoU\naee", "Def", R::nop, R::nop);
// backend.showInfo("Some message", "Title");
// backend.showError("Yes!", "AAee");
// backend.showError("Nes!", new ArrayIndexOutOfBoundsException("Top 500 cheese"));
// backend.showOkCancel("Some Message\nYes!", "TitL", () -> backend.showInfo("Pressed OK", "OK"), () -> backend.showError("Pressed CANCEL", "CANCEL"));
// backend.getInput("This is a prompt", """
// These are some extremely interesting and detailed (hence the name) details!
// This is a second line, since these details
// are just THAT important!""", "Default", value -> backend.showInfo("Received " + value, "Input"), () -> backend.showInfo("Got no input :/", "Input"));
}
}