Declare all Components & MenuBar
This commit is contained in:
parent
18c1e33942
commit
a083903272
@ -10,10 +10,10 @@ import javafx.scene.control.ButtonType;
|
|||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
try {
|
try {
|
||||||
RootFlowPane root = new RootFlowPane();
|
RootBorderPane root = new RootBorderPane();
|
||||||
Scene scene = new Scene(root, 700, 500);
|
Scene scene = new Scene(root, 700, 500);
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
primaryStage.setTitle("GUI-Uebung 3");
|
primaryStage.setTitle("GUI-Uebung 4");
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
showAlert(AlertType.ERROR, e.getMessage());
|
showAlert(AlertType.ERROR, e.getMessage());
|
||||||
|
49
src/application/RootBorderPane.java
Normal file
49
src/application/RootBorderPane.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package application;
|
||||||
|
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Menu;
|
||||||
|
import javafx.scene.control.MenuBar;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
|
import javafx.scene.control.RadioButton;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
|
||||||
|
public class RootBorderPane extends BorderPane {
|
||||||
|
|
||||||
|
private MenuBar menuBar;
|
||||||
|
private Menu mDatei, mBearbeiten;
|
||||||
|
private MenuItem miBeenden, miReset;
|
||||||
|
|
||||||
|
private GridPane gpZentrum;
|
||||||
|
|
||||||
|
private RadioButton rbDirekt, rbLeerzeichen, rbLeerzeile;
|
||||||
|
|
||||||
|
private TextField tfText1, tfText2;
|
||||||
|
private TextArea taErgebnis;
|
||||||
|
|
||||||
|
private Button btVerbinden;
|
||||||
|
|
||||||
|
public RootBorderPane() {
|
||||||
|
initComponents();
|
||||||
|
addComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
menuBar = new MenuBar();
|
||||||
|
mDatei = new Menu("Datei");
|
||||||
|
mBearbeiten = new Menu("Bearbeiten");
|
||||||
|
miBeenden = new MenuItem("Beenden");
|
||||||
|
miReset = new MenuItem("Reset");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addComponents() {
|
||||||
|
mDatei.getItems().addAll(miBeenden);
|
||||||
|
mBearbeiten.getItems().addAll(miReset);
|
||||||
|
menuBar.getMenus().addAll(mDatei, mBearbeiten);
|
||||||
|
|
||||||
|
setTop(menuBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user