Commit f4bc5dfc authored by Maria Barbatei's avatar Maria Barbatei

Adding GUI sample class in new package

parent d5a12420
Pipeline #2647 skipped
package org.uebung7.gui;
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;
import javafx.scene.layout.GridPane;
import javafx.geometry.Pos;
/**
* GUI Uebungsblatt 7 + 8
* @author mariabarbatei
*
*/
@SuppressWarnings("restriction")
public class Uebung7Gui extends Application implements EventHandler<ActionEvent> {
private static Button btnAufgabe1 = new Button();
private static Button btnAufgabe2 = new Button();
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
StackPane root = new StackPane();
GridPane grid = new GridPane();
primaryStage.setTitle("Uebung 7 + 8");
btnAufgabe1.setText("Aufgabe 1");
btnAufgabe2.setText("Aufgabe 2 + 3");
grid.setAlignment(Pos.CENTER);
grid.setVgap(10);
//add two grid two buttons
grid.add(btnAufgabe1, 2, 1);
grid.add(btnAufgabe2, 2, 2);
root.getChildren().add(grid);
primaryStage.setScene(new Scene(root, 300, 250));
//display box
primaryStage.show();
}
@Override
public void handle(ActionEvent event) {
// TODO Auto-generated method stub
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment