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

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

public class Steigung extends Application {
  // Anfang Attribute
  private NumberField numberField1 = new NumberField();
  private NumberField numberField2 = new NumberField();
  private NumberField numberField3 = new NumberField();
  private NumberField numberField4 = new NumberField();
  private Button bRechnen = new Button();
  private Label lergebnis = new Label();
  private Label lX = new Label();
  private Label lY = new Label();
  private Label lX21 = new Label();
  private Label lY21 = new Label();
  // Ende Attribute
  
  public void start(Stage primaryStage) { 
    Pane root = new Pane();
    Scene scene = new Scene(root, 313, 242);
    // Anfang Komponenten
    
    numberField1.setLayoutX(8);
    numberField1.setLayoutY(40);
    numberField1.setPrefHeight(24);
    numberField1.setPrefWidth(80);
    numberField1.setFont(Font.font("Dialog", 11));
    root.getChildren().add(numberField1);
    numberField2.setLayoutX(8);
    numberField2.setLayoutY(88);
    numberField2.setPrefHeight(24);
    numberField2.setPrefWidth(80);
    numberField2.setFont(Font.font("Dialog", 11));
    root.getChildren().add(numberField2);
    numberField3.setLayoutX(184);
    numberField3.setLayoutY(40);
    numberField3.setPrefHeight(24);
    numberField3.setPrefWidth(80);
    numberField3.setFont(Font.font("Dialog", 11));
    root.getChildren().add(numberField3);
    numberField4.setLayoutX(184);
    numberField4.setLayoutY(88);
    numberField4.setPrefHeight(24);
    numberField4.setPrefWidth(80);
    numberField4.setFont(Font.font("Dialog", 11));
    root.getChildren().add(numberField4);
    bRechnen.setLayoutX(104);
    bRechnen.setLayoutY(136);
    bRechnen.setPrefHeight(24);
    bRechnen.setPrefWidth(80);
    bRechnen.setText("Rechnen");
    bRechnen.setOnAction(
    (event) -> {bRechnen_Action(event);} 
    );
    bRechnen.setFont(Font.font("Dialog", 11));
    root.getChildren().add(bRechnen);
    lergebnis.setLayoutX(16);
    lergebnis.setLayoutY(184);
    lergebnis.setPrefHeight(24);
    lergebnis.setPrefWidth(168);
    lergebnis.setText("ergebnis");
    lergebnis.setFont(Font.font("Dialog", 11));
    root.getChildren().add(lergebnis);
    lX.setLayoutX(8);
    lX.setLayoutY(16);
    lX.setPrefHeight(24);
    lX.setPrefWidth(80);
    lX.setText("X1");
    lX.setFont(Font.font("Dialog", 11));
    root.getChildren().add(lX);
    lY.setLayoutX(8);
    lY.setLayoutY(64);
    lY.setPrefHeight(24);
    lY.setPrefWidth(80);
    lY.setText("Y2");
    lY.setFont(Font.font("Dialog", 11));
    root.getChildren().add(lY);
    lX21.setLayoutX(184);
    lX21.setLayoutY(16);
    lX21.setPrefHeight(24);
    lX21.setPrefWidth(80);
    lX21.setText("X2");
    lX21.setFont(Font.font("Dialog", 11));
    root.getChildren().add(lX21);
    lY21.setLayoutX(184);
    lY21.setLayoutY(64);
    lY21.setPrefHeight(24);
    lY21.setPrefWidth(80);
    lY21.setText("Y2");
    lY21.setFont(Font.font("Dialog", 11));
    root.getChildren().add(lY21);
    // Ende Komponenten
    
    primaryStage.setOnCloseRequest(e -> System.exit(0));
    primaryStage.setTitle("Steigung");
    primaryStage.setScene(scene);
    primaryStage.show();
  } // end of public Steigung
  
  // Anfang Methoden
  
  public static void main(String[] args) {
    launch(args);
  } // end of main
  
  public void bRechnen_Action(Event evt) {
    double x1 = ;
    double y1 = 2;
    
    double x2 = 6;
    double y2 = 7;
    
    System.out.println("Steigung: " + ((y2 - y1)/(x2 - x1)));
    
  } // end of bRechnen_Action

  // Ende Methoden
} // end of class Steigung
