first commit
This commit is contained in:
30
Ugesedler/Ugeseddel-11-19-11-2025/.gitignore
vendored
Normal file
30
Ugesedler/Ugeseddel-11-19-11-2025/.gitignore
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
### IntelliJ IDEA ###
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
.kotlin
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
8
Ugesedler/Ugeseddel-11-19-11-2025/.idea/.gitignore
generated
vendored
Normal file
8
Ugesedler/Ugeseddel-11-19-11-2025/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
7
Ugesedler/Ugeseddel-11-19-11-2025/.idea/misc.xml
generated
Normal file
7
Ugesedler/Ugeseddel-11-19-11-2025/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KubernetesApiProvider"><![CDATA[{}]]></component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="zulu-21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
Ugesedler/Ugeseddel-11-19-11-2025/.idea/modules.xml
generated
Normal file
8
Ugesedler/Ugeseddel-11-19-11-2025/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Ugeseddel-11-19-11-2025.iml" filepath="$PROJECT_DIR$/Ugeseddel-11-19-11-2025.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
36
Ugesedler/Ugeseddel-11-19-11-2025/src/HelloWorld.java
Normal file
36
Ugesedler/Ugeseddel-11-19-11-2025/src/HelloWorld.java
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HelloWorld extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
Button btn = new Button();
|
||||
btn.setText("Say 'Hello World'");
|
||||
btn.setOnAction(new EventHandler<ActionEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
});
|
||||
|
||||
StackPane root = new StackPane();
|
||||
root.getChildren().add(btn);
|
||||
Scene scene = new Scene(root, 300, 250);
|
||||
|
||||
primaryStage.setTitle("Hello World!");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
86
Ugesedler/Ugeseddel-11-19-11-2025/src/StackPaneDemo.java
Normal file
86
Ugesedler/Ugeseddel-11-19-11-2025/src/StackPaneDemo.java
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class StackPaneDemo extends Application {
|
||||
|
||||
private StackPane stackPane;
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
|
||||
VBox root = new VBox();
|
||||
|
||||
// StackPane
|
||||
stackPane = new StackPane();
|
||||
|
||||
// add label to StackPane
|
||||
Label label = new Label("I'm a Label");
|
||||
label.setStyle("-fx-background-color:yellow");
|
||||
label.setPadding(new Insets(5,5,5,5));
|
||||
stackPane.getChildren().add(label);
|
||||
|
||||
// add Button to StackPane
|
||||
Button button = new Button("I'm a Button");
|
||||
button.setStyle("-fx-background-color: cyan");
|
||||
button.setPadding(new Insets(5,5,5,5));
|
||||
stackPane.getChildren().add(button);
|
||||
|
||||
// add CheckBox to StackPane
|
||||
CheckBox checkBox = new CheckBox("I'm a CheckBox");
|
||||
checkBox.setOpacity(1);
|
||||
checkBox.setStyle("-fx-background-color:olive");
|
||||
checkBox.setPadding(new Insets(5,5,5,5));
|
||||
stackPane.getChildren().add(checkBox);
|
||||
|
||||
stackPane.setPrefSize(300, 150);
|
||||
root.getChildren().add(stackPane);
|
||||
|
||||
Button controlButton = new Button("Change Top");
|
||||
|
||||
root.getChildren().add(controlButton);
|
||||
root.setAlignment(Pos.CENTER);
|
||||
VBox.setMargin(stackPane, new Insets(10, 10, 10, 10));
|
||||
VBox.setMargin(controlButton, new Insets(10, 10, 10, 10));
|
||||
|
||||
Scene scene = new Scene(root, 550, 250);
|
||||
primaryStage.setTitle("StackPane Layout Demo");
|
||||
primaryStage.setScene(scene);
|
||||
|
||||
controlButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
changeTop();
|
||||
}
|
||||
});
|
||||
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
private void changeTop() {
|
||||
ObservableList children = this.stackPane.getChildren();
|
||||
|
||||
if (children.size() > 1) {
|
||||
//
|
||||
Node topNode = (Node) (children.get(children.size()-1));
|
||||
topNode.toBack();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
}
|
||||
47
Ugesedler/Ugeseddel-11-19-11-2025/src/TestJavaFX.java
Normal file
47
Ugesedler/Ugeseddel-11-19-11-2025/src/TestJavaFX.java
Normal file
@@ -0,0 +1,47 @@
|
||||
// author: Benjamin Bogø
|
||||
import javafx.application.Application;
|
||||
import javafx.event.*;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class TestJavaFX extends Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
private int counter = 0;
|
||||
private Button button = new Button();
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("Hello World!");
|
||||
this.button.setText("Im a counter! Click ME!!!");
|
||||
this.button.setOnAction(this::handleClick);
|
||||
StackPane root = new StackPane();
|
||||
root.getChildren().add(this.button);
|
||||
Scene scene = new Scene(root, 300, 250);
|
||||
scene.addEventHandler(KeyEvent.KEY_PRESSED, this::handleKey);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
private void handleClick(ActionEvent event) {
|
||||
this.counter++;
|
||||
this.button.setText("" + this.counter);
|
||||
}
|
||||
|
||||
private void handleKey(KeyEvent event) {
|
||||
if (event.getCode() == KeyCode.UP) {
|
||||
this.counter++;
|
||||
} else if (event.getCode() == KeyCode.DOWN) {
|
||||
this.counter--;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
this.button.setText("" + this.counter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.event.*;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class UgeseddelFormiddag extends Application {
|
||||
public static void main(String[] args) {launch(args);}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("Hello");
|
||||
StackPane root = new StackPane();
|
||||
root.getChildren().add(new Button("Button 1"));
|
||||
Scene scene = new Scene(root, 300, 250);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user