public void displayPane() throws IOException {

    addStationsToCB();

    paneTop.getColumnConstraints().add(new ColumnConstraints(60));
    paneTop.getColumnConstraints().add(new ColumnConstraints(200));
    paneTop.getColumnConstraints().add(new ColumnConstraints(100));

    paneBot.getColumnConstraints().add(new ColumnConstraints(60));
    paneBot.getColumnConstraints().add(new ColumnConstraints(200));
    paneBot.getColumnConstraints().add(new ColumnConstraints(100));

    paneCenter.getColumnConstraints().add(new ColumnConstraints(300));

    paneTop.setPadding(new Insets(10, 10, 10, 10));
    paneTop.setAlignment(Pos.CENTER);
    paneTop.setHgap(5);
    paneTop.setVgap(5);

    paneBot.setPadding(new Insets(10, 10, 10, 10));
    paneBot.setAlignment(Pos.CENTER);
    paneBot.setHgap(5);
    paneBot.setVgap(5);

    paneTop.add(new Label("Station :"), 0, 0);
    paneTop.add(cbStations, 1, 0);
    paneTop.add(btOpen, 2, 0);

    paneBot.add(new Label("Quantity :"), 0, 0);
    paneBot.add(cbQuantity, 1, 0);
    paneBot.add(btShow, 2, 0);

    paneTop.setHalignment(btOpen, HPos.RIGHT);
    paneBot.setHalignment(btShow, HPos.RIGHT);

    paneCenter.setHgap(5);
    paneCenter.setVgap(5);
    paneCenter.setAlignment(Pos.CENTER);
    sp.setContent(paneCenter);
    sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
    bp.setMargin(sp, new Insets(20, 50, 40, 50));
    bp.setTop(paneTop);
    bp.setCenter(sp);
    bp.setBottom(paneBot);

    btOpen.setOnAction(
        e -> {
          try {
            open();
          } catch (IOException er) {
            er.printStackTrace();
          }
        });

    btShow.setOnAction(e -> showGraph());
  }
  public static GridPane addGridPane(Pane parent) {
    GridPane gridPane = new GridPane();
    AnchorPane.setLeftAnchor(gridPane, 10d);
    AnchorPane.setRightAnchor(gridPane, 10d);
    AnchorPane.setTopAnchor(gridPane, 10d);
    AnchorPane.setBottomAnchor(gridPane, 10d);
    gridPane.setHgap(Layout.GRID_GAP);
    gridPane.setVgap(Layout.GRID_GAP);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.SOMETIMES);

    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);

    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);

    parent.getChildren().add(gridPane);
    return gridPane;
  }
  public GridPaneSample() {

    VBox vbox = new VBox();

    // grid1 places the child by specifying the rows and columns in
    // GridPane.setContraints()
    Label grid1Caption =
        new Label(
            "The example below shows GridPane content placement by specifying rows and columns:");
    grid1Caption.setWrapText(true);
    GridPane grid1 = new GridPane();
    grid1.setHgap(4);
    grid1.setVgap(6);
    grid1.setPadding(new Insets(18, 18, 18, 18));
    ObservableList<Node> content = grid1.getChildren();

    Label label = new Label("Name:");
    GridPane.setConstraints(label, 0, 0);
    GridPane.setHalignment(label, HPos.RIGHT);
    content.add(label);

    label = new Label("John Q. Public");
    GridPane.setConstraints(label, 1, 0, 2, 1);
    GridPane.setHalignment(label, HPos.LEFT);
    content.add(label);

    label = new Label("Address:");
    GridPane.setConstraints(label, 0, 1);
    GridPane.setHalignment(label, HPos.RIGHT);
    content.add(label);

    label = new Label("12345 Main Street, Some City, CA");
    GridPane.setConstraints(label, 1, 1, 5, 1);
    GridPane.setHalignment(label, HPos.LEFT);
    content.add(label);

    vbox.getChildren().addAll(grid1Caption, grid1, new Separator());

    // grid2 places the child by influencing the rows and columns themselves
    // via GridRowInfo and GridColumnInfo. This grid uses the preferred
    // width/height and max/min width/height.
    Label grid2Caption =
        new Label(
            "The example below shows GridPane content placement by influencing the rows and columns themselves.");
    grid2Caption.setWrapText(true);
    grid2Caption.setWrapText(true);
    GridPane grid2 = new GridPane();
    grid2.setPadding(new Insets(18, 18, 18, 18));
    RowConstraints rowinfo = new RowConstraints(40, 40, 40);
    ColumnConstraints colinfo = new ColumnConstraints(90, 90, 90);

    for (int i = 0; i <= 2; i++) {
      grid2.getRowConstraints().add(rowinfo);
    }

    for (int j = 0; j <= 2; j++) {
      grid2.getColumnConstraints().add(colinfo);
    }

    Label category = new Label("Category:");
    GridPane.setHalignment(category, HPos.RIGHT);
    Label categoryValue = new Label("Wines");
    Label company = new Label("Company:");
    GridPane.setHalignment(company, HPos.RIGHT);
    Label companyValue = new Label("Acme Winery");
    Label rating = new Label("Rating:");
    GridPane.setHalignment(rating, HPos.RIGHT);
    Label ratingValue = new Label("Excellent");

    ImageView imageView = new ImageView(ICON_48);
    GridPane.setHalignment(imageView, HPos.CENTER);

    // Place content
    GridPane.setConstraints(category, 0, 0);
    GridPane.setConstraints(categoryValue, 1, 0);
    GridPane.setConstraints(company, 0, 1);
    GridPane.setConstraints(companyValue, 1, 1);
    GridPane.setConstraints(imageView, 2, 1);
    GridPane.setConstraints(rating, 0, 2);
    GridPane.setConstraints(ratingValue, 1, 2);
    grid2
        .getChildren()
        .addAll(category, categoryValue, company, companyValue, imageView, rating, ratingValue);

    vbox.getChildren().addAll(grid2Caption, grid2, new Separator());

    // grid3 places the child by influencing the rows and columns
    // via GridRowInfo and GridColumnInfo. This grid uses the percentages
    Label grid3Caption =
        new Label(
            "The example below shows GridPane content placement by influencing row and column percentages.  Also, grid lines are made visible in this example.  The lines can be helpful in debugging.");
    grid3Caption.setWrapText(true);
    GridPane grid3 = new GridPane();
    grid3.setPadding(new Insets(18, 18, 18, 18));
    grid3.setGridLinesVisible(true);
    RowConstraints rowinfo3 = new RowConstraints();
    rowinfo3.setPercentHeight(50);

    ColumnConstraints colInfo2 = new ColumnConstraints();
    colInfo2.setPercentWidth(25);

    ColumnConstraints colInfo3 = new ColumnConstraints();
    colInfo3.setPercentWidth(50);

    grid3.getRowConstraints().add(rowinfo3); // 2*50 percent
    grid3.getRowConstraints().add(rowinfo3);

    grid3.getColumnConstraints().add(colInfo2); // 25 percent
    grid3.getColumnConstraints().add(colInfo3); // 50 percent
    grid3.getColumnConstraints().add(colInfo2); // 25 percent

    Label condLabel = new Label(" Member Name:");
    GridPane.setHalignment(condLabel, HPos.RIGHT);
    GridPane.setConstraints(condLabel, 0, 0);
    Label condValue = new Label("MyName");
    GridPane.setMargin(condValue, new Insets(0, 0, 0, 10));
    GridPane.setConstraints(condValue, 1, 0);

    Label acctLabel = new Label("Member Number:");
    GridPane.setHalignment(acctLabel, HPos.RIGHT);
    GridPane.setConstraints(acctLabel, 0, 1);
    TextField textBox = new TextField("Your number");
    GridPane.setMargin(textBox, new Insets(10, 10, 10, 10));
    GridPane.setConstraints(textBox, 1, 1);

    Button button = new Button("Help");
    GridPane.setConstraints(button, 2, 1);
    GridPane.setMargin(button, new Insets(10, 10, 10, 10));
    GridPane.setHalignment(button, HPos.CENTER);

    GridPane.setConstraints(condValue, 1, 0);
    grid3.getChildren().addAll(condLabel, condValue, button, acctLabel, textBox);

    vbox.getChildren().addAll(grid3Caption, grid3);

    getChildren().add(vbox);
  }
  private void erzeugeDetailAnsicht(PolizistDaten SpaltenDaten) {
    Label LabelA = new Label("PersonenID");
    Label LabelAWert = new Label(Integer.toString(SpaltenDaten.getPersonenID()));

    Label LabelB = new Label("Name");
    Label LabelBWert = new Label(SpaltenDaten.getName());

    Label LabelC = new Label("Geburtsdatum");
    Label LabelCWert = new Label(SpaltenDaten.getGebDatum());

    Label LabelD = new Label("Nationalität");
    Label LabelDWert = new Label(SpaltenDaten.getNation());

    Label LabelE = new Label("Geschlecht");
    Label LabelEWert = new Label(SpaltenDaten.getGeschlecht());

    Label LabelF = new Label("Todesdatum");
    Label LabelFWert = new Label(SpaltenDaten.getTodDatum());

    Label LabelG = new Label("Dienstgrad");
    Label LabelGWert = new Label(SpaltenDaten.getDienstgrad());

    Button ButtonBearbeiten = new Button("Bearbeiten...");
    Button ButtonLoeschen = new Button("Löschen");

    Button ButtonSuchePerson = new Button("Suche nach Person");
    Button ButtonSucheArbeit = new Button("Suche nach Arbeitsverhältnissen");
    Button ButtonSucheArbeitAn = new Button("Suche nach zugewiesenen Fällen");
    Button ButtonSucheNotizen = new Button("Suche nach erstellten Notizen");
    Button ButtonSucheIndizien = new Button("Suche nach eingestellten Indizien");

    Button ButtonClose = new Button("Detailansicht verlassen");

    ButtonBearbeiten.setOnAction(
        event -> {
          Tabelle.getSelectionModel().clearSelection();
          Tabelle.getSelectionModel().select(SpaltenDaten);
          updateSelectedEntry();
          Hauptprogramm.setRechteAnsicht(null);
        });
    ButtonLoeschen.setOnAction(
        event -> {
          Tabelle.getSelectionModel().clearSelection();
          Tabelle.getSelectionModel().select(SpaltenDaten);
          deleteSelectedEntrys();
          Hauptprogramm.setRechteAnsicht(null);
        });

    ButtonSuchePerson.setOnAction(
        event -> {
          Hauptprogramm.setRechteAnsicht(null);
          PersonenAM.PersonenSuchAnsicht(SpaltenDaten.getPersonenID());
        });
    ButtonSucheArbeit.setOnAction(
        event -> {
          Hauptprogramm.setRechteAnsicht(null);
          ArbeitenAM.SucheNachPersonenID(SpaltenDaten.getPersonenID());
        });
    ButtonSucheArbeitAn.setOnAction(
        event -> {
          Hauptprogramm.setRechteAnsicht(null);
          ArbeitenAnAM.SucheNachPersonenID(SpaltenDaten.getPersonenID());
        });
    ButtonSucheNotizen.setOnAction(
        event -> {
          Hauptprogramm.setRechteAnsicht(null);
          NotizAM.SucheNachAnlegendem(SpaltenDaten.getPersonenID());
        });
    ButtonSucheIndizien.setOnAction(
        event -> {
          Hauptprogramm.setRechteAnsicht(null);
          IndizAM.SucheNachAnlegendem(SpaltenDaten.getPersonenID());
        });

    ButtonClose.setOnAction(event -> Hauptprogramm.setRechteAnsicht(null));

    ButtonBearbeiten.setMaxWidth(Double.MAX_VALUE);
    ButtonBearbeiten.setMinWidth(150);
    ButtonLoeschen.setMaxWidth(Double.MAX_VALUE);
    ButtonLoeschen.setMinWidth(150);
    ButtonSuchePerson.setMaxWidth(Double.MAX_VALUE);
    ButtonSucheArbeit.setMaxWidth(Double.MAX_VALUE);
    ButtonSucheArbeitAn.setMaxWidth(Double.MAX_VALUE);
    ButtonSucheNotizen.setMaxWidth(Double.MAX_VALUE);
    ButtonSucheIndizien.setMaxWidth(Double.MAX_VALUE);
    ButtonClose.setMaxWidth(Double.MAX_VALUE);

    // Wir haben ein Gridpane oben, eine HBox unten in einer VBox in einem ScrollPane
    GridPane Oben = new GridPane();
    Oben.setHgap(10);
    Oben.setVgap(10);
    Oben.addColumn(0, LabelA, LabelB, LabelC, LabelD, LabelE, LabelF, LabelG);
    Oben.addColumn(
        1, LabelAWert, LabelBWert, LabelCWert, LabelDWert, LabelEWert, LabelFWert, LabelGWert);
    Oben.getColumnConstraints().add(new ColumnConstraints(100));
    Oben.getColumnConstraints().add(new ColumnConstraints(200));

    HBox Unten = new HBox(10);
    Unten.getChildren().addAll(ButtonBearbeiten, ButtonLoeschen);
    Unten.setMaxWidth(300);
    Unten.alignmentProperty().setValue(Pos.CENTER);

    VBox Mittelteil = new VBox(10);
    Mittelteil.setPadding(new Insets(10, 20, 10, 10));
    Mittelteil.getChildren()
        .addAll(
            Oben,
            Unten,
            ButtonSuchePerson,
            ButtonSucheArbeit,
            ButtonSucheArbeitAn,
            ButtonSucheNotizen,
            ButtonSucheIndizien,
            ButtonClose);

    ScrollPane Aussen = new ScrollPane();

    Aussen.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    Aussen.setContent(Mittelteil);

    Hauptprogramm.setRechteAnsicht(Aussen);
  }
