Esempio n. 1
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    window = primaryStage;
    window.setTitle("The Title");

    // Edit menu
    Menu difficultyMenu = new Menu("Difficulty");

    ToggleGroup group = new ToggleGroup();
    RadioMenuItem easy = new RadioMenuItem("Easy");
    RadioMenuItem medium = new RadioMenuItem("Medium");
    RadioMenuItem hard = new RadioMenuItem("Hard");

    easy.setToggleGroup(group);
    medium.setToggleGroup(group);
    hard.setToggleGroup(group);

    hard.setSelected(false);
    hard.setOnAction(
        e -> {
          System.out.println("You selected hard");
        });

    difficultyMenu.getItems().addAll(easy, medium, hard);

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().addAll(difficultyMenu);

    BorderPane layout = new BorderPane();
    layout.setTop(menuBar);

    Scene scene = new Scene(layout, 500, 400);
    window.setScene(scene);
    window.show();
  }
  private MenuBar initMenu() {
    MenuBar bar = new MenuBar();
    bar.setPadding(new Insets(5));
    bar.setStyle("-fx-background-color: #3C4346;");

    Menu menuTasks = new Menu("Tasks");
    Menu menuPeople = new Menu("People");
    Menu menuShop = new Menu("Shop");

    MenuItem itemCashRegister = new MenuItem("Cash Register");
    MenuItem itemStocker = new MenuItem("Stocker");
    itemCashRegister.setOnAction(e -> checkoutWindow());
    itemStocker.setOnAction(e -> stockerWindow());

    MenuItem itemEmployees = new MenuItem("Employees");
    MenuItem itemCustomers = new MenuItem("Customers");
    MenuItem itemIceCream = new MenuItem("Ice Cream");
    itemIceCream.setOnAction(e -> IceCreamWindow());
    itemEmployees.setOnAction(e -> employeesWindow());
    itemCustomers.setOnAction(e -> customerWindow());

    MenuItem itemOverview = new MenuItem("Shop Overview");
    MenuItem itemEnd = new MenuItem("End Game");
    itemOverview.setOnAction(e -> shopoverviewWindow());
    itemEnd.setOnAction(e -> endGame());

    menuTasks.getItems().addAll(itemCashRegister, itemStocker, itemIceCream);
    menuPeople.getItems().addAll(itemEmployees, itemCustomers);
    menuShop.getItems().addAll(itemOverview, itemEnd);

    bar.getMenus().addAll(menuTasks, menuPeople, menuShop);

    return bar;
  }
Esempio n. 3
0
 public MenuBar toMenuBar() // TODO auto-wrap non-Menu items (or throw exception)
     {
   MenuBar menu = new MenuBar();
   List<Menu> menuItems = new ArrayList<Menu>();
   for (MenuItem item : items) {
     if (item instanceof Menu) menuItems.add((Menu) item);
   }
   menu.getMenus().setAll(menuItems);
   return menu;
 }
Esempio n. 4
0
  private MenuBar createMenuBar() {
    MenuBar retval = new MenuBar();

    // create menus to put into menu bar
    Menu loginMenu = new Menu("Login");
    loginMenu.getItems().addAll(login());
    Menu custMenu = new Menu("Customer");
    custMenu.getItems().addAll(onlinePurchase(), retrieveCart(), reviewOrders(), exitApp());
    Menu adminMenu = new Menu("Administrator");
    adminMenu.getItems().addAll(maintainCatalogs(), maintainProducts());

    // add menus to menubar
    retval.getMenus().addAll(loginMenu, custMenu, adminMenu);
    return retval;
  }
  @Override
  protected Menu addNonLeafToTop(ShadowMenu sm, MenuBar t) {

    Menu newMenu = new Menu(sm.getName());
    t.getMenus().add(newMenu);
    return newMenu;
  }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // GameChanger changer = new GameChanger();

    Menu m = new Menu();
    m.setText("Games");

    tglGames = new ToggleGroup();

    for (GameRuleDomainModel gr : GameRuleBLL.getRules()) {

      RadioMenuItem mi = new RadioMenuItem();
      String strRuleName = gr.getRULENAME();
      mi.setToggleGroup(tglGames);
      mi.setText(strRuleName);
      // mi.setOnAction(changer);

      if (gr.getDEFAULTGAME() == 1) {
        mi.setSelected(true);
      }
      m.getItems().add(mi);
    }

    mb.getMenus().add(0, m);
  }
  @FXML
  private void handleAction(ActionEvent event) {
    TextArea textarea = (TextArea) menuBar.getScene().lookup("#textarea");

    if (event.getSource() == chmiWordWrap) {
      wordWrapOn = chmiWordWrap.isSelected();
      textarea.setWrapText(wordWrapOn);

    } else if (event.getSource() == miChangeCase) {
      try {
        if (changeCaseDialog == null) {
          FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ChangeCaseDialog.fxml"));
          Parent root = fxmlLoader.load();
          controller = fxmlLoader.getController();
          controller.setSelectedCase(prefs.get(strSelectedCase, "UPPERCASE"));
          changeCaseDialog = new Stage();
          changeCaseDialog.setResizable(false);
          changeCaseDialog.initStyle(StageStyle.UTILITY);
          changeCaseDialog.setAlwaysOnTop(true);
          changeCaseDialog.setX(prefs.getDouble(strChangeCaseX, changeCaseDialog.getX()));
          changeCaseDialog.setY(prefs.getDouble(strChangeCaseY, changeCaseDialog.getY()));
          Scene scene = new Scene(root);
          changeCaseDialog.setScene(scene);
          changeCaseDialog.setTitle("Change Case");
        }

        changeCaseDialog.toFront();
        changeCaseDialog.show();
      } catch (Exception e) {

      }
    } else if (event.getSource() == miRemoveLineBreaks) {
      if (textarea.getSelectedText().length() == 0) {
        textarea.selectAll();

        if (textarea.getSelectedText().length() == 0) {
          return;
        }
      }

      String result = TextUtilities.removeLineBreaks(textarea.getSelectedText());

      int start = textarea.getSelection().getStart();
      textarea.replaceSelection(result);
      textarea.selectRange(start, start + result.length());
    } else if (event.getSource() == miFont) {
      Font font = textarea.getFont();
      FontSelectorDialog dialog = new FontSelectorDialog(font);
      Optional<Font> op = dialog.showAndWait();
      if (op.isPresent()) {
        textarea.setFont(op.get());
      }
    }
  }
  /*
   * sets up the functionality of the menubar
   */
  private void configureMenuBar() {

    fileMenu.getItems().addAll(fileNew, fileExit);

    menuBar.getMenus().addAll(fileMenu);

    this.setTop(menuBar);

    // sets up the user login
    fileNew.setOnAction(startNewAnalysis());

    // sets up the user exit
    fileExit.setOnAction(exitMenuClicked());
  }
  @Override
  public void start(Stage stage) {
    stage.setTitle("Menu Sample");
    Scene scene = new Scene(new VBox(), 400, 350);
    scene.setFill(Color.BLACK);

    MenuBar menuBar = new MenuBar();

    // --- Menu File
    Menu menuFile = new Menu("File");

    // --- Menu Edit
    Menu menuEdit = new Menu("Edit");

    // --- Menu View
    Menu menuView = new Menu("Lagersaldo för butik");

    menuBar.getMenus().addAll(menuFile, menuEdit, menuView);

    ((VBox) scene.getRoot()).getChildren().addAll(menuBar);

    stage.setScene(scene);
    stage.show();
  }
  public MenuBarController(MenuBar in) {
    this.menuBar = in;

    initFileMenu();
    initEditMenu();
    initWindowMenu();
    initHelpMenu();

    fileMenu
        .getItems()
        .addAll(openTestMenuItem, openMenuItem, saveMenuItem, preferencesMenuItem, quitMenuItem);
    editMenu.getItems().addAll(deleteMenuItem);
    windowMenu.getItems().addAll(codeWindowMenuItem, leftWindowMenuItem, rightWindowMenuItem);
    helpMenu.getItems().addAll(aboutMenuItem);
    menuBar.getMenus().addAll(fileMenu, editMenu, windowMenu, helpMenu);
  }
Esempio n. 11
0
 /**
  * Determines which rule is selected in the Games menu.
  *
  * <p>Iterates through the menus in the menu bar looking for the Games menu. Once found it
  * iterates through the menu items under Games looking for radio buttons. For every radio menu
  * item it finds it checks if it's been selected. If a selected one is found strRuleName is set
  * and the whole nest is broken out of and strRuleName is returned.
  *
  * @return
  */
 public String getRuleName() {
   String strRuleName = null;
   for (Menu m : mb.getMenus()) {
     if (m.getText() == "Games") {
       for (MenuItem mi : m.getItems()) {
         if (mi.getClass().equals(RadioMenuItem.class)) {
           RadioMenuItem rmi = (RadioMenuItem) mi;
           if (rmi.isSelected() == true) {
             strRuleName = rmi.getText();
             break;
           }
         }
       }
     }
   }
   return strRuleName;
 }
  public void initAdminLayout() {
    ObservableList<Menu> menus = menubar.getMenus();
    menus.clear();

    Menu menuMember = new Menu("Member");
    //        MenuItem addMemberItem = new MenuItem("add member");
    //        addMemberItem.setOnAction(new EventHandler<ActionEvent>() {
    //            @Override
    //            public void handle(ActionEvent event) {
    //                System.out.print("add member");
    //            }
    //        });
    MenuItem memberListItem = new MenuItem("member list");
    memberListItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(MEMBER_OVERVIEW);
          }
        });

    Menu menuBook = new Menu("Book");
    MenuItem allBookItem = new MenuItem("all publication");
    allBookItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(ALL_PUBLICATION);
          }
        });

    menuBook.getItems().add(allBookItem);

    menuMember.getItems().add(memberListItem);
    //        menuMember.getItems().add(addMemberItem);

    menus.add(menuMember);
    menus.add(menuBook);
    showContentView(MEMBER_OVERVIEW);
  }
 private Stage getStage() {
   return (Stage) menuBar.getScene().getWindow();
 }
Esempio n. 14
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("JavaFX Demo");

    /* create the menu (for the top of the user interface) */
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = new MenuItem("New", imageFile("images/new.png"));
    newMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+N"));
    fileMenu.getItems().add(newMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Open...", imageFile("images/open.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Save", imageFile("images/save.png")));
    fileMenu.getItems().add(new MenuItem("Save As...", imageFile("images/save_as.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem exitMenuItem = new MenuItem("Exit", imageFile("images/exit.png"));
    fileMenu.getItems().add(exitMenuItem);
    exitMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+Q"));
    exitMenuItem.setOnAction(e -> System.exit(0));

    Menu editMenu = new Menu("Edit");
    editMenu.getItems().add(new MenuItem("Cut", imageFile("images/cut.png")));
    editMenu.getItems().add(new MenuItem("Copy", imageFile("images/copy.png")));
    editMenu.getItems().add(new MenuItem("Paste", imageFile("images/paste.png")));

    Menu helpMenu = new Menu("Help");
    helpMenu.getItems().add(new MenuItem("About...", imageFile("images/about.png")));
    helpMenu.getItems().add(new SeparatorMenuItem());
    helpMenu.getItems().add(new MenuItem("Help...", imageFile("images/help.png")));

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().add(fileMenu);
    menuBar.getMenus().add(editMenu);
    menuBar.getMenus().add(helpMenu);

    /* create the table (for the center of the user interface) */
    table = new TableView<>();
    table.setItems(DataSource.getAllStudents());
    table.setEditable(true);

    /* create the table's columns */
    TableColumn<Student, Integer> sidColumn = null;
    sidColumn = new TableColumn<>("SID");
    sidColumn.setMinWidth(100);
    sidColumn.setCellValueFactory(new PropertyValueFactory<>("sid"));

    TableColumn<Student, String> firstNameColumn = null;
    firstNameColumn = new TableColumn<>("First Name");
    firstNameColumn.setMinWidth(200);
    firstNameColumn.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    firstNameColumn.setCellFactory(TextFieldTableCell.<Student>forTableColumn());
    firstNameColumn.setOnEditCommit(
        (CellEditEvent<Student, String> event) -> {
          ((Student) event.getTableView().getItems().get(event.getTablePosition().getRow()))
              .setFirstName(event.getNewValue());
        });

    TableColumn<Student, String> lastNameColumn = null;
    lastNameColumn = new TableColumn<>("Last Name");
    lastNameColumn.setMinWidth(200);
    lastNameColumn.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    lastNameColumn.setCellFactory(TextFieldTableCell.<Student>forTableColumn());
    lastNameColumn.setOnEditCommit(
        (CellEditEvent<Student, String> event) -> {
          ((Student) event.getTableView().getItems().get(event.getTablePosition().getRow()))
              .setLastName(event.getNewValue());
        });

    TableColumn<Student, Double> gpaColumn = null;
    gpaColumn = new TableColumn<>("GPA");
    gpaColumn.setMinWidth(100);
    gpaColumn.setCellValueFactory(new PropertyValueFactory<>("gpa"));

    table.getColumns().add(sidColumn);
    table.getColumns().add(lastNameColumn);
    table.getColumns().add(firstNameColumn);
    table.getColumns().add(gpaColumn);

    /* create an edit form (for the bottom of the user interface) */
    GridPane editArea = new GridPane();
    editArea.setPadding(new Insets(10, 10, 10, 10));
    editArea.setVgap(10);
    editArea.setHgap(10);

    Label sidLabel = new Label("SID:");
    editArea.add(sidLabel, 0, 0);
    TextField sidField = new TextField();
    sidField.setPromptText("SID");
    editArea.add(sidField, 1, 0);

    Label fnameLabel = new Label("First name:");
    editArea.add(fnameLabel, 0, 1);
    TextField fnameField = new TextField();
    fnameField.setPromptText("First Name");
    editArea.add(fnameField, 1, 1);

    Label lnameLabel = new Label("Last name:");
    editArea.add(lnameLabel, 0, 2);
    TextField lnameField = new TextField();
    lnameField.setPromptText("Last Name");
    editArea.add(lnameField, 1, 2);

    Label gpaLabel = new Label("GPA:");
    editArea.add(gpaLabel, 0, 3);
    TextField gpaField = new TextField();
    gpaField.setPromptText("GPA");
    editArea.add(gpaField, 1, 3);

    Button addButton = new Button("Add");
    addButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            int sid = Integer.parseInt(sidField.getText());
            String firstName = fnameField.getText();
            String lastName = lnameField.getText();
            double gpa = Double.parseDouble(gpaField.getText());

            table.getItems().add(new Student(sid, firstName, lastName, gpa));

            sidField.setText("");
            fnameField.setText("");
            lnameField.setText("");
            gpaField.setText("");
          }
        });
    editArea.add(addButton, 1, 4);

    /* arrange all components in the main user interface */
    layout = new BorderPane();
    layout.setTop(menuBar);
    layout.setCenter(table);
    layout.setBottom(editArea);

    Scene scene = new Scene(layout, 600, 600);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Esempio n. 15
0
  private void showMainStage(ReadOnlyObjectProperty<ObservableList<String>> friends) {
    BorderPane pane = new BorderPane();
    Scene scene = new Scene(pane, 550, 550, Color.WHITE);
    MenuBar menuBar = new MenuBar();
    Stage stage = new Stage();
    stage.setTitle("Zathura Enterprise ™");
    stage.getIcons().add(new Image(APPLICATION_ICON));
    menuBar.prefWidthProperty().bind(stage.widthProperty());
    pane.setTop(menuBar);
    pane.setCenter(img.getImgLogo()); // ADD LOGO

    Menu menuInicio = new Menu("_Conta"); // MENU
    MenuItem subAbrir = new MenuItem("Abrir conta"); // SUBMENU
    MenuItem subEditar = new MenuItem("Editar conta"); // SUBMENU
    MenuItem subExibir = new MenuItem("Exibir conta");
    MenuItem subListar = new MenuItem("Listar contas");
    MenuItem subFechar = new MenuItem("Fechar conta");
    MenuItem subExit = new MenuItem("Exit");
    subExit.setOnAction(actionEvent -> Platform.exit());
    menuInicio
        .getItems()
        .addAll(
            subAbrir,
            subEditar,
            subExibir,
            subListar,
            subFechar,
            new SeparatorMenuItem(),
            subExit); // ADD SUBMENU

    Menu menuOperacoes = new Menu("_Operações"); // MENU
    MenuItem subRelatorio = new MenuItem("Gerar Relatório");
    MenuItem subSaque = new MenuItem("Saque");
    MenuItem subDeposito = new MenuItem("Deposito");
    MenuItem subSaldo = new MenuItem("Saldo");
    MenuItem subTransferencia = new MenuItem("Transferência");
    menuOperacoes
        .getItems()
        .addAll(subSaque, subDeposito, subSaldo, subTransferencia, subRelatorio);

    Menu menuEspecial = new Menu("_Especial");
    MenuItem subEspecial = new MenuItem("Especial");
    menuEspecial.getItems().addAll(subEspecial);

    menuBar.getMenus().addAll(menuInicio, menuOperacoes, menuEspecial);
    stage.setScene(scene);
    stage.show();

    // BUTTONS MENU
    subAbrir.setOnAction(new Cadastro());
    subEditar.setOnAction(new Editar());
    subExibir.setOnAction(new Exibir());
    subListar.setOnAction(new Listar());
    subFechar.setOnAction(new Fechar());

    subSaque.setOnAction(new Saque());
    subDeposito.setOnAction(new Deposito());
    subSaldo.setOnAction(new Saldo());
    subTransferencia.setOnAction(new Transferencia());
    subRelatorio.setOnAction(new Relatorio());

    subEspecial.setOnAction(new Especial());
  }
Esempio n. 16
0
  /**
   * The opening class. When the launch method is run, the code in here begins to execute. All code
   *
   * @param primaryStage The intial stage opened on run
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  public void start(Stage primaryStage) throws Exception {
    primaryStage.setMaximized(true);
    primaryStage.setTitle("Equipment Manager");
    Button executive = new Button("Executive Options");
    TextField search = new TextField();
    search.setPromptText("Search");
    TableView<Item> table;

    // create filenames
    String fileName = System.getProperty("user.home") + "/item.csv";
    String passFileName = System.getProperty("user.home") + "/notoflookinghere.csv";
    String IDFileName = System.getProperty("user.home") + "/memberlist.csv";
    String logFileName = System.getProperty("user.home") + "/Log.csv";
    File x = new File(fileName);
    // if no file exists with given names, create default files
    if (!x.exists()) {
      csvFileWriter write = new csvFileWriter();
      write.writeCsvFile(logFileName);
      write.writeCsvFile(fileName);
      write.writeCsvFile(IDFileName);
      ArrayList<Item> list = new ArrayList<>();
      list.add(new Item(1000, "password", true, "none", false));
      write.enterData(list);
      write.writeCsvFile(passFileName);
    } else {
      System.out.println("Files Read");
    }

    manage.searchFor(fileName, search.getText());

    table = new TableView<>();
    table.setItems(UIManager.getItems(fileName, search.getText()));
    table.setMaxWidth(675);
    table
        .getColumns()
        .addAll(
            UIManager.referenceColumn(),
            UIManager.nameColumn(),
            UIManager.availableColumn(),
            UIManager.IDColumn(),
            UIManager.permColumn());

    Button checkout = new Button("Checkout");
    checkout.setOnAction(
        e -> {
          Checking.checkOut(fileName, IDFileName, passFileName);
          table.setItems(UIManager.getItems(fileName, search.getText()));
        });

    Button checkIn = new Button("Checkin");
    checkIn.setOnAction(
        e -> {
          Checking.checkIn(fileName);
          table.setItems(UIManager.getItems(fileName, search.getText()));
        });

    search.setOnKeyPressed(e -> table.setItems(UIManager.getItems(fileName, search.getText())));

    // This creates and sets up all the menu bars on the top of the page
    MenuBar menuBar = new MenuBar();

    // Menu Tabs
    Menu help = new Menu("_Help");
    Menu exec = new Menu("_Executive Settings");
    menuBar.getMenus().addAll(help, exec);

    // Menu Items
    MenuItem code = new MenuItem("View Code");
    MenuItem report = new MenuItem("Report a Bug");
    MenuItem openOptions = new MenuItem("Open Executive Options");
    help.getItems().addAll(code, report);
    exec.getItems().addAll(openOptions);

    // Menu External Links
    URI codeLink = new URI("https://github.com/NHSTechTeam/Equipment-System");
    URI reportLink = new URI("https://github.com/NHSTechTeam/Equipment-System/issues");

    // Menu Actions
    code.setOnAction(e -> UIManager.openWebpage(codeLink));
    report.setOnAction(e -> UIManager.openWebpage(reportLink));
    openOptions.setOnAction(
        e -> {
          try {
            ExecutiveMain.executive(fileName, passFileName, logFileName, IDFileName);
          } catch (URISyntaxException e1) {
            e1.printStackTrace();
          }
        });

    HBox menu = new HBox();
    menu.setPadding(new Insets(10, 10, 10, 10));
    menu.setSpacing(10);
    menu.setAlignment(Pos.CENTER);
    menu.getChildren().addAll(checkout, checkIn);

    executive.setOnAction(
        e -> {
          try {
            ExecutiveMain.executive(fileName, passFileName, logFileName, IDFileName);
          } catch (URISyntaxException e1) {
            e1.printStackTrace();
          }
        });

    BorderPane borderLayout = new BorderPane();
    VBox layout = new VBox(10);
    borderLayout.setTop(menuBar);
    borderLayout.setCenter(layout);
    layout.getChildren().addAll(search, table, menu, executive);
    layout.setAlignment(Pos.CENTER);
    Scene scene = new Scene(borderLayout, 300, 250);
    scene.getStylesheets().add("style.css");
    primaryStage.getIcons().add(new Image("images/icon.png"));
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Esempio n. 17
0
 private void setMainMenuItems(List<Menu> menus) {
   if (!Utils.isEmpty(menus)) {
     menuBar.getMenus().setAll(menus);
     ui.getChildren().add(menuBar);
   }
 }
  @Override
  public void start(Stage stage) {

    // create temporary file outside of application

    // create the scene

    stage.setTitle("CSV visualization");
    Browser b = new Browser();
    BorderPane sp = new BorderPane();
    VBox bottomStack = new VBox();

    FileChooser csvfinder = new FileChooser();
    ExtensionFilter filter = new ExtensionFilter("csv only", "*.csv");
    csvfinder.getExtensionFilters().add(filter);
    csvfinder.setTitle("Find CSV File");

    // initializing bounds and panes
    VBox topStack = new VBox(); // Creates a container to hold all Menu Objects.
    MenuBar mainMenu = new MenuBar(); // Creates our main menu to hold our Sub-Menus.
    ToolBar toolBar = new ToolBar(); // Creates our tool-bar to hold the buttons.
    topStack.getChildren().add(mainMenu);
    topStack.getChildren().add(toolBar);

    Menu file = new Menu("File");
    MenuItem openFile = new MenuItem("Open CSV File");
    MenuItem exitApp = new MenuItem("Exit");
    file.getItems().addAll(openFile, exitApp);

    // Create and add the "Edit" sub-menu options.
    Menu edit = new Menu("Edit");
    MenuItem properties = new MenuItem("Save Frame Image");
    edit.getItems().add(properties);

    // Create and add the "Help" sub-menu options.
    Menu help = new Menu("Help");
    MenuItem visitWebsite = new MenuItem("About");
    help.getItems().add(visitWebsite);
    mainMenu.getMenus().addAll(file, edit, help);

    Options rightStack = new Options(b);
    Label file_notif = new Label();
    file_notif.setText("No file");
    file_notif.setFont(Font.font("Tahoma", FontWeight.NORMAL, 15));
    topStack.setAlignment(Pos.CENTER_LEFT);
    bottomStack.getChildren().add(file_notif);

    // aligning boxes
    b.refresh();
    sp.setCenter(b);

    sp.setTop(topStack);
    sp.setRight(rightStack);
    sp.setBottom(bottomStack);
    properties.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            WritableImage image = b.snapshot(new SnapshotParameters(), null);
            FileChooser chooser = new FileChooser();
            // TODO: probably use a file chooser here
            File file = chooser.showSaveDialog(stage);

            try {
              ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file);
            } catch (IOException e) {
              // TODO: handle exception here
            }
          }
        });

    visitWebsite.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent event) {
            Stage stage = new Stage();
            // Fill stage with content
            StackPane sp = new StackPane();
            Label ta = new Label();
            ta.minHeight(400);
            ta.minWidth(400);

            ta.setText(
                "This is a tool that was developed by PowerAmerica to help "
                    + "visualize multidimensional CSV files on a 2D graph. It's "
                    + "initial use was visualization of the relationships between "
                    + "the specifications of different electrical components as shown"
                    + " by the sample data. Use the file menu option to upload any CSV file and use"
                    + " the option bars on the right pane to control the dimensions "
                    + "that you want to put on the graph.");
            ta.setWrapText(true);
            ta.setPadding(new Insets(10, 10, 10, 10));
            sp.setAlignment(Pos.TOP_LEFT);
            sp.getChildren().add(ta);

            Scene s = new Scene(sp, 400, 400);
            stage.setScene(s);

            stage.show();
          }
        });

    exitApp.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            System.exit(0);
          }
        });

    // button event handlers
    openFile.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            File file = csvfinder.showOpenDialog(stage);
            System.out.println(file.getName());

            file_notif.setText(file.getName());
            // write name to file for javascript to use

            FTPClient client = new FTPClient();
            FileInputStream fis = null;

            try {
              client.connect("ftp.enloecompsci.com");
              client.login("southpawac", "**********");
              client.changeWorkingDirectory("/public_html/PowerAmerica/CSV_FILES");
              System.out.print(client.getReplyString());
              fis = new FileInputStream(file.getPath());
              client.storeFile(file.getName(), fis);
              b.fileName = file.getName();
              client.logout();
            } catch (IOException e) {
              e.printStackTrace();
            } finally {
              try {
                if (fis != null) {
                  fis.close();
                }
                client.disconnect();
              } catch (IOException e) {
                e.printStackTrace();
              }
            }

            BufferedReader br;
            try {
              br = new BufferedReader(new FileReader(new File(file.getPath())));
              String options;
              if ((options = br.readLine()) != null) {
                rightStack.resetOptions(options.split(","));
                rightStack.setSizes();
              }

            } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });

    scene = new Scene(sp, 1000, 850, Color.web("#666970"));
    stage.setScene(scene);
    stage.show();
  }
Esempio n. 19
0
  @FXML
  private void handleAction(ActionEvent event) {
    List<IIOImage> iioImageList = GuiController.getInstance().iioImageList;
    List<BufferedImage> imageList = GuiController.getInstance().imageList;
    int imageIndex = GuiController.getInstance().imageIndex;
    if (iioImageList == null
        && (event.getSource() != chmiScreenshotMode)
        && event.getSource() != chmiSegmentedRegions) {
      Alert alert =
          new Alert(Alert.AlertType.INFORMATION, bundle.getString("Please_load_an_image."));
      alert.show();
      return;
    }

    if (event.getSource() == miMetadata) {
      try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ImageInfoDialog.fxml"));
        Parent root = fxmlLoader.load();
        ImageInfoDialogController controller = fxmlLoader.getController();
        controller.setImage(iioImageList.get(imageIndex));
        Stage imageInfoDialog = new Stage();
        imageInfoDialog.setResizable(false);
        imageInfoDialog.initStyle(StageStyle.UTILITY);
        imageInfoDialog.setAlwaysOnTop(true);
        //            imageInfoDialog.setX(prefs.getDouble(strChangeCaseX, imageInfoDialog.getX()));
        //            imageInfoDialog.setY(prefs.getDouble(strChangeCaseY, imageInfoDialog.getY()));
        Scene scene1 = new Scene(root);
        imageInfoDialog.setScene(scene1);
        imageInfoDialog.setTitle("Image Properties");
        imageInfoDialog.toFront();
        imageInfoDialog.show();
      } catch (Exception e) {

      }
    } else if (event.getSource() == miAutocrop) {
      menuBar.getScene().setCursor(Cursor.WAIT);

      originalImage = (BufferedImage) iioImageList.get(imageIndex).getRenderedImage();
      BufferedImage croppedImage =
          net.sourceforge.vietocr.util.ImageHelper.autoCrop(originalImage, 0.1);
      // if same image, skip
      if (originalImage != croppedImage) {
        stack.push(originalImage);
        imageList.set(imageIndex, croppedImage);
        iioImageList.get(imageIndex).setRenderedImage((BufferedImage) croppedImage);
        GuiController.getInstance().loadImage();
      }

      menuBar.getScene().setCursor(Cursor.DEFAULT);
    } else if (event.getSource() == miBrightness) {

    } else if (event.getSource() == miContrast) {

    } else if (event.getSource() == miDeskew) {
      menuBar.getScene().setCursor(Cursor.WAIT);

      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              ImageDeskew deskew =
                  new ImageDeskew((BufferedImage) iioImageList.get(imageIndex).getRenderedImage());
              double imageSkewAngle = deskew.getSkewAngle();

              if ((imageSkewAngle > MINIMUM_DESKEW_THRESHOLD
                  || imageSkewAngle < -(MINIMUM_DESKEW_THRESHOLD))) {
                originalImage = (BufferedImage) iioImageList.get(imageIndex).getRenderedImage();
                stack.push(originalImage);
                BufferedImage rotatedImage =
                    rotateImage(originalImage, Math.toRadians(-imageSkewAngle));
                imageList.set(imageIndex, rotatedImage); // persist the rotated image
                iioImageList.get(imageIndex).setRenderedImage(rotatedImage);
                GuiController.getInstance().loadImage();
              }
              menuBar.getScene().setCursor(Cursor.DEFAULT);
            }
          });
    } else if (event.getSource() == miGrayscale) {

    } else if (event.getSource() == miInvert) {

    } else if (event.getSource() == miMonochrome) {

    } else if (event.getSource() == miSharpen) {

    } else if (event.getSource() == miSmooth) {

    } else if (event.getSource() == miUndo) {
      if (stack.isEmpty()) {
        return;
      }
      BufferedImage image = stack.pop();
      imageList.set(imageIndex, image);
      iioImageList.get(imageIndex).setRenderedImage(image);
      GuiController.getInstance().loadImage();
    } else if (event.getSource() == chmiScreenshotMode) {
      Label labelScreenShotMode = (Label) menuBar.getScene().lookup("#labelScreenShotMode");
      labelScreenShotMode.setText(this.chmiScreenshotMode.isSelected() ? "On" : "Off");
    } else if (event.getSource() == chmiSegmentedRegions) {
      Node segmentedRegionsBox = menuBar.getScene().lookup("#segmentedRegionsBox");
      segmentedRegionsBox.setVisible(chmiSegmentedRegions.isSelected());
    }
  }
Esempio n. 20
0
 @Override
 protected void addLeafToTop(ShadowMenu sm, MenuBar t) {
   t.getMenus().add(new Menu(sm.getName()));
 }
Esempio n. 21
0
  @Override
  public void initialize(URL arg0, ResourceBundle arg1) {
    log.debug("Controller.initialize");
    service = new BbsService();
    service.setController(this);
    service.init();
    service.updateBoardList();
    boardTreeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    boardTreeView
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                if (boardTreeView.getSelectionModel().getSelectedItem() == null) {
                  return;
                }
                Board board =
                    (Board) boardTreeView.getSelectionModel().getSelectedItem().getValue();
                if (board.getUrl() == null) {
                  return;
                }
                log.debug("選択 " + board);
                service.openBoard(board);
              }
            });

    messageThreadListView.setCellFactory(
        new Callback<ListView<MessageThread>, ListCell<MessageThread>>() {
          @Override
          public ListCell<MessageThread> call(ListView<MessageThread> param) {
            return new MessageThreadCell();
          }
        });
    messageThreadListView
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                MessageThread messageThread =
                    (MessageThread) messageThreadListView.getSelectionModel().getSelectedItem();
                if (messageThread != null) {
                  messageThreadTitleLabel.setText(messageThread.getTitle());
                  service.openMessageThread(messageThread);
                }
              }
            });
    webEngine = messageView.getEngine();
    setupToolbar(boardListToolbar);
    setupToolbar(messageListToolbar);
    setupToolbar(threadListToolbar);

    if (IrisWindow.isMac()) {
      menuBar.setUseSystemMenuBar(true);
    } else {
      menuBar.setUseSystemMenuBar(false);
      closeButton.setVisible(false);
      minimizedButton.setVisible(false);
      maximizedButton.setVisible(false);
    }

    service.openLastSelectedItem();
  }
Esempio n. 22
0
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("Chapter 15-16 Adding Tabs to a UI");
    Group root = new Group();
    Scene scene = new Scene(root, 400, 250, Color.WHITE);

    TabPane tabPane = new TabPane();

    MenuBar menuBar = new MenuBar();

    EventHandler<ActionEvent> action = changeTabPlacement(tabPane);

    Menu menu = new Menu("Tab Side");
    MenuItem left = new MenuItem("Left");

    left.setOnAction(action);
    menu.getItems().add(left);

    MenuItem right = new MenuItem("Right");
    right.setOnAction(action);
    menu.getItems().add(right);

    MenuItem top = new MenuItem("Top");
    top.setOnAction(action);
    menu.getItems().add(top);

    MenuItem bottom = new MenuItem("Bottom");
    bottom.setOnAction(action);
    menu.getItems().add(bottom);

    menuBar.getMenus().add(menu);

    BorderPane borderPane = new BorderPane();

    // generate 10 tabs
    for (int i = 0; i < 10; i++) {
      Tab tab = new Tab();
      tab.setText("Tab" + i);
      HBox hbox = new HBox();
      hbox.getChildren().add(new Label("Tab" + i));
      hbox.setAlignment(Pos.CENTER);
      tab.setContent(hbox);
      tabPane.getTabs().add(tab);
    }

    // add tab pane
    borderPane.setCenter(tabPane);

    // bind to take available space
    borderPane.prefHeightProperty().bind(scene.heightProperty());
    borderPane.prefWidthProperty().bind(scene.widthProperty());

    // added menu bar
    borderPane.setTop(menuBar);

    // add border Pane
    root.getChildren().add(borderPane);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
Esempio n. 23
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    /* create the menu (for the top of the user interface) */
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = new MenuItem("New", imageFile("images/new.png"));
    newMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+N"));
    fileMenu.getItems().add(newMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Open...", imageFile("images/open.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem saveMenuItem = new MenuItem("Save", imageFile("images/save.png"));
    fileMenu.getItems().add(saveMenuItem);
    MenuItem saveAsMenuItem = new MenuItem("Save As...", imageFile("images/save_as.png"));
    fileMenu.getItems().add(saveAsMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem exitMenuItem = new MenuItem("Exit", imageFile("images/exit.png"));
    fileMenu.getItems().add(exitMenuItem);
    exitMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+Q"));
    exitMenuItem.setOnAction(e -> System.exit(0));

    Menu editMenu = new Menu("Edit");
    editMenu.getItems().add(new MenuItem("Cut", imageFile("images/cut.png")));
    editMenu.getItems().add(new MenuItem("Copy", imageFile("images/copy.png")));
    editMenu.getItems().add(new MenuItem("Paste", imageFile("images/paste.png")));

    Menu helpMenu = new Menu("Help");
    helpMenu.getItems().add(new MenuItem("About...", imageFile("images/about.png")));
    helpMenu.getItems().add(new SeparatorMenuItem());
    helpMenu.getItems().add(new MenuItem("Help...", imageFile("images/help.png")));

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().add(fileMenu);
    menuBar.getMenus().add(editMenu);
    menuBar.getMenus().add(helpMenu);
    primaryStage.setTitle("Lab08");
    // grid contains all of the textfeilds, labels , buttons, ect..
    GridPane grid = new GridPane();
    // the tableview puts all of our data into a exel like format
    TableView<StudentRecord> table = new TableView<>();
    table.setItems(DataSource.getAllMarks());
    table.setEditable(true);

    TableColumn<StudentRecord, String> IDColumn = null;
    IDColumn = new TableColumn<>("SID");
    IDColumn.setMinWidth(100);
    // the thing in quotes is what it will search for in the StudentRecords.java (MAKE SURE THERE IS
    // A GET FUNCTION FOR THAT VARIBALE)
    IDColumn.setCellValueFactory(new PropertyValueFactory<>("ID"));

    TableColumn<StudentRecord, Double> AssignmentColumn = null;
    AssignmentColumn = new TableColumn<>("Assignment");
    AssignmentColumn.setMinWidth(100);
    AssignmentColumn.setCellValueFactory(new PropertyValueFactory<>("Assign"));

    TableColumn<StudentRecord, Float> MidtermColumn = null;
    MidtermColumn = new TableColumn<>("Midterm");
    MidtermColumn.setMinWidth(100);
    MidtermColumn.setCellValueFactory(new PropertyValueFactory<>("Midterm"));

    TableColumn<StudentRecord, Float> FinalColumn = null;
    FinalColumn = new TableColumn<>("Final Exam");
    FinalColumn.setMinWidth(100);
    FinalColumn.setCellValueFactory(new PropertyValueFactory<>("Final"));

    TableColumn<StudentRecord, String> GradeColumn = null;
    GradeColumn = new TableColumn<>("Letter Grade");
    GradeColumn.setMinWidth(100);
    GradeColumn.setCellValueFactory(new PropertyValueFactory<>("Grade"));

    table.getColumns().add(IDColumn);
    table.getColumns().add(AssignmentColumn);
    table.getColumns().add(MidtermColumn);
    table.getColumns().add(FinalColumn);
    table.getColumns().add(GradeColumn);

    Label IDLabel = new Label("SID:");
    grid.add(IDLabel, 0, 0);
    TextField IDField = new TextField();
    IDField.setPromptText("SID");
    grid.add(IDField, 1, 0);

    Label AssignLabel = new Label("Assignments:");
    grid.add(AssignLabel, 2, 0);

    TextField AssignField = new TextField();
    AssignField.setPromptText("Assignment");
    grid.add(AssignField, 3, 0);

    Label MidLabel = new Label("Midterm:");
    grid.add(MidLabel, 0, 1);

    TextField midField = new TextField();
    midField.setPromptText("Midterm");
    grid.add(midField, 1, 1);

    Label FinalLabel = new Label("Final:");
    grid.add(FinalLabel, 2, 1);

    TextField FinalField = new TextField();
    FinalField.setPromptText("Final");
    grid.add(FinalField, 3, 1);

    Button AddButton = new Button("Add");
    AddButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            char Grade;
            String SID = IDField.getText();
            Float Assignment = Float.parseFloat(AssignField.getText());
            Float Midterm = Float.parseFloat(midField.getText());
            Float Final = Float.parseFloat(FinalField.getText());
            table.getItems().add(new StudentRecord(SID, Assignment, Midterm, Final));

            IDField.setText("");
            AssignField.setText("");
            midField.setText("");
            FinalField.setText("");
          }
        });
    grid.add(AddButton, 0, 2);

    layout = new BorderPane();
    layout.setTop(menuBar);
    layout.setCenter(table);
    layout.setBottom(grid);

    Scene scene = new Scene(layout);
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(10);
    grid.setHgap(10);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
 public void applyTo(javafx.scene.control.MenuBar x) {
   super.applyTo(x);
   int set = __set;
   if ((set & (1 << 0)) != 0) x.getMenus().addAll(this.menus);
   if ((set & (1 << 1)) != 0) x.setUseSystemMenuBar(this.useSystemMenuBar);
 }
Esempio n. 25
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;
  }
Esempio n. 26
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();
  }