backup
This commit is contained in:
72
2/Lenj/Quadratzahlen.~ava
Normal file
72
2/Lenj/Quadratzahlen.~ava
Normal file
@@ -0,0 +1,72 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.event.*;
|
||||
import javafx.scene.text.*;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.collections.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 19.11.2024
|
||||
* @author
|
||||
*/
|
||||
|
||||
public class Quadratzahlen extends Application {
|
||||
// Anfang Attribute
|
||||
private Button bStart = 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, 198, 448);
|
||||
// Anfang Komponenten
|
||||
|
||||
bStart.setLayoutX(32);
|
||||
bStart.setLayoutY(32);
|
||||
bStart.setPrefHeight(24);
|
||||
bStart.setPrefWidth(80);
|
||||
bStart.setText("Start");
|
||||
bStart.setOnAction(
|
||||
(event) -> {bStart_Action(event);}
|
||||
);
|
||||
bStart.setFont(Font.font("Dialog", 11));
|
||||
root.getChildren().add(bStart);
|
||||
listView1.setLayoutX(16);
|
||||
listView1.setLayoutY(80);
|
||||
listView1.setPrefHeight(360);
|
||||
listView1.setPrefWidth(128);
|
||||
listView1.setItems(listView1ObservableList);
|
||||
|
||||
root.getChildren().add(listView1);
|
||||
// Ende Komponenten
|
||||
|
||||
primaryStage.setOnCloseRequest(e -> System.exit(0));
|
||||
primaryStage.setTitle("Quadratzahlen");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
} // end of public Quadratzahlen
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
} // end of main
|
||||
|
||||
public void bStart_Action(Event evt) {
|
||||
listView1ObservableList.remove(0,20);
|
||||
for (int i = 1; i < 21; i++) {
|
||||
listView1ObservableList.add(i+". " + i*i);
|
||||
}
|
||||
|
||||
} // end of bStart_Action
|
||||
|
||||
// Ende Methoden
|
||||
} // end of class Quadratzahlen
|
||||
Reference in New Issue
Block a user