Exemple #5
0
    @Override
    public void start(Stage primaryStage) throws Exception {

        brett = new GridPane();
        panes = new MinStackPane[3][3];
        panes1d = new MinStackPane[9];

        /* Lag rutenett */
        int t = 0;
        for (int r = 0; r < 3; r++) {
            for (int k = 0; k < 3; k++) {
                MinStackPane pane = new MinStackPane(t, " ", r, k);
                pane.setStyle("-fx-border-color: black");
                pane.setOnMouseReleased(new Lytter(pane));
                panes[r][k] = pane;
                panes1d[t] = pane;
                brett.add(pane, k, r);
                t++;
            }
        }

        /* Lag rutene like store og sett brettet i midten 
        * Constraint -> begrensning
        */
        int storrelse = 150;
        for (int i = 0; i < 3; i++) {
            brett.getColumnConstraints().add(new ColumnConstraints(storrelse));
            brett.getRowConstraints().add(new RowConstraints(storrelse));
        }
        brett.setAlignment(Pos.CENTER);

        /* Klarer-knapp */
        Button klarer = new Button("Klarer");
        klarer.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                for (MinStackPane pane : panes1d) {
                    pane.getChildren().clear();
                    pane.settTekst(" ");
                }
            }
        });
        klarer.setAlignment(Pos.CENTER);

        /* DET SAMME! */
        root = new BorderPane(brett);
//        root = new BorderPane();
//        root.getChildren().add(brett);
        root.setTop(new FlowPane(klarer));

        ticTacScene = new Scene(root);
        
        /* Lag startvindu med en knapp for å bytte scene */
        Button startButton = new Button("La oss starte");
        /* Annonym klasse (IKKE PENSUM) */
        startButton.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                // Bytt scnee ved knappetrykk
                primaryStage.setScene(ticTacScene);
            }
        });
        FlowPane startRoot = new FlowPane(startButton);
        startScene = new Scene(startRoot);

        primaryStage.setScene(startScene);
        primaryStage.setTitle("TicTacToe");
        primaryStage.show();

    }