import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.scene.control.*;
import javafx.scene.text.*;
import javafx.scene.text.Font;
import je.NumberField;
import javafx.event.*;
import javafx.collections.*;

/**
 *
 * Beschreibung
 *
 * @version 1.0 vom 06.11.2024
 * @author 
 */

public class test extends Application {
  // Anfang Attribute
  public Label title = new Label();
  
  private int windowWidth = 500;
  private int windowHeight = 300;
  private NumberField field1 = new NumberField();
  private Button button1 = new Button();
  private ListView<String> listView1 = new ListView<>();
  private ObservableList<String> listView1ObservableList = 
            FXCollections.observableArrayList();
  // Ende Attribute
  
  public void start(Stage primaryStage) { 
    Pane root = new Pane();
    Scene scene = new Scene(root, windowWidth, windowHeight);
    // Anfang Komponenten
    
    title.setLayoutX(8);
    title.setLayoutY(8);
    title.setPrefHeight(24);
    title.setPrefWidth(264);
    title.setText("Just Testing");
    title.setFont(Font.font("Dialog", 15));
    
    title.setContentDisplay(ContentDisplay.CENTER);
    root.getChildren().add(title);
    field1.setLayoutX(8);
    field1.setLayoutY(40);
    field1.setPrefHeight(24);
    field1.setPrefWidth(136);
    field1.setFont(Font.font("Dialog", 14));
    field1.setPromptText("Number");
    root.getChildren().add(field1);
    button1.setLayoutX(88);
    button1.setLayoutY(80);
    button1.setPrefHeight(24);
    button1.setPrefWidth(80);
    button1.setText("Button");
    button1.setOnAction(
    (event) -> {button1_Action(event);} 
    );
    button1.setFont(Font.font("Dialog", 11));
    root.getChildren().add(button1);
    listView1.setLayoutX(0);
    listView1.setLayoutY(104);
    listView1.setPrefHeight(112);
    listView1.setPrefWidth(120);
    listView1.setItems(listView1ObservableList);
    listView1ObservableList.add("Amerika");
    listView1ObservableList.add("Europa");
    listView1ObservableList.add("Asien");
    root.getChildren().add(listView1);
    // Ende Komponenten
    
    primaryStage.setOnCloseRequest(e -> System.exit(0));
    primaryStage.setTitle("test");
    primaryStage.setScene(scene);
    primaryStage.show();
  } // end of public test
  
  // Anfang Methoden
  
  public static void main(String[] args) {
    launch(args);
  } // end of main
  
  public void button1_Action(Event evt) {
    title.setText("wadaw");  
    System.out.println(field1.getInt() * 123);
    listView1ObservableList.add("Asien");      
    
  } // end of button1_Action

  // Ende Methoden
} // end of class test
