Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int count = 0;
- public void createFile(ActionEvent actionEvent) {
- if (count >4) {
- System.out.println("No more tabs!");
- }else {
- tabBox=new Tab(" Untitled " + (tabPane.getTabs().size() + 1));
- paramMenu(actionEvent);
- tabBox.setContent(anchorParams);
- tabPane.getTabs().add(tabBox);
- tabPane.getSelectionModel().selectNext();
- if (tabPane.getTabs().size() < 2 ) {
- count = 1;
- }
- count++;
- }
- if (count < 1 || tabPane.getTabs().size() == 1 ){
- tabBox.getTabPane().setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
- } else {
- tabBox.getTabPane().setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement