2024-04-01

This commit is contained in:
2024-04-01 20:11:09 +09:00
parent a2349837be
commit c4291c2746
26 changed files with 464 additions and 34 deletions

View File

@@ -0,0 +1,30 @@
plugins {
id("elex-application")
idea
id("org.openjfx.javafxplugin") version "0.1.0"
id("org.beryx.jlink") version "3.0.1"
}
application {
mainClass.set("kr.pe.elex.examples.components.HelloWorldApplication")
// mainModule.set("kr.pe.elex.examples.components")
}
javafx {
version = "23-ea+3"
modules = listOf("javafx.controls", "javafx.fxml")
}
jlink {
launcher {
name = project.name
}
}
idea{
module {
isDownloadJavadoc=true
isDownloadSources=true
}
}
dependencies {
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2024. Elex. All Rights Reesrved.
* https://www.elex-project.com/
*/
package kr.pe.elex.examples.components;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class FormApplication extends Application {
private Pane contentPane() {
final GridPane rootPanel = new GridPane();
final Text heading = new Text("Log In ");
heading.setFont(Font.font("Serif", FontWeight.BOLD, 16));
final Label lblId = new Label("User Name");
final TextField txtId = new TextField();
final Label lblPassword = new Label("Password");
final PasswordField txtPassword = new PasswordField();
final Button btn1 = new Button("Login");
final HBox hBox = new HBox();
hBox.setAlignment(Pos.CENTER_RIGHT);
hBox.setPadding(new Insets(4,4,4,4));
hBox.getChildren().add(btn1);
rootPanel.add(heading, 0,0,2,1);
rootPanel.add(lblId, 0,1);
rootPanel.add(txtId,1,1);
rootPanel.add(lblPassword, 0,2);
rootPanel.add(txtPassword,1,2);
rootPanel.add(hBox, 1,3,2,1);
rootPanel.setAlignment(Pos.CENTER);
rootPanel.setHgap(4);
rootPanel.setVgap(4);
rootPanel.setPadding(new Insets(16,16,16,16));
btn1.setOnAction(event -> {
System.out.println(txtId.getText());
System.out.println(txtPassword.getText());
});
return rootPanel;
}
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Hello, World");
primaryStage.setScene(new Scene(contentPane(), 800, 600));
primaryStage.show();
}
public static void main(String... args) {
launch(args);
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024. Elex. All Rights Reesrved.
* https://www.elex-project.com/
*/
package kr.pe.elex.examples.components;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class HelloWorldApplication extends Application {
private Pane contentPane() {
final Button btn1 = new Button("Click");
btn1.setOnAction(event -> {
System.out.println("Click!");
});
final BorderPane rootPanel = new BorderPane();
rootPanel.setCenter(btn1);
return rootPanel;
}
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Hello, World");
primaryStage.setScene(new Scene(contentPane(), 800, 600));
primaryStage.show();
}
public static void main(String... args) {
launch(args);
}
}

View File

@@ -0,0 +1,6 @@
/*
* Copyright (c) 2024. Elex. All Rights Reesrved.
* https://www.elex-project.com/
*/
package kr.pe.elex.examples.components;

View File

@@ -0,0 +1,7 @@
module javafx.examples.components.main {
requires javafx.graphics;
requires javafx.controls;
requires javafx.fxml;
exports kr.pe.elex.examples.components;
}