Ejemplo n.º 1
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setVgap(10);
    grid.setHgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Scene sc = new Scene(grid, 500, 500);

    String css = Main.class.getResource("Login.css").toExternalForm();
    //        System.out.println(css);
    sc.getStylesheets().add(css);

    Text scenetitle = new Text("Welcome");
    //        scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0, 1, 1);

    Label userName = new Label("User Name:");
    grid.add(userName, 0, 1);

    TextField userTextField = new TextField("Мудак");
    grid.add(userTextField, 1, 1);

    Label pw = new Label("Password:"******"Sign in");
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);
    grid.add(hbBtn, 1, 4);

    final Text actiontarget = new Text();
    grid.add(actiontarget, 1, 6);

    btn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            //                actiontarget.setFill(Color.FIREBRICK);
            actiontarget.setText("Pressed");
          }
        });

    //        grid.setGridLinesVisible(true);

    scenetitle.setId("welc");
    actiontarget.setId("act");

    primaryStage.setScene(sc);
    primaryStage.setTitle("Hello World");
    primaryStage.show();
  }
Ejemplo n.º 2
0
  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());
  }
Ejemplo n.º 3
0
  @Override
  protected BorderPane getPane() {

    BorderPane pane = new BorderPane();
    GridPane paneFullTime = new GridPane();

    paneFullTime.setAlignment(Pos.CENTER);
    paneFullTime.setPadding(new Insets(11, 12, 13, 14));
    paneFullTime.setHgap(5.5);
    paneFullTime.setVgap(5.5);

    paneFullTime.add(text, 0, 0);
    paneFullTime.add(tfSSN, 1, 0);

    paneFullTime.add(arrNonCreditChBox[0], 0, 2);
    paneFullTime.add(arrNonCreditChBox[1], 0, 3);
    paneFullTime.add(arrNonCreditChBox[2], 0, 4);
    paneFullTime.add(submitBt, 1, 5);

    pane.setCenter(paneFullTime);

    submitBt.setOnAction(
        e -> {
          checkingRequirements();
          connectToDB();
          submitToDB();
          pane.setCenter(new Congratulation().getPane());
        });
    return pane;
  }
Ejemplo n.º 4
0
  @Override // Override the start method in the Application class
  public void start(Stage primaryStage) throws Exception {
    // Create a pane and set its properties
    GridPane pane = new GridPane();
    pane.setAlignment(Pos.CENTER);
    pane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5));
    pane.setHgap(5.5);
    pane.setVgap(5.5);

    // Place nodes in the pane
    pane.add(new Label("First Name:"), 0, 0);
    pane.add(new TextField(), 1, 0);
    pane.add(new Label("MI:"), 0, 1);
    pane.add(new TextField(), 1, 1);
    pane.add(new Label("Last Name:"), 0, 2);
    pane.add(new TextField(), 1, 2);
    Button btAdd = new Button("Add Name");
    pane.add(btAdd, 1, 3);
    GridPane.setHalignment(btAdd, HPos.RIGHT);

    // Create a scene and place it in the stage
    Scene scene = new Scene(pane);
    primaryStage.setTitle("ShowGridPane"); // Set the stage title
    primaryStage.setScene(scene); // Place the scene in the stage
    primaryStage.show(); // Display the stage
  }
Ejemplo n.º 5
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    Random rand = new Random();

    GridPane layout = new GridPane();
    layout.setGridLinesVisible(true);
    layout.setAlignment(Pos.CENTER);
    layout.setVgap(2);
    layout.setHgap(2);
    layout.setPadding(new Insets(10, 10, 10, 10));

    int j = 0;
    for (int i = 0; i < 11; i++) {

      int newRandomNum = rand.nextInt((1 - 0) + 1) + 0;
      TextField number = new TextField();
      number.setText(Integer.toString(newRandomNum));

      if (i > 9) {
        if (j > 8) {
          break;
        } else {
          j++;
          i = 0;
        }
      }

      layout.add(number, j, i);
    }

    Scene scene = new Scene(layout, 300, 300);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
Ejemplo n.º 6
0
  public FXDialog() {
    // Setup general stage and main grid
    msgLabel = detLabel = null;
    stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(10, 10, 10, 10));

    // Add the OK button (it's a default)
    buttonArea = new HBox(10);
    Button okBtn = new Button("OK");
    okBtn.setOnAction(
        event -> {
          okPressed = true;
          stage.hide();
        });
    buttonArea.getChildren().add(okBtn);
    grid.add(buttonArea, 1, 2);

    // ImageView imageView = new ImageView();
    // grid.add(imageView, 0, 0);

    // Add a 50 width pane for spacing and also as we plan on adding an image at 0,0
    // some time in the future
    Pane pane = new Pane();
    pane.setMinWidth(50);
    grid.add(pane, 0, 1);

    stage.setScene(new Scene(grid, 250, 100));
    okPressed = false;
  }
  @FXML
  void initialize() {
    getAllImageViewsForButtons();
    configureWidthHeightForImageViews();
    configureButtons();
    contentPane.setAlignment(Pos.CENTER);

    // show all customers and all employees
    titleLabel.setText("All Customers and All Employees");
    TableView table = new TableView();

    TableColumn fnCol = new TableColumn("First Name");
    fnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn lnCol = new TableColumn("Last Name");
    lnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn emailCol = new TableColumn("email");
    emailCol.setCellValueFactory(new PropertyValueFactory<>("email"));

    table.getColumns().addAll(fnCol, lnCol, emailCol);

    ObservableList<Person> data =
        FXCollections.observableArrayList(operation.getAllCustomersAndEmployees());
    table.setItems(data);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    contentPane.getChildren().add(table);
  }
Ejemplo n.º 8
0
  private GridPane createGridPane() {
    GridPane grid = new GridPane();
    grid.setHgap(hGap);
    grid.setVgap(vGap);
    grid.setPadding(new Insets(topOffset, rightOffset, bottomOffset, leftOffset));
    grid.setAlignment(Pos.CENTER);

    return grid;
  }
Ejemplo n.º 9
0
 public BusPlace() {
   seatsList = new ArrayList<>();
   bus.setArcHeight(8);
   bus.setArcWidth(8);
   bus.setFill(Color.TRANSPARENT);
   bus.setStrokeWidth(2);
   bus.setWidth(500);
   bus.setHeight(200);
   bus.setStyle("-fx-stroke:-color-accent");
   gridPane.setAlignment(Pos.CENTER);
   StackPane.setAlignment(gridPane, Pos.CENTER);
   this.getChildren().addAll(bus, gridPane);
 }
Ejemplo n.º 10
0
    public Scene sc(String message) {
      GridPane gp = new GridPane();
      gp.setMaxSize(150, 150);
      Button text = new Button(message);
      text.setOnAction(eventClose -> stage.close());
      text.setFont(new Font("Arial", 20));
      text.setAlignment(Pos.CENTER);
      gp.setAlignment(Pos.CENTER);
      gp.getChildren().add(text);
      Scene sc = new Scene(gp, 300, 150);

      return sc;
    }
Ejemplo n.º 11
0
  /**
   * Constructs base grid and its components for window.
   *
   * @return constructed grid with components
   */
  private GridPane addGridPane() {
    GridPane grid = new GridPane();
    grid.setPrefSize(400, 400);

    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(insets);

    addList(grid);

    return grid;
  }
Ejemplo n.º 12
0
  @Override
  public void start(Stage primaryStage) {

    GridPane root = new GridPane();
    root.setAlignment(Pos.CENTER);
    root.setHgap(10);
    root.setVgap(10);
    root.setPadding(new Insets(25, 25, 25, 25));
    Scene scene = new Scene(root, 1024, 768);

    primaryStage.setTitle("Plookify");
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Ejemplo n.º 13
0
  private GridPane getSubGrid() {
    subGrid = new GridPane();

    topPane = getTopPane();
    bottomPane = getBottomPane();

    topPane.setPadding(new Insets(50));
    bottomPane.setPadding(new Insets(50));
    subGrid.setPadding(new Insets(0, 100, 0, 100));

    // Css styling
    topPane.getStyleClass().add("TopPaneBorder");
    bottomPane.getStyleClass().add("TopPaneBorder");

    topTitleL.getStyleClass().add("topPaneTitle");
    bottomTitle.getStyleClass().add("topPaneTitle");

    bottomPane.setHgap(10);
    bottomPane.setVgap(5);
    bottomPane.setAlignment(Pos.CENTER_LEFT);

    topPane.setVgap(10);
    topPane.setHgap(10);
    topPane.setAlignment(Pos.CENTER);

    subGrid.setAlignment(Pos.CENTER);
    subGrid.setMargin(topPane, new Insets(10));
    subGrid.setMargin(bottomPane, new Insets(10));

    subGrid.setConstraints(topPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);
    subGrid.setConstraints(bottomPane, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER);

    subGrid.getChildren().addAll(topPane, bottomPane);

    return subGrid;
  }
 public SoapServiceVirtualUiMainPanel(
     final SoapServiceVirtualizeDto soap, final VirtualizationUiOptions wireMockOptions) {
   this.soap = soap;
   this.wireMockOptions = wireMockOptions;
   GridPane pane = new GridPane();
   pane.setAlignment(Pos.TOP_LEFT);
   pane.setHgap(10);
   pane.setVgap(10);
   setPadding(new Insets(5, 10, 5, 10));
   Label wsdlUrl = new Label("Wsdl URL:");
   Text requestXml = new Text("Request\nXml");
   requestXml.setTextAlignment(TextAlignment.JUSTIFY);
   Text responseXml = new Text("Response\nXml");
   responseXml.setTextAlignment(TextAlignment.JUSTIFY);
   loadWsdlButton = new MsstButton("LoadWsdl");
   wsdrlUrlTextField = new MsstTextField();
   wsdrlUrlTextField.setText(soap.getWsdlURL());
   GridPane.setHalignment(wsdrlUrlTextField, HPos.LEFT);
   Text endPointUrl = new Text("End point\nURL");
   operationList = new ComboBox<String>();
   serviceEndPointUrl = new MsstTextField();
   pane.add(wsdlUrl, 0, 1, 1, 1);
   pane.add(wsdrlUrlTextField, 1, 1, 5, 1);
   pane.add(loadWsdlButton, 6, 1, 2, 1);
   pane.add(endPointUrl, 0, 2);
   pane.add(serviceEndPointUrl, 1, 2, 5, 1);
   pane.add(operationList, 6, 2, 1, 1);
   saveButton = new MsstButton("Save Stub");
   requestTextArea = new MsstTextArea(soap.getRequestXml());
   responseTextArea = new MsstTextArea(soap.getResponseXml());
   requestTextArea.setMinWidth(300);
   responseTextArea.setMinWidth(300);
   GridPane.setHalignment(saveButton, HPos.CENTER);
   pane.add(requestXml, 0, 3, 1, 1);
   pane.add(requestTextArea, 1, 3, 2, 1);
   pane.add(responseXml, 3, 3, 1, 1);
   pane.add(responseTextArea, 4, 3, 3, 1);
   pane.add(saveButton, 0, 4, 5, 1);
   saveButton.setOnAction(saveButtonActionEvent);
   operationList.setOnAction(listActionListener);
   loadWsdlButton.setOnAction(loadWsdlActionListener);
   setFitToHeight(true);
   setFitToWidth(true);
   setContent(pane);
 }
Ejemplo n.º 15
0
  private void addLogin(final Stage primaryStage) {
    grid = new GridPane();
    btn = new Button();
    scenetitle = new Text("Welcome");
    userName = new Label("Name:");
    userTextField = new TextField();
    userTextField.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent event) {
            if (event.getCode().equals(KeyCode.ENTER)) {
              login(primaryStage);
            }
          }
        });

    btn.setText("Sign in");
    btn.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            login(primaryStage);
          }
        });

    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));

    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    grid.add(scenetitle, 0, 0);
    grid.add(userName, 0, 1);
    grid.add(userTextField, 1, 1);
    grid.add(btn, 0, 2);

    Scene scene = new Scene(grid, 300, 275);
    primaryStage.setTitle("Chat Login");
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Ejemplo n.º 16
0
  public void checkResultScreen(String[] listOfImageAsk) {

    VBox vbox = new VBox(40);
    GridPane grid = new GridPane();
    grid.setGridLinesVisible(false);
    Image imgYes =
        new Image(
            "file:C:\\Users\\emaktse\\Documents\\HITSA\\GIT Repository\\javaProject\\Images library\\yes.gif");
    ImageView imageViewYes = new ImageView(imgYes);
    Image imgNo =
        new Image(
            "file:C:\\Users\\emaktse\\Documents\\HITSA\\GIT Repository\\javaProject\\Images library\\no.gif");
    ImageView imageViewNo = new ImageView(imgNo);

    int i = 0;
    for (int j = 0; j < 7; j++) {
      for (int k = 0; k < 7; k++) {
        Image image = allImages[i];
        ImageView imageCheck = new ImageView(image);
        imageCheck.setId(i + ".gif");
        grid.add(imageCheck, k, j);
        i++;
      }
    }

    grid.setOnMouseClicked(
        e -> {
          ImageView imageViewSourceRef = (ImageView) e.getTarget();
          reactOnMouseClick(grid, listOfImageAsk, imgYes, imgNo, imageViewSourceRef);
        });

    Button tryAgain = new Button("Try again");
    grid.setAlignment(Pos.CENTER);
    vbox.getChildren().addAll(grid, tryAgain);
    vbox.setAlignment(Pos.CENTER);

    scene4 = new Scene(vbox, 1000, 800);
    window1.setScene(scene4);
  }
  @Override
  protected void selectBuilds(String source) {
    jenkinsClient = new JenkinsClient(source);
    BuildSelector buildSelector = new BuildSelector(jenkinsClient.getAllBuildConfigurations());

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    grid.add(buildSelector, 0, 0);
    Scene scene = new Scene(grid, 250, 400);

    m_primaryStage.setScene(scene);

    Button btn = new Button();
    btn.setText("Show me hotspots!");
    btn.setOnAction(event -> AddDrawingToScene(buildSelector.getSelectedBuilds()));

    grid.add(btn, 0, 1);
  }
Ejemplo n.º 18
0
  public GridPane addGameZone() {

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.TOP_LEFT);
    grid.setPadding(new Insets(0, 0, 0, 0));

    Integer rowPositioner = 0;
    Integer colPositioner = 0;

    for (int i = 0; i < 10; i++) {
      Rectangle rect = new Rectangle();
      rect.setHeight(10);
      rect.setWidth(10);
      rect.setFill(Paint.valueOf("white"));
      rect.setStroke(Paint.valueOf("black"));
      grid.add(rect, colPositioner, rowPositioner);

      rowPositioner++;
      colPositioner++;
    }

    return grid;
  }
Ejemplo n.º 19
0
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("Authentication");
    TextField usernameTxtFld = new TextField();
    PasswordField passwordTxtFld = new PasswordField();

    Label UserLbl = new Label("Username");
    Label PassLbl = new Label("Password");

    Button submit = new Button("Submit");
    Button submit2 = new Button("Submit");
    submit.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent arg0) {
            // int i=0;
            String inputUser = "";
            String inputPass = "";
            String Username = "******";
            String Password = "******";

            do {
              inputUser = usernameTxtFld.getText();
              inputPass = passwordTxtFld.getText();
              System.out.print(inputUser);
              System.out.print(inputPass);
              if (inputUser.equals(Username) && (inputPass.equals(Password))) {
                JOptionPane.showMessageDialog(null, "welcome" + inputUser);
                System.out.print("hello");
                break;

              } else {

              }

            } while (!inputUser.equals(Username) && (!inputPass.equals(Password)));

            for (int i = 0; i < 3; i++) {
              inputUser = usernameTxtFld.getText();
              inputPass = passwordTxtFld.getText();
              if (inputUser.equals(Username) && (inputPass.equals(Password))) {
                JOptionPane.showMessageDialog(null, "Welcome" + inputUser);
                i = 12;
              } else {

              }
            }
          }
        });

    GridPane grid2 = new GridPane();
    grid2.setAlignment(Pos.CENTER);
    grid2.setVgap(10);
    ;

    grid2.add(UserLbl, 0, 0);
    grid2.add(PassLbl, 0, 1);
    grid2.add(usernameTxtFld, 1, 0);
    grid2.add(passwordTxtFld, 1, 1);
    grid2.add(submit, 1, 2);
    Scene scene = new Scene(grid2, 500, 500);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Ejemplo n.º 20
0
  /**
   * Das GUI besteht aus zwei wesentlichen Komponenten, einer GridPane namens entryArea und einem
   * TextAreaHandler, beide sind in eine BorderPane eingebettet.
   */
  @Override
  protected Scene create_GUI() {

    // ServiceLocator und Translator werden gesetzt.
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();

    // Die MenuBar enthält die Sprachauswahl
    MenuBar menuBar = new MenuBar();
    menuFile = new Menu(t.getString("program.menu.file"));
    menuFileLanguage = new Menu(t.getString("program.menu.file.language"));
    menuFile.getItems().add(menuFileLanguage);

    for (Locale locale : sl.getLocales()) {
      MenuItem language = new MenuItem(locale.getLanguage());
      menuFileLanguage.getItems().add(language);
      language.setOnAction(
          event -> {
            sl.setTranslator(new Translator(locale.getLanguage()));
            updateTexts();
          });
    }

    BorderPane root = new BorderPane();
    root.setPrefSize(409, 219);

    menuBar.getMenus().addAll(menuFile);
    root.setTop(menuBar);

    /**
     * ______________________________________________________________________________________________
     * START OF GRIDPANE !!! ENTRYAREA !!!
     */

    // Serverentry Area
    GridPane entryArea = new GridPane();
    entryArea.setAlignment(Pos.CENTER);
    root.setCenter(entryArea);

    Label lblIP = new Label();
    lblIP.setText("IP: ");
    ;
    lblIP.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblIP, 0, 0);
    GridPane.setMargin(lblIP, new Insets(5, 5, 0, 50));

    Label lblPort = new Label();
    lblPort.setText("Port: ");
    lblPort.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblPort, 0, 1);
    GridPane.setMargin(lblPort, new Insets(5, 5, 0, 50));

    lblHostName = new Label();
    lblHostName.setAlignment(Pos.CENTER_LEFT);
    lblHostName.setId("lblHostName");
    entryArea.add(lblHostName, 0, 2);
    GridPane.setMargin(lblHostName, new Insets(5, 5, 0, 50));

    tfIP = new TextField();
    tfIP.setId("tfIP");
    tfIP.setEditable(false);
    entryArea.add(tfIP, 1, 0);
    GridPane.setMargin(tfIP, new Insets(5, 5, 0, 0));

    tfPort = new TextField();
    tfPort.setId("tfPort");
    tfPort.setText("14000");
    tfPort.setPromptText("Bitte Portnummer eingeben.");
    entryArea.add(tfPort, 1, 1);
    GridPane.setMargin(tfPort, new Insets(5, 5, 0, 0));

    btnStart = new Button();
    btnStart.setId("btnStart");
    btnStart.setText(t.getString("button.start"));
    entryArea.add(btnStart, 2, 0);
    GridPane.setMargin(btnStart, new Insets(5, 5, 0, 50));

    btnClose = new Button();
    btnClose.setId("btnClose");
    btnClose.setText(t.getString("button.close"));
    entryArea.add(btnClose, 2, 1);
    GridPane.setMargin(btnClose, new Insets(5, 5, 0, 50));

    /**
     * ______________________________________________________________________________________________
     * START OF !!! TEXTAREAHANDLER !!!
     */
    textAreaHandler = new TextAreaHandler();
    taLogger = textAreaHandler.getTextArea();
    taLogger.setId("taLogger");
    taLogger.setEditable(false);
    root.setBottom(taLogger);

    Scene scene = new Scene(root);

    return scene;
  }
Ejemplo n.º 21
0
  public Veld2Verkeerstechniek(
      LeerlingController llnCntrl, SchermController schermCtrl, EvaController evaCtrl) {
    evaController = evaCtrl;
    schermController = schermCtrl;
    llnController = llnCntrl;
    llnController.getLeerling().addView(this);
    hoogte = schermController.getHoogte();
    breedte = schermController.getBreedte();
    mainGP = new GridPane();

    // evaSelector
    eva = new EvaSelector(evaController);

    // labels
    kleur = new Button("Kleur kiezen");
    venster = new Button("Extra venster");

    kleur.setMinSize(120, 30);
    kleur.setMaxSize(120, 30);
    venster.setMinSize(120, 30);
    venster.setMaxSize(120, 30);

    kleur.setStyle(
        "-fx-border-color: black; -fx-border-width:1; -fx-border-style: solid; -fx-background-color: WHITE");
    kleur.setAlignment(Pos.CENTER);
    venster.setStyle(
        "-fx-border-color: black; -fx-border-width:1; -fx-border-style: solid; -fx-background-color: WHITE");
    venster.setAlignment(Pos.CENTER);

    kleur.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            selecteerKleur();
          }
        });
    venster.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            selecteerVenster();
          }
        });

    labels = new HBox();
    labels.setSpacing(15);
    labels.setTranslateY(-hoogte * 0.75);
    labels.setTranslateX(20);
    labels.getChildren().addAll(kleur, venster);

    // alle afbeeldingen
    // Links
    links = new GridPane();
    openbareWegImg =
        new Onderdeel("resource/Verkeerstechniek/openbareWeg", -140, 160, evaController);
    openbareWegImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKPLAATS_ID);
          }
        });
    richtingaanwijzersImg =
        new Onderdeel("resource/Verkeerstechniek/richtingaanwijzers", 120, 140, evaController);
    richtingaanwijzersImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKRICHTINGAANWIJZERS_ID);
          }
        });
    rechtsafImg = new Onderdeel("resource/Verkeerstechniek/rechtsaf", 220, 160, evaController);
    rechtsafImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKRECHTSAF_ID);
          }
        });
    linksafImg = new Onderdeel("resource/Verkeerstechniek/linksaf", 120, 190, evaController);
    linksafImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKLINKSAF_ID);
          }
        });
    kruisenImg = new Onderdeel("resource/Verkeerstechniek/kruisen", 60, 155, evaController);
    kruisenImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKKRUISEN_ID);
          }
        });
    // Rechts
    rechts = new GridPane();
    voorrangImg = new Onderdeel("resource/Verkeerstechniek/voorrang", -140, 160, evaController);
    voorrangImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKVOORRANG_ID);
          }
        });
    verkeerstekensImg =
        new Onderdeel("resource/Verkeerstechniek/verkeerstekens", -25, 140, evaController);
    verkeerstekensImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKVERKEERSTEKENS_ID);
          }
        });
    snelheidImg = new Onderdeel("resource/Verkeerstechniek/snelheid", 30, 155, evaController);
    snelheidImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKSNELHEID_ID);
          }
        });
    afstandImg = new Onderdeel("resource/Verkeerstechniek/afstand", -25, 190, evaController);
    afstandImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKAFSTAND_ID);
          }
        });
    inhalenImg = new Onderdeel("resource/Verkeerstechniek/inhalen", 220, 160, evaController);
    inhalenImg.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            Veld2Verkeerstechniek.this.schermController.setScherm(
                MainApp.VELD2VERKEERSTECHNIEKINHALEN_ID);
          }
        });
    // pijlen center
    pijlen = new Pijlen(evaController, 300);

    // GridPane links
    links.add(inhalenImg, 0, 0);
    links.add(richtingaanwijzersImg, 0, 1);
    links.add(kruisenImg, 0, 2);
    links.add(linksafImg, 0, 3);
    links.add(rechtsafImg, 0, 4);

    // GridPane rechts
    rechts.add(voorrangImg, 0, 0);
    rechts.add(verkeerstekensImg, 0, 1);
    rechts.add(snelheidImg, 0, 2);
    rechts.add(afstandImg, 0, 3);
    rechts.add(openbareWegImg, 0, 4);

    // opmaak
    // algemeen
    mainGP.setHgap(50);
    // links
    links.setAlignment(Pos.CENTER);
    links.setVgap(20);
    links.setMaxWidth(80);
    inhalenImg.setFitHeight(80);
    inhalenImg.setFitWidth(80);
    inhalenImg.setTranslateX(180);
    richtingaanwijzersImg.setFitHeight(80);
    richtingaanwijzersImg.setFitWidth(80);
    richtingaanwijzersImg.setTranslateX(75);
    richtingaanwijzersImg.setTranslateY(-30);
    kruisenImg.setFitHeight(80);
    kruisenImg.setFitWidth(80);
    kruisenImg.setTranslateX(10);
    linksafImg.setFitHeight(80);
    linksafImg.setFitWidth(80);
    linksafImg.setTranslateX(75);
    linksafImg.setTranslateY(30);
    rechtsafImg.setFitHeight(80);
    rechtsafImg.setFitWidth(80);
    rechtsafImg.setTranslateX(180);
    // rechts
    rechts.setAlignment(Pos.CENTER);
    rechts.setVgap(20);
    rechts.setMaxWidth(80);
    voorrangImg.setFitHeight(80);
    voorrangImg.setFitWidth(80);
    voorrangImg.setTranslateX(-180);
    verkeerstekensImg.setFitHeight(80);
    verkeerstekensImg.setFitWidth(80);
    verkeerstekensImg.setTranslateX(-75);
    verkeerstekensImg.setTranslateY(-30);
    snelheidImg.setFitHeight(80);
    snelheidImg.setFitWidth(80);
    snelheidImg.setTranslateX(-10);
    afstandImg.setFitHeight(80);
    afstandImg.setFitWidth(80);
    afstandImg.setTranslateX(-75);
    afstandImg.setTranslateY(30);
    openbareWegImg.setFitHeight(80);
    openbareWegImg.setFitWidth(80);
    openbareWegImg.setTranslateX(-180);
    // pijlen center
    pijlen.setAlignment(Pos.CENTER);
    pijlen.setTranslateY(10);

    // Exit button
    exit = new Button("Ga terug");
    exit.setTranslateX(50);
    exit.setTranslateY(75);

    eva.setTranslateX(-50);
    eva.setTranslateY(75);

    // eventhandler
    exit.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            exitVerkeerstechniek();
          }
        });
    exit.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");

    for (Node c : links.getChildren()) {
      if (c instanceof Onderdeel) {
        c.setOnMouseClicked(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                KleurKiezerHouder.show(links, (Onderdeel) c);
              }
            });
      }
    }

    for (Node c : rechts.getChildren()) {
      if (c instanceof Onderdeel) {
        c.setOnMouseClicked(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                KleurKiezerHouder.show(rechts, (Onderdeel) c);
              }
            });
      }
    }

    eva.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            update();
          }
        });
    this.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            update();
          }
        });

    // achtergrond
    achtergrond = new ImageView("resource/Verkeerstechniek/achtergrondVt.png");
    achtergrond.setTranslateX(breedte / 2);
    mainGP.setTranslateX(-breedte * 0.53);
    mainGP.setTranslateY(5);
    mainGP.setMinWidth(breedte);
    mainGP.setMaxWidth(breedte);

    // Alle Gridpanes toevoegen an hoofd GridPane
    // volgorde is belangrijk, niet aanpassen!
    mainGP.add(pijlen, 2, 0);
    mainGP.add(rechts, 3, 0);
    mainGP.add(links, 1, 0);
    mainGP.add(exit, 3, 1);
    mainGP.add(labels, 2, 1);
    mainGP.add(eva, 1, 1);
    mainGP.setAlignment(Pos.CENTER);
    // mainGP.setStyle("-fx-background-color: #003399");

    this.getChildren().add(achtergrond);
    this.getChildren().add(mainGP);
    this.setAlignment(Pos.CENTER);

    selecteerKleur();
    update();
  }
Ejemplo n.º 22
0
  static GridPane createGUI() {
    /** TODO update */
    GridPane gridpane = new GridPane();

    gridpane.setId("SysInfoGUI");

    // Setting alignment
    gridPaneAlignment.gridPaneAlign(gridpane);
    gridpane.setAlignment(Pos.CENTER);

    /**
     * Column constraints to set the min, pref and max width for the columns. Only applies to the
     * topgridpane, hence the top preface :)
     */
    ColumnConstraints topLeftColumn = new ColumnConstraints(75, 125, 300);
    topLeftColumn.setHalignment(HPos.RIGHT);
    // ColumnConstraints topCenterColumn = new ColumnConstraints(150, 250, 300);
    // ColumnConstraints topRightColumn = new ColumnConstraints(50, 100, 300);
    gridpane.getColumnConstraints().addAll(topLeftColumn);

    /** Left Column */
    Label labelWinVer = new Label("Windows Version: ");
    gridpane.add(labelWinVer, 0, 0);
    gridpane.add(getWinVers(), 1, 0);

    Label labelSysManufac = new Label("Manufacturer: ");
    gridpane.add(labelSysManufac, 0, 1);
    gridpane.add(getSysMan(), 1, 1);

    Label labelSysModel = new Label("Model: ");
    gridpane.add(labelSysModel, 0, 2);
    gridpane.add(getSysModel(), 1, 2);

    Label labelSysSerial = new Label("Serial: ");
    gridpane.add(labelSysSerial, 0, 3);
    gridpane.add(getSysSerial(), 1, 3);

    Label labelCompName = new Label("Computer Name: ");
    gridpane.add(labelCompName, 0, 4);
    gridpane.add(getCompName(), 1, 4);

    /** Center Column */
    Label labelProcessor = new Label("Processor: ");
    gridpane.add(labelProcessor, 0, 5);
    gridpane.add(getProcModel(), 1, 5);

    Label labelInstalledMem = new Label("Installed Memory: ");
    gridpane.add(labelInstalledMem, 0, 6);
    gridpane.add(getTotalMem(), 1, 6);

    Label labelHDDSize = new Label("Hard Drive Size: ");
    gridpane.add(labelHDDSize, 0, 7);
    gridpane.add(getHddSize(), 1, 7);

    Label labelHDDFreeSpace = new Label("Free Space: ");
    gridpane.add(labelHDDFreeSpace, 0, 8);
    gridpane.add(getHddFree(), 1, 8);

    /** Right Column */
    Label labelIPAddress = new Label("Local IP Address: ");
    gridpane.add(labelIPAddress, 0, 9);
    gridpane.add(getLocalIP(), 1, 9);

    Label labelSubnet = new Label("Subnet: ");
    gridpane.add(labelSubnet, 0, 10);
    gridpane.add(getSubnet(), 1, 10);

    Label labelGateway = new Label("Gateway: ");
    gridpane.add(labelGateway, 0, 11);
    gridpane.add(getGateway(), 1, 11);

    Label labelPublicIP = new Label("Public IP: ");
    gridpane.add(labelPublicIP, 0, 12);
    gridpane.add(getPublicIP(), 1, 12);

    return gridpane;
  }
Ejemplo n.º 23
0
  @Override
  public void start(Stage stage) throws Exception {

    // ----------MENU----------

    MenuBar menuBar = new MenuBar();

    Menu menuFile = new Menu("File");
    MenuItem menuItemPurchase = new MenuItem("New Purchase");
    MenuItem menuItemStore = new MenuItem("New Store");
    MenuItem menuItemCategory = new MenuItem("New Category");
    MenuItem menuItemExit = new MenuItem("Exit");
    menuFile.getItems().addAll(menuItemPurchase, menuItemStore, menuItemCategory, menuItemExit);

    Menu menuHelp = new Menu("Help");
    menuBar.getMenus().addAll(menuFile, menuHelp);

    // ----------TOOLBAR----------

    ToolBar toolBar = new ToolBar();
    Button buttonPurchase = new Button();
    Button buttonStore = new Button();
    Button buttonCategory = new Button();
    buttonPurchase.setGraphic(new ImageView("/pictures/purchase.png"));
    buttonStore.setGraphic(new ImageView("/pictures/store.png"));
    buttonCategory.setGraphic(new ImageView("/pictures/category.png"));
    toolBar.getItems().addAll(buttonPurchase, buttonStore, buttonCategory);

    buttonStore.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent actionEvent) {
            Stage stage = new Stage();
            try {
              new StoreWindows().start(stage);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    // ----------WORKSPACE----------

    GridPane gridPane = new GridPane();
    gridPane.setAlignment(Pos.CENTER);
    gridPane.setVgap(10);
    gridPane.setHgap(10);
    gridPane.setPadding(new Insets(0, 25, 25, 0));

    Label storeLabel = new Label("Store: ");
    storeLabel.setId("simpleLabel");
    gridPane.add(storeLabel, 0, 1);

    final ComboBox<String> stores = new ComboBox<String>();
    gridPane.add(stores, 1, 1);

    Label categoryLabel = new Label("Category: ");
    categoryLabel.setId("simpleLabel");
    gridPane.add(categoryLabel, 2, 1);

    final ComboBox<String> categories = new ComboBox<String>();
    gridPane.add(categories, 3, 1);

    Button bCount = new Button("Count");
    HBox hBox = new HBox(10);
    hBox.setAlignment(Pos.BOTTOM_RIGHT);
    hBox.getChildren().add(bCount);
    gridPane.add(hBox, 4, 1);

    FlowPane flowPane1 = new FlowPane();
    flowPane1.setAlignment(Pos.CENTER);
    flowPane1.setPadding(new Insets(10, 25, 25, 10));

    final Text spentTitle = new Text("SPENT: ");
    spentTitle.setId("headline");
    flowPane1.getChildren().add(spentTitle);

    // ----------DATABASE----------

    Label statusLabel = new Label();
    DaoFactory daoFactory = new MySQLDaoFactory();
    try {
      Connection connection = daoFactory.getConnection();
      statusLabel.setText("Database connection: success");
      StoreDao storeDao = new MySQLStoreDao(connection);
      ArrayList<Store> storeList = (ArrayList) storeDao.getStores();
      for (Store store : storeList) {
        stores.getItems().add(store.getName());
      }
      CategoryDao categoryDao = new MySQLCategoryDao(connection);
      ArrayList<Category> categoryList = (ArrayList) categoryDao.getCategories();
      for (Category category : categoryList) {
        categories.getItems().add(category.getTitle());
      }
    } catch (SQLException e) {
      statusLabel.setText("Database connection: failed");
    }
    FlowPane footer = new FlowPane();

    footer.setPadding(new Insets(10, 10, 10, 10));
    footer.getChildren().add(statusLabel);

    bCount.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent actionEvent) {
            try {
              PurchaseDao purchaseDao = new MySQLPurchaseDao(new MySQLDaoFactory().getConnection());
              spentTitle.setText(
                  "SPENT: " + purchaseDao.showSpent(stores.getValue(), categories.getValue()));
            } catch (SQLException e) {
              e.printStackTrace();
            }
          }
        });

    // ----------VIEW----------

    Scene scene = new Scene(new VBox(), 800, 600);
    scene.getStylesheets().add("css/style.css");
    ((VBox) scene.getRoot()).getChildren().addAll(menuBar, toolBar, gridPane, flowPane1, footer);

    stage.setScene(scene);
    stage.setTitle("Cash Organizer");
    stage.getIcons().add(new Image("pictures/icon.png"));
    stage.show();
  }
Ejemplo n.º 24
0
  @Override
  public void start(Stage primaryStage) {

    // set textfields,labels,and action button
    primaryStage.setTitle("Project Five");
    Label usernameLabel = new Label("Name: ");
    TextField usernameTxt = new TextField("");
    TextField testOneTxt = new TextField("");
    TextField testTwoTxt = new TextField("");
    TextField testThreeTxt = new TextField("");
    TextField testFourTxt = new TextField("");
    TextField weightOneTxt = new TextField("");
    TextField weightTwoTxt = new TextField("");
    TextField weightThreeTxt = new TextField("");
    TextField weightFourTxt = new TextField("");
    Label testLabel = new Label("Test Grades (ex 90 or 100) ");
    Label weightLabel = new Label("Weight (ex 0.30 0r 0.05) ");
    Button EnterBttn = new Button("Calculate");

    usernameTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    testOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    testTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    testThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    testFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    weightOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    weightTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    weightThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
    weightFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");

    EnterBttn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent arg0) {

            usernameTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            testOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            testTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            testThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            testFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            weightOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            weightTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            weightThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
            weightFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");

            // declare variables
            String username = "";
            String testOneString = testOneTxt.getText();
            String testTwoString = testTwoTxt.getText();
            String testThreeString = testThreeTxt.getText();
            String testFourString = testFourTxt.getText();
            String weightOneString = weightOneTxt.getText();
            String weightTwoString = weightTwoTxt.getText();
            String weightThreeString = weightThreeTxt.getText();
            String weightFourString = weightFourTxt.getText();

            double testOne = 0.0;
            double testTwo = 0.0;
            double testThree = 0.0;
            double testFour = 0.0;
            double weightOne = 0.0;
            double weightTwo = 0.0;
            double weightThree = 0.0;
            double weightFour = 0.0;

            boolean userBool = false;
            boolean testOneBool = false;
            boolean testTwoBool = false;
            boolean testThreeBool = false;
            boolean testFourBool = false;
            boolean weightOneBool = false;
            boolean weightTwoBool = false;
            boolean weightThreeBool = false;
            boolean weightFourBool = false;

            // conditions

            // username
            if (usernameTxt.getText().isEmpty()) {
              usernameTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (!usernameTxt.getText().matches("[0-9]")) {
                usernameTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                username = (usernameTxt.getText());
                userBool = true;
              }
            }

            // testOneTxt
            if (testOneTxt.getText().isEmpty()) {
              testOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (testOneTxt.getText().matches("[^0-9]")) {
                testOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (testOneTxt.getText().matches("\\d+\\.\\d+")
                  || (testOneTxt.getText().matches("\\d+"))) {
                testOne = Double.parseDouble(testOneTxt.getText());
                testOneBool = true;
                testOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                testOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // testTwoTxt
            if (testTwoTxt.getText().isEmpty()) {
              testTwoTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (testTwoTxt.getText().matches("[^0-9]")) {
                testTwoTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (testTwoTxt.getText().matches("\\d+\\.\\d+")
                  || (testTwoTxt.getText().matches("\\d+"))) {
                testTwo = Double.parseDouble(testTwoTxt.getText());
                testTwoBool = true;
                testTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                testTwoTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // testThreeTxt
            if (testThreeTxt.getText().isEmpty()) {
              testThreeTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (testThreeTxt.getText().matches("[^0-9]")) {
                testThreeTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (testThreeTxt.getText().matches("\\d+\\.\\d+")
                  || (testThreeTxt.getText().matches("\\d+"))) {
                testThree = Double.parseDouble(testThreeTxt.getText());
                testThreeBool = true;
                testThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                testThreeTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // testFourTxt
            if (testFourTxt.getText().isEmpty()) {
              testFourTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (testFourTxt.getText().matches("[^0-9]")) {
                testFourTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (testFourTxt.getText().matches("\\d+\\.\\d+")
                  || (testFourTxt.getText().matches("\\d+"))) {
                testFour = Double.parseDouble(testFourTxt.getText());
                testFourBool = true;
                testFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                testFourTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // weightOneTxt
            if (weightOneTxt.getText().isEmpty()) {
              weightOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (weightOneTxt.getText().matches("[^0-9]")) {
                weightOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (weightOneTxt.getText().matches("\\d+\\.\\d+")
                  || (weightOneTxt.getText().matches("\\d+"))) {
                weightOne = Double.parseDouble(weightOneTxt.getText());
                weightOneBool = true;
                weightOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                weightOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // weightTwoTxt
            if (weightTwoTxt.getText().isEmpty()) {
              weightTwoTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (weightTwoTxt.getText().matches("[^0-9]")) {
                weightTwoTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (weightTwoTxt.getText().matches("\\d+\\.\\d+")
                  || (weightTwoTxt.getText().matches("\\d+"))) {
                weightTwo = Double.parseDouble(weightTwoTxt.getText());
                weightTwoBool = true;
                weightTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                weightOneTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // weightThreeTxt
            if (weightThreeTxt.getText().isEmpty()) {
              weightThreeTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (weightThreeTxt.getText().matches("[^0-9]")) {
                weightThreeTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (weightThreeTxt.getText().matches("\\d+\\.\\d+")
                  || (weightThreeTxt.getText().matches("\\d+"))) {
                weightThree = Double.parseDouble(weightThreeTxt.getText());
                weightThreeBool = true;
                weightThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                weightThreeTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // weightFourTxt
            if (weightFourTxt.getText().isEmpty()) {
              weightFourTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
            } else {
              if (weightFourTxt.getText().matches("[^0-9]")) {
                weightFourTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
              if (weightFourTxt.getText().matches("\\d+\\.\\d+")
                  || (weightFourTxt.getText().matches("\\d+"))) {
                weightFour = Double.parseDouble(weightFourTxt.getText());
                weightFourBool = true;
                weightFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
              } else {
                weightFourTxt.setStyle("-fx-border-color: red; -fx-padding: 3px;"); // red
              }
            }

            // checks Bool's
            if ((testOneBool == true)
                && (testTwoBool == true)
                && (testThreeBool == true)
                && //
                (testFourBool == true)
                && (weightOneBool == true)
                && (weightTwoBool == true) //
                && (weightThreeBool == true)
                && (weightFourBool == true)
                && (userBool == true)) {

              double comboWeights = (weightOne + weightTwo + weightThree + weightFour);
              double gradePointAverage =
                  ((testOne * weightOne)
                      + (testTwo * weightTwo)
                      + (testThree * weightThree)
                      + (testFour * weightFour));

              if (comboWeights > 1.0) {
                JOptionPane.showMessageDialog(
                    null, "Sum of weights can not be more than 100% (i.e 1.0)");
              } else {

                testOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                testTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                testThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                testFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                weightOneTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                weightTwoTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                weightThreeTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                weightFourTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");
                usernameTxt.setStyle("-fx-border-color: black; -fx-padding: 3px;");

                // calling Constructor class
                ProjectFiveConstructor newUser = new ProjectFiveConstructor();

                newUser.setUsername(username);
                newUser.setGPA(gradePointAverage);
                newUser.setTestOneGrade(testOne);
                newUser.getUsername(username);
                newUser.getGPA(gradePointAverage);
                newUser.getTestOneGrade(testOne);

                newUser.toString(newUser.Username, newUser.GPA);
                System.exit(0);
              }
            }
            System.out.println(
                userBool
                    + ""
                    + testOneBool
                    + ""
                    + testTwoBool
                    + ""
                    + testThreeBool
                    + ""
                    + testFourBool
                    + ""
                    + weightOneBool
                    + ""
                    + weightTwoBool
                    + ""
                    + weightThreeBool
                    + ""
                    + weightFourBool);
          }
        });

    // Scene setting
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setVgap(20);
    grid.setHgap(20);
    grid.add(testLabel, 0, 0);
    grid.add(testOneTxt, 0, 1);
    grid.add(testTwoTxt, 0, 2);
    grid.add(testThreeTxt, 0, 3);
    grid.add(testFourTxt, 0, 4);
    grid.add(weightLabel, 1, 0);
    grid.add(weightOneTxt, 1, 1);
    grid.add(weightTwoTxt, 1, 2);
    grid.add(weightThreeTxt, 1, 3);
    grid.add(weightFourTxt, 1, 4);
    grid.add(EnterBttn, 1, 6);
    grid.add(usernameTxt, 1, 5);
    grid.add(usernameLabel, 0, 5);

    Scene scene = new Scene(grid, 500, 500);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Ejemplo n.º 25
0
  @SuppressWarnings("unchecked")
  public StackPane viewStock(String categoryId, String categoryName) {
    stack = new StackPane();

    GridPane grid = new GridPane();

    grid.setVgap(8);
    grid.setPadding(new Insets(30));
    final ObservableList<ItemVO> dataTable;
    // final ObservableList<ItemVO> dataTable1;
    // final ObservableList<ItemVO> dataTable2;
    ObservableList<CategoryTypeVO> typeList;

    Rectangle roundRect =
        RectangleBuilder.create()
            .x(50)
            .y(50)
            .width(Screen.getPrimary().getVisualBounds().getWidth() - 428)
            .height(Screen.getPrimary().getVisualBounds().getHeight() - 150)
            .arcWidth(30)
            .arcHeight(30)
            .build();

    roundRect.setFill(Color.DARKGRAY);
    roundRect.setOpacity(0.2);
    roundRect.setStroke(Color.TRANSPARENT);

    HBox hlabel = new HBox();
    hlabel.setMaxWidth(Screen.getPrimary().getVisualBounds().getWidth() - 170);
    hlabel.setMaxHeight(30);
    hlabel.setStyle("-fx-background-color:black;");
    hlabel.setOpacity(0.3);
    hlabel.setLayoutX(20);

    try {
      typeList = FXCollections.observableArrayList();
      typeList = UtiliesDAO.getUtiliesDAO().fetchTypes(categoryId);

      dataTable = FXCollections.observableArrayList();
      dataTable.addAll(stockDetailsService.viewStock(categoryId));

      /*dataTable1 = FXCollections.observableArrayList();
      dataTable2 = FXCollections.observableArrayList();

      for(int i=0;i<dataTable.size();i++)
      {
      	dataTable1.add(dataTable.get(i++));
      	if(i<=dataTable.size()-1)
      	{
      		dataTable2.add(dataTable.get(i));
      	}
      }*/

      final Label label = new Label(categoryName + " Stock");

      final Text text5 = new Text(25, 175, categoryName + " Stock");
      text5.setFill(Color.DARKORANGE);
      // text5.setFont(Font.font ("Edwardian Script ITC", 50));
      text5.setFont(Font.loadFont("file:resources/fonts/ITCEDSCR.TTF", 50));
      final Light.Distant light = new Light.Distant();
      light.setAzimuth(-135.0);
      final Lighting lighting = new Lighting();
      lighting.setLight(light);
      lighting.setSurfaceScale(9.0);
      text5.setEffect(lighting);

      label.setAlignment(Pos.CENTER_LEFT);
      // grid.add(label,1,0);

      final TableView<ItemVO> table1 = new TableView<ItemVO>();
      table1.setEditable(false);
      // table1.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519);//400,300
      table1.setMinSize(roundRect.getWidth() * 0.41, roundRect.getHeight() * 0.519); // 400,300
      table1.setMaxSize(roundRect.getWidth() - 50, roundRect.getHeight() - 200);

      table1.getSelectionModel().setCellSelectionEnabled(false);

      table1.setStyle("-fx-background-color: transparent;");

      TableColumn<ItemVO, String> itemName = new TableColumn<ItemVO, String>("Item");
      itemName.setResizable(false);
      itemName.setMaxWidth(roundRect.getWidth() * 0.5);
      itemName.setMinWidth(roundRect.getWidth() * 0.5); // 200
      itemName.setCellValueFactory(new PropertyValueFactory<ItemVO, String>("itemName"));

      TableColumn<ItemVO, Integer> quantity = new TableColumn<ItemVO, Integer>("Quantity#");
      quantity.setResizable(false);
      quantity.setMinWidth(roundRect.getWidth() * 0.107); // 200

      /*quantity.setCellValueFactory(
      new PropertyValueFactory<ItemVO, Integer>("quantity"));*/

      for (final CategoryTypeVO type : typeList) {
        TableColumn<ItemVO, Integer> col = new TableColumn<ItemVO, Integer>(type.getTypeName());
        col.setMinWidth(roundRect.getWidth() * 0.107); // 100
        col.setResizable(false);

        col.setCellValueFactory(
            new Callback<CellDataFeatures<ItemVO, Integer>, ObservableValue<Integer>>() {
              @Override
              public ObservableValue<Integer> call(CellDataFeatures<ItemVO, Integer> item) {
                ItemVO itemVO = item.getValue();
                if (itemVO == null) {
                  return null;
                  // or perhaps
                  // return new ReadOnlyObjectWrapper<Integer>(null);
                } else {
                  ObservableMap<String, ItemTypeVO> itemTypesMap =
                      FXCollections.observableHashMap();
                  itemTypesMap = item.getValue().getListType();

                  return new ReadOnlyObjectWrapper<Integer>(
                      itemTypesMap.get(type.getTypeId()).getQuantity());
                }
              }
            });
        col.setCellFactory(
            new Callback<TableColumn<ItemVO, Integer>, TableCell<ItemVO, Integer>>() {

              @Override
              public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) {
                // TODO Auto-generated method stub
                return new TableCell<ItemVO, Integer>() {
                  @Override
                  public void updateItem(Integer item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!isEmpty()) {
                      setText(item.toString());
                      if (item <= 5) {
                        this.getStyleClass().add("celllow");
                        setTextFill(Color.RED);
                      }
                    }
                  }
                };
              }
            });
        quantity.getColumns().add(col);
      }

      if (quantity.getColumns().size() >= 5 && quantity.getColumns().size() <= 7) {
        itemName.setMinWidth(itemName.getWidth() - (quantity.getColumns().size() - 4) * 100);
      }
      if (quantity.getColumns().size() > 7) {
        itemName.setMinWidth(itemName.getWidth() - ((7 - 4) * 100));
      }

      table1.setItems(dataTable);
      final TableColumn[] columns1 = {itemName, quantity};
      table1.getColumns().addAll(columns1);
      table1
          .getColumns()
          .addListener(
              new ListChangeListener() {
                public boolean suspended;

                @Override
                public void onChanged(Change change) {
                  change.next();
                  if (change.wasReplaced() && !suspended) {
                    this.suspended = true;
                    table1.getColumns().setAll(columns1);
                    this.suspended = false;
                  }
                }
              });

      /*//final TableView<ItemVO> table2 = new TableView<ItemVO>();
      table2.setEditable(false);

      table2.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519);
      table2.setMinSize(roundRect.getWidth()*0.35, roundRect.getHeight()*0.519);//400,300
      table2.setStyle("-fx-background-color: transparent;");

      TableColumn<ItemVO,String> itemName2 = new TableColumn<ItemVO,String> ("Item");
      itemName2.setMinWidth(roundRect.getWidth()*0.3);//200

      itemName2.setCellValueFactory(
      		new PropertyValueFactory<ItemVO, String>("itemName"));

      TableColumn<ItemVO, Integer>  quantity2 = new TableColumn<ItemVO, Integer> ("Quantity#");
      quantity2.setMinWidth(roundRect.getWidth()*0.107);//200
      quantity.setCellValueFactory(
      		new PropertyValueFactory<ItemVO, Integer>("quantity"));



      for (final CategoryTypeVO type : typeList)
      {
      	  TableColumn<ItemVO, Integer> col2 = new TableColumn<ItemVO, Integer>(type.getTypeName());
      	  col2.setMinWidth(roundRect.getWidth()*0.107);//100
      	  col2.setResizable(false);

      	  col2.setCellValueFactory(new Callback<CellDataFeatures<ItemVO,Integer>, ObservableValue<Integer>>() {
      	    @Override
      	    public ObservableValue<Integer> call(CellDataFeatures<ItemVO,Integer> item)
      	    {
      	    	ItemVO itemVO = item.getValue();
      	    	if (itemVO == null)
      	    	{
      	    	  return null ;
      	    	// or perhaps
      	    	// return new ReadOnlyObjectWrapper<Integer>(null);
      	    	}
      	    	else
      	    	{
      		    	ObservableMap<String,ItemTypeVO> itemTypesMap = FXCollections.observableHashMap();
      		    	itemTypesMap = item.getValue().getListType();

      		    	return new ReadOnlyObjectWrapper<Integer>(itemTypesMap.get(type.getTypeId()).getQuantity());

      	    	}

      	    }

      	  });
      	 col2.setCellFactory(new Callback<TableColumn<ItemVO,Integer>, TableCell<ItemVO,Integer>>() {

      		@Override
      		public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) {
      			// TODO Auto-generated method stub
      			return new TableCell<ItemVO, Integer>(){
      				@Override
      				public void updateItem(Integer item, boolean empty)
      				{
      					super.updateItem(item, empty);
      					if(item!=null)
      					{
      						setText(item.toString());
      						if(item<=5)
      						{
      							this.getStyleClass().add("celllow");
      							setTextFill(Color.RED);
      						}
      					}

      				}
      			};

      		}
      	});
      	  quantity2.getColumns().add(col2);
      	}


      table2.setItems(dataTable2);
      final TableColumn[] columns2 = {itemName2, quantity2};
      table2.getColumns().addAll(columns2);
      table2.getColumns().addListener(new ListChangeListener() {
            public boolean suspended;

            @Override
            public void onChanged(Change change) {
                change.next();
                if (change.wasReplaced() && !suspended) {
                    this.suspended = true;
                    table2.getColumns().setAll(columns2);
                    this.suspended = false;
                }
            }
        });*/

      Rectangle qtyRect = RectangleBuilder.create().x(50).y(50).width(10).height(10).build();

      qtyRect.setFill(Color.rgb(240, 128, 128));

      grid.add(table1, 0, 12);
      // grid.add(table2,1,12);
      grid.setAlignment(Pos.TOP_CENTER);

      Text man_text = new Text(CommonConstants.STAR_MSG);
      man_text.setFill(Color.DARKKHAKI);
      man_text.setFont(Font.font("Arial", 12));

      Text msg_qty = new Text(CommonConstants.QTY_MSG1);
      msg_qty.setFill(Color.DARKKHAKI);
      msg_qty.setFont(Font.font("Arial", 12));

      Text msg_qtyLow = new Text(CommonConstants.QTY_LOW);
      msg_qtyLow.setFill(Color.DARKKHAKI);
      msg_qtyLow.setFont(Font.font("Arial", 12));

      StackPane.setMargin(grid, new Insets(10, 0, 0, 0));

      StackPane.setMargin(qtyRect, new Insets(197, 850, 100, 0));
      StackPane.setAlignment(qtyRect, Pos.BASELINE_CENTER);
      StackPane.setMargin(msg_qtyLow, new Insets(197, 765, 100, 0));
      StackPane.setAlignment(msg_qtyLow, Pos.BASELINE_CENTER);

      StackPane.setAlignment(roundRect, Pos.TOP_CENTER);
      StackPane.setMargin(text5, new Insets(50, 8, 8, 8));
      StackPane.setAlignment(text5, Pos.TOP_CENTER);
      StackPane.setMargin(man_text, new Insets(197, 100, 20, 0));
      StackPane.setAlignment(man_text, Pos.BASELINE_RIGHT);
      StackPane.setMargin(msg_qty, new Insets(210, 95, 20, 0));
      StackPane.setAlignment(msg_qty, Pos.BASELINE_RIGHT);

      stack.getChildren().addAll(text5, roundRect, grid, man_text, msg_qty, qtyRect, msg_qtyLow);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return stack;
  }
Ejemplo n.º 26
0
  public ItemPage(Login login) {

    this.login = login;

    data = new Database();
    dataTable = new DatabaseTable();

    Button goBack = new Button("Go Back");
    goBack.setMaxWidth(140);
    Button addItem = new Button("Add Item");
    addItem.setMaxWidth(140);

    Label username = new Label("Item ID");
    Label password = new Label("Item Name");
    Label name = new Label("Quantity");
    Label lastName = new Label("Price");
    Label address = new Label("Item Description");
    //	Label age = new Label("Picture");

    usernameText = new TextField();
    passwordText = new TextField();
    nameText = new TextField();
    lastNameText = new TextField();
    addressText = new TextField();
    //	ageText = new TextField();

    ImageView icon =
        new ImageView(
            new Image(getClass().getResourceAsStream("/res/beauty.png"), 300, 300, true, true));

    Button one = new Button("Ho");

    VBox hBox = new VBox();
    hBox.setMinWidth(400);
    hBox.setMinHeight(100);
    hBox.setSpacing(1);
    hBox.setAlignment(Pos.TOP_CENTER);
    hBox.setPadding(new Insets(30, 30, 30, 30));
    hBox.getChildren().add(icon);
    //	hBox.getChildren().add(goBack);

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setPadding(new Insets(10, 25, 25, 25));
    grid.setVgap(10);
    grid.setHgap(10);
    grid.add(username, 1, 0);
    grid.add(usernameText, 2, 0);
    grid.add(password, 1, 1);
    grid.add(passwordText, 2, 1);
    grid.add(name, 1, 2);
    grid.add(nameText, 2, 2);
    grid.add(lastName, 1, 3);
    grid.add(lastNameText, 2, 3);
    grid.add(address, 1, 4);
    grid.add(addressText, 2, 4);
    //	grid.add(age, 1, 5);
    //	grid.add(ageText, 2, 5);
    grid.add(goBack, 1, 7);
    grid.add(addItem, 1, 6);

    goBack.setOnAction(
        (e) -> {
          login.InventoryPage.buildData();
          login.theStage.setScene(login.scene3);
          login.userID.clear();
          login.userPasswordField.clear();
          //		login.InventoryPage.buildData();

        });

    addItem.setOnAction(
        (e) -> {
          data.createItem(
              usernameText.getText(),
              passwordText.getText(),
              nameText.getText(),
              lastNameText.getText(),
              addressText.getText());
          clearText();
        });

    setBackground(new Background(new BackgroundFill(Color.PINK, CornerRadii.EMPTY, Insets.EMPTY)));
    super.setCenter(grid);
    super.setTop(hBox);
  }
Ejemplo n.º 27
0
  public newFenetreParametre(Stage primaryStage) {
    this.initModality(Modality.WINDOW_MODAL);
    this.initOwner(primaryStage);

    String fichier = "config.ini";
    final ArrayList<String> listParam = new ArrayList<String>();

    try {
      InputStream ips = new FileInputStream(fichier);
      InputStreamReader ipsr = new InputStreamReader(ips);
      BufferedReader br = new BufferedReader(ipsr);
      String ligne;
      while ((ligne = br.readLine()) != null) {
        System.out.println(ligne);
        listParam.add(ligne);
      }
      br.close();
    } catch (Exception e) {
      System.out.println(e.toString());
    }

    tfParamBleu.setText(listParam.get(0).substring(listParam.get(0).lastIndexOf(" ") + 1));
    tfParamRouge.setText(listParam.get(1).substring(listParam.get(1).lastIndexOf(" ") + 1));
    tfParamBleuEnnemi.setText(listParam.get(2).substring(listParam.get(2).lastIndexOf(" ") + 1));
    tfParamRougeEnnemi.setText(listParam.get(3).substring(listParam.get(3).lastIndexOf(" ") + 1));
    tfParamDragon.setText(listParam.get(4).substring(listParam.get(4).lastIndexOf(" ") + 1));
    tfParamNashor.setText(listParam.get(5).substring(listParam.get(5).lastIndexOf(" ") + 1));
    tfParamAnnulateur.setText(listParam.get(6).substring(listParam.get(6).lastIndexOf(" ") + 1));
    checkboxSounds.setSelected(
        listParam.get(7).substring(listParam.get(7).lastIndexOf(" ") + 1).contains("YES"));
    checkboxOverlay.setSelected(
        listParam.get(8).substring(listParam.get(8).lastIndexOf(" ") + 1).contains("YES"));

    tfParamBleu.setEditable(false);
    tfParamBleu.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamBleu.setText(e.getCode().toString());
          }
        });
    tfParamRouge.setEditable(false);
    tfParamRouge.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamRouge.setText(e.getCode().toString());
          }
        });
    tfParamBleuEnnemi.setEditable(false);
    tfParamBleuEnnemi.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamBleuEnnemi.setText(e.getCode().toString());
          }
        });
    tfParamRougeEnnemi.setEditable(false);
    tfParamRougeEnnemi.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamRougeEnnemi.setText(e.getCode().toString());
          }
        });
    tfParamDragon.setEditable(false);
    tfParamDragon.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            if (!e.getCode().isKeypadKey()) {
              System.out.println(e.getCode());
              tfParamDragon.setText(e.getCode().toString());
            }
          }
        });
    tfParamNashor.setEditable(false);
    tfParamNashor.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {

            tfParamNashor.setText(e.getCode().toString());
          }
        });
    tfParamAnnulateur.setEditable(false);
    tfParamAnnulateur.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            if (e.isShiftDown()) {
              tfParamAnnulateur.setText("Maj");
            } else {
              tfParamAnnulateur.setText(e.getCode().toString());
            }
          }
        });

    HBox hbEnrAnn = new HBox(5);
    Button boutonEnregistrer = new Button("Enregistrer");
    boutonEnregistrer.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {
            try {
              String fichier = "config.ini";
              FileWriter fw = new FileWriter(fichier);
              BufferedWriter bw = new BufferedWriter(fw);
              PrintWriter fichierSortie = new PrintWriter(bw);

              fichierSortie.println("Bleu : " + tfParamBleu.getText());
              fichierSortie.println("Rouge : " + tfParamRouge.getText());
              fichierSortie.println("BleuEnnemi : " + tfParamBleuEnnemi.getText());
              fichierSortie.println("RougeEnnemi : " + tfParamRougeEnnemi.getText());
              fichierSortie.println("Dragon : " + tfParamDragon.getText());
              fichierSortie.println("Nashor : " + tfParamNashor.getText());
              fichierSortie.println("Annulateur : " + tfParamAnnulateur.getText());
              if (checkboxSounds.isSelected()) {
                fichierSortie.println("Sounds : YES");
              } else {
                fichierSortie.println("Sounds : NO");
              }
              if (checkboxOverlay.isSelected()) {
                fichierSortie.println("Overlay : YES");
              } else {
                fichierSortie.println("Overlay : NO");
              }

              fichierSortie.close();
              System.out.println("Le fichier " + fichier + " a été créé!");
            } catch (Exception e1) {
              System.out.println(e1.toString());
            }
            AppCore.inputBleu = tfParamBleu.getText();
            AppCore.inputRouge = tfParamRouge.getText();
            AppCore.inputBleuEnnemi = tfParamBleuEnnemi.getText();
            AppCore.inputRougeEnnemi = tfParamRougeEnnemi.getText();
            AppCore.inputDragon = tfParamDragon.getText();
            AppCore.inputNashor = tfParamNashor.getText();
            AppCore.inputAnnulateur = tfParamAnnulateur.getText();
            if (checkboxSounds.isSelected()) {
              AppCore.stateSounds = true;
            } else {
              AppCore.stateSounds = false;
            }
            if (checkboxOverlay.isSelected()) {
              AppCore.stateOverlay = true;
            } else {
              AppCore.stateOverlay = false;
            }
            close();
          }
        });
    Button boutonAnnuler = new Button("Annuler");
    boutonAnnuler.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e0) {
            close();
          }
        });

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    grid.add(labelParamBleu, 0, 0);
    grid.add(labelParamRouge, 0, 1);
    grid.add(labelParamBleuEnnemi, 0, 2);
    grid.add(labelParamRougeEnnemi, 0, 3);
    grid.add(labelParamDragon, 0, 4);
    grid.add(labelParamNashor, 0, 5);
    grid.add(labelParamAnnulateur, 0, 6);
    grid.add(labelParamSounds, 0, 7);
    grid.add(labelParamOverlay, 0, 8);

    grid.add(tfParamBleu, 1, 0);
    grid.add(tfParamRouge, 1, 1);
    grid.add(tfParamBleuEnnemi, 1, 2);
    grid.add(tfParamRougeEnnemi, 1, 3);
    grid.add(tfParamDragon, 1, 4);
    grid.add(tfParamNashor, 1, 5);
    grid.add(tfParamAnnulateur, 1, 6);
    grid.add(checkboxSounds, 1, 7);
    grid.add(checkboxOverlay, 1, 8);

    hbEnrAnn.getChildren().add(boutonAnnuler);
    hbEnrAnn.getChildren().add(boutonEnregistrer);
    grid.add(hbEnrAnn, 1, 9);

    setOnHiding(
        new EventHandler<WindowEvent>() {

          @Override
          public void handle(WindowEvent arg0) {}
        });

    this.setScene(new Scene(grid, 315, 315));
    setResizable(false);
    this.show();
  }
Ejemplo n.º 28
0
  @Override
  public void start(Stage primaryStage) {
    try {
      BorderPane root =
          (BorderPane) FXMLLoader.load(getClass().getResource("FinanceMainForm.fxml"));
      // ------------------------------------------------------------------------------------
      // MD Alexis code
      // Grid to arrange buttons and text controls
      GridPane grid = new GridPane();
      grid.setAlignment(Pos.TOP_LEFT);
      grid.setPrefWidth(400);
      // TODO: One column may be better, or a multicolumn single row for buttons.
      ColumnConstraints col1 = new ColumnConstraints();
      col1.setPercentWidth(90);
      col1.setMinWidth(200);
      ColumnConstraints col2 = new ColumnConstraints();
      col2.setPercentWidth(10);
      col2.setMinWidth(200);
      grid.getColumnConstraints().addAll(col1, col2);

      grid.setHgap(10);
      grid.setVgap(10);
      // grid.setGridLinesVisible(true);  //Turn this on for debug and layout
      javafx.geometry.Insets ins = new javafx.geometry.Insets(5, 5, 5, 5);
      grid.setPadding(ins);
      // Fill the grid with controls
      Text scenetitle = new Text("Modeler");
      scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
      grid.add(scenetitle, 0, 0, 2, 1);
      // Add Buttons-----------------------------------------
      bthRun.setOnAction(bthHandlerRun);
      grid.add(bthRun, 0, 2);
      // grid.add(child, columnIndex, rowIndex);

      // Add textArea control to show results
      textStatus.setPrefRowCount(10);
      textStatus.setPrefColumnCount(100);
      textStatus.setWrapText(false);
      textStatus.setPrefWidth(300);

      grid.add(textStatus, 0, 3);

      // -------------------Table View - use to display results
      // --------------------------------------------
      // Set up table columns and their data sources
      TableColumn indexCol = new TableColumn("Index");
      TableColumn yearCol = new TableColumn("Year");
      yearCol.setCellValueFactory(new PropertyValueFactory<YearData, String>("year"));
      TableColumn balanceCol = new TableColumn("StartBalance");
      balanceCol.setCellValueFactory(
          new PropertyValueFactory<YearData, String>("startBalanceFormatted"));
      TableColumn mktGainCol = new TableColumn("Gains");
      mktGainCol.setCellValueFactory(
          new PropertyValueFactory<YearData, String>("marketGainsFormatted"));
      TableColumn incGoalCol = new TableColumn("Income Goal");
      incGoalCol.setCellValueFactory(
          new PropertyValueFactory<YearData, String>("incomeGoalWithInflationFormatted"));
      TableColumn totalIncomeCol = new TableColumn("Total Income");
      totalIncomeCol.setCellValueFactory(
          new PropertyValueFactory<YearData, String>("incomeTotalFormatted"));

      tableV
          .getColumns()
          .addAll(indexCol, yearCol, balanceCol, mktGainCol, incGoalCol, totalIncomeCol);

      grid.add(tableV, 0, 4);
      // ------------------------------- Chart ---------------------------------------------
      final CategoryAxis xAxis = new CategoryAxis();
      final NumberAxis yAxis = new NumberAxis();
      // final BarChart barchartResults = new BarChart<>(xAxis,yAxis);
      final AreaChart areachartResults = new AreaChart<>(xAxis, yAxis);

      areachartResults.setTitle("Results Chart");
      xAxis.setLabel("Year");
      yAxis.setLabel("Dollars");
      // Series
      // TODO:  Connect this to an observable list in ModelUtility
      // final XYChart.Series<int[], double[]> seriesBalance = new XYChart.Series();
      final XYChart.Series<String, Double> seriesBalance = new Series<String, Double>();
      seriesBalance.setName("Balance");
      // seriesBalance.setData(MU.balanceDataList);
      areachartResults.setData(MU.balanceDataList);

      // Add the Series to the chart
      areachartResults.getData().addAll(seriesBalance);

      grid.add(areachartResults, 0, 5);
      // ------------------------------------------------------------------------------------
      // Below lines are from initial project setup
      // Scene scene = new Scene(root,600,400);

      Scene scene = new Scene(grid, 1200, 600);
      scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
      primaryStage.setScene(scene);
      primaryStage.show();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 29
0
 private void initCenter() {
   centerGrid.setAlignment(Pos.TOP_CENTER);
   centerGrid.setPadding(new Insets(30, 0, 0, 0));
   this.setCenter(centerGrid);
 }
Ejemplo n.º 30
0
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("OpenBot");
    primaryStage.setResizable(false);
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER_LEFT);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Label scenetitle = new Label("Move Joints");
    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 2, 0, 5, 1);

    Image imgRight = new Image("images/arrowRight.png");
    Image imgLeft = new Image("images/arrowLeft.png");

    Button baseLeft = new Button();
    baseLeft.setGraphic(new ImageView(imgLeft));
    HBox hbbaseLeft = new HBox(10);
    hbbaseLeft.setAlignment(Pos.CENTER_LEFT);
    hbbaseLeft.getChildren().add(baseLeft);
    grid.add(hbbaseLeft, 0, 1);

    Label baseLabel = new Label("BASE");
    grid.add(baseLabel, 5, 1);

    Button baseRight = new Button();
    baseRight.setGraphic(new ImageView(imgRight));
    HBox hbbaseRight = new HBox(10);
    hbbaseRight.setAlignment(Pos.CENTER_RIGHT);
    hbbaseRight.getChildren().add(baseRight);
    grid.add(hbbaseRight, 7, 1);

    TextField baseText = new TextField();
    baseText.setPromptText("Base angle");
    grid.add(baseText, 8, 1);

    Button shoulderLeft = new Button();
    shoulderLeft.setGraphic(new ImageView(imgLeft));
    HBox hbshoulderLeft = new HBox(10);
    hbshoulderLeft.setAlignment(Pos.CENTER_LEFT);
    hbshoulderLeft.getChildren().add(shoulderLeft);
    grid.add(hbshoulderLeft, 0, 2);

    Label shoulderLabel = new Label("SHOULDER");
    grid.add(shoulderLabel, 5, 2);

    Button shoulderRight = new Button();
    shoulderRight.setGraphic(new ImageView(imgRight));
    HBox hbshoulderRight = new HBox(10);
    hbshoulderRight.setAlignment(Pos.CENTER_RIGHT);
    hbshoulderRight.getChildren().add(shoulderRight);
    grid.add(hbshoulderRight, 7, 2);

    TextField shoulderText = new TextField();
    shoulderText.setPromptText("Shoulder angle");
    grid.add(shoulderText, 8, 2);

    Button elbowLeft = new Button();
    elbowLeft.setGraphic(new ImageView(imgLeft));
    HBox hbelbowLeft = new HBox(10);
    hbelbowLeft.setAlignment(Pos.CENTER_LEFT);
    hbelbowLeft.getChildren().add(elbowLeft);
    grid.add(hbelbowLeft, 0, 3);

    Label elbowLabel = new Label("ELBOW");
    grid.add(elbowLabel, 5, 3);

    Button elbowRight = new Button();
    elbowRight.setGraphic(new ImageView(imgRight));
    HBox hbelbowRight = new HBox(10);
    hbelbowRight.setAlignment(Pos.CENTER_RIGHT);
    hbelbowRight.getChildren().add(elbowRight);
    grid.add(hbelbowRight, 7, 3);

    TextField elbowText = new TextField();
    elbowText.setPromptText("Elbow angle");
    grid.add(elbowText, 8, 3);

    Button wrist1Left = new Button();
    wrist1Left.setGraphic(new ImageView(imgLeft));
    HBox hbwrist1Left = new HBox(10);
    hbwrist1Left.setAlignment(Pos.CENTER_LEFT);
    hbwrist1Left.getChildren().add(wrist1Left);
    grid.add(hbwrist1Left, 0, 4);

    Label wrist1Label = new Label("WRIST 1");
    grid.add(wrist1Label, 5, 4);

    Button wrist1Right = new Button();
    wrist1Right.setGraphic(new ImageView(imgRight));
    HBox hbwrist1Right = new HBox(10);
    hbwrist1Right.setAlignment(Pos.CENTER_RIGHT);
    hbwrist1Right.getChildren().add(wrist1Right);
    grid.add(hbwrist1Right, 7, 4);

    TextField wrist1Text = new TextField();
    wrist1Text.setPromptText("Wrist 1 angle");
    grid.add(wrist1Text, 8, 4);

    Button wrist2Left = new Button();
    wrist2Left.setGraphic(new ImageView(imgLeft));
    HBox hbwrist2Left = new HBox(10);
    hbwrist2Left.setAlignment(Pos.CENTER_LEFT);
    hbwrist2Left.getChildren().add(wrist2Left);
    grid.add(hbwrist2Left, 0, 5);

    Label wrist2Label = new Label("WRIST 2");
    grid.add(wrist2Label, 5, 5);

    Button wrist2Right = new Button();
    wrist2Right.setGraphic(new ImageView(imgRight));
    HBox hbwrist2Right = new HBox(10);
    hbwrist2Right.setAlignment(Pos.CENTER_RIGHT);
    hbwrist2Right.getChildren().add(wrist2Right);
    grid.add(hbwrist2Right, 7, 5);

    TextField wrist2Text = new TextField();
    wrist2Text.setPromptText("Wrist 2 angle");
    grid.add(wrist2Text, 8, 5);

    Button wrist3Left = new Button();
    wrist3Left.setGraphic(new ImageView(imgLeft));
    HBox hbwrist3Left = new HBox(10);
    hbwrist3Left.setAlignment(Pos.CENTER_LEFT);
    hbwrist3Left.getChildren().add(wrist3Left);
    grid.add(hbwrist3Left, 0, 6);

    Label wrist3Label = new Label("WRIST 3");
    grid.add(wrist3Label, 5, 6);

    Button wrist3Right = new Button();
    wrist3Right.setGraphic(new ImageView(imgRight));
    HBox hbwrist3Right = new HBox(10);
    hbwrist3Right.setAlignment(Pos.CENTER_RIGHT);
    hbwrist3Right.getChildren().add(wrist3Right);
    grid.add(hbwrist3Right, 7, 6);

    TextField wrist3Text = new TextField();
    wrist3Text.setPromptText("Wrist 3 angle");
    grid.add(wrist3Text, 8, 6);

    Button sendAllAnglesButton = new Button("Send All Angles");
    grid.add(sendAllAnglesButton, 8, 7);

    sendAllAnglesButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(baseText.getText());
            if (currentValue != -1) {
              client.moveBaseHorizontalTo(currentValue);
            }
            currentValue = parseInt(shoulderText.getText());
            if (currentValue != -1) {
              client.moveShoulderTo(currentValue);
            }
            currentValue = parseInt(elbowText.getText());
            if (currentValue != -1) {
              client.moveElbowTo(currentValue);
            }
            currentValue = parseInt(wrist1Text.getText());
            if (currentValue != -1) {
              client.moveWristOneTo(currentValue);
            }
            currentValue = parseInt(wrist2Text.getText());
            if (currentValue != -1) {
              client.moveWristTwoTo(currentValue);
            }
            currentValue = parseInt(wrist3Text.getText());
            if (currentValue != -1) {
              client.moveWristThreeTo(currentValue);
            }
          }
        });

    baseLeft.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(baseText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              baseText.setText(String.valueOf(targetValue));
              client.moveBaseHorizontalTo(targetValue);
            }
          }
        });

    baseRight.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(baseText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              baseText.setText(String.valueOf(targetValue));
              client.moveBaseHorizontalTo(targetValue);
            }
          }
        });

    shoulderLeft.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(shoulderText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              shoulderText.setText(String.valueOf(targetValue));
              client.moveShoulderTo(targetValue);
            }
          }
        });

    shoulderRight.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(shoulderText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              shoulderText.setText(String.valueOf(targetValue));
              client.moveShoulderTo(targetValue);
            }
          }
        });

    elbowLeft.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(elbowText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              elbowText.setText(String.valueOf(targetValue));
              client.moveElbowTo(targetValue);
            }
          }
        });

    elbowRight.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(elbowText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              elbowText.setText(String.valueOf(targetValue));
              client.moveElbowTo(targetValue);
            }
          }
        });

    wrist1Left.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist1Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              wrist1Text.setText(String.valueOf(targetValue));
              client.moveWristOneTo(targetValue);
            }
          }
        });

    wrist1Right.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist1Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              wrist1Text.setText(String.valueOf(targetValue));
              client.moveWristOneTo(targetValue);
            }
          }
        });

    wrist2Left.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist2Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              wrist2Text.setText(String.valueOf(targetValue));
              client.moveWristTwoTo(targetValue);
            }
          }
        });

    wrist2Right.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist2Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              wrist2Text.setText(String.valueOf(targetValue));
              client.moveWristTwoTo(targetValue);
            }
          }
        });

    wrist3Left.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist3Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              wrist3Text.setText(String.valueOf(targetValue));
              client.moveWristThreeTo(targetValue);
            }
          }
        });

    wrist3Right.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist3Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              wrist3Text.setText(String.valueOf(targetValue));
              client.moveWristThreeTo(targetValue);
            }
          }
        });

    Label scenetitle2 = new Label("Enter Angle");
    scenetitle2.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle2, 8, 0, 5, 1);

    Label scenetitle3 = new Label("Tool Position");
    scenetitle3.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle3, 10, 0, 5, 1);

    String xValue = "360.0";
    grid.add(x, 11, 1);
    x.setText("X :  " + xValue);

    String yValue = "360.0";
    grid.add(y, 11, 2);
    y.setText("Y :  " + yValue);

    String zValue = "360.0";
    grid.add(z, 11, 3);
    z.setText("Z :  " + zValue);

    String rxValue = "360.0";
    grid.add(rx, 11, 4);
    rx.setText("RX :  " + rxValue);

    String ryValue = "360.0";
    grid.add(ry, 11, 5);
    ry.setText("RY :  " + ryValue);

    String rzValue = "360.0";
    grid.add(rz, 11, 6);
    rz.setText("RZ :  " + rzValue);

    // Scene
    Scene scene = new Scene(grid, 700, 600);
    primaryStage.setScene(scene);
    primaryStage.show();

    primaryStage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          @Override
          public void handle(WindowEvent event) {
            client.killClient();
          }
        });

    Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
    StyleManager.getInstance()
        .addUserAgentStylesheet(
            this.getClass().getResource("/resources/styleSheet.css").toExternalForm());
  }