Java Code Examples for javafx.scene.control.Button

The following are top voted examples for showing how to use javafx.scene.control.Button. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: marathonv5   File: ColorButtonSample.java   Source Code and License 7 votes vote down vote up
public ColorButtonSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    for(int i=0; i<7; i++) {
        Button b = new Button("Color");
        b.setStyle("-fx-base: rgb("+(10*i)+","+(20*i)+","+(10*i)+");");
        hBox.getChildren().add(b);
    }
    HBox hBox2 = new HBox();
    hBox2.setSpacing(5);
    hBox2.setTranslateY(30);
    Button red = new Button("Red");
    red.setStyle("-fx-base: red;");
    Button orange = new Button("Orange");
    orange.setStyle("-fx-base: orange;");
    Button yellow = new Button("Yellow");
    yellow.setStyle("-fx-base: yellow;");
    Button green = new Button("Green");
    green.setStyle("-fx-base: green;");
    Button blue = new Button("Blue");
    blue.setStyle("-fx-base: rgb(30,170,255);");
    Button indigo = new Button("Indigo");
    indigo.setStyle("-fx-base: blue;");
    Button violet = new Button("Violet");
    violet.setStyle("-fx-base: purple;");
    hBox2.getChildren().add(red);
    hBox2.getChildren().add(orange);
    hBox2.getChildren().add(yellow);
    hBox2.getChildren().add(green);
    hBox2.getChildren().add(blue);
    hBox2.getChildren().add(indigo);
    hBox2.getChildren().add(violet);

    VBox vBox = new VBox(20);
    vBox.getChildren().addAll(hBox,hBox2);
    getChildren().add(vBox);
}
 
Example 2
Project: voogasalad-ltub   File: GameChooser.java   Source Code and License 6 votes vote down vote up
private List<Button> createPresetButtons() {
	List<Button> buttons = new ArrayList<>();
	for (String gameName : presetGames.keySet()) {
		GameMetaData gameMeta = presetGames.get(gameName);
		Button button = new Button();
		ImageView gameImageView = new ImageView(gameMeta.getImage());
		gameImageView.setFitWidth(App.WIDTH / 3);
		gameImageView.setPreserveRatio(true);
		button.setGraphic(gameImageView);
		button.setOnMouseClicked((e) -> {
			startGame(gameMeta.getGameFilePath());
		});
		getRotation(button);
		buttons.add(button);
	}
	return buttons;
}
 
Example 3
Project: voogasalad-ltub   File: SingleStat.java   Source Code and License 6 votes vote down vote up
public void addUpgradeBtn() {
	upgradeBtn = new Button();
	upgradeBtn.setText("UPGRADE");
	upgradeBtn.setOnAction(e -> {
		Stage msgStage = new Stage();
		VBox root = new VBox();
		Scene scene = new Scene(root);
		Text  text = new Text("Are you sure you want to upgrade " + name + "? It will cost you 10 gold.");
		HBox options = new HBox();
		Button yes = new Button ("yes");
		yes.setOnAction(f -> {
			sprite.getComponent(GameBus.TYPE).get().getGameBus().emit(new ChangeWealthEvent
					(ChangeWealthEvent.CHANGE, sprite.getComponent(Owner.TYPE).get().player(), WealthType.GOLD, -10));
			msgStage.close();
		});
		Button no = new Button("no");
		no.setOnAction(g -> {
			msgStage.close();
		});
		options.getChildren().add(yes);
		root.getChildren().addAll(text, options);
		msgStage.setScene(scene);
		msgStage.show();
	});
	this.getChildren().add(upgradeBtn);
}
 
Example 4
Project: jmonkeybuilder   File: ResourcePropertyEditorControl.java   Source Code and License 6 votes vote down vote up
@Override
@FXThread
protected void createComponents() {
    super.createComponents();

    resourceLabel = new Label(NOT_SELECTED);

    final Button changeButton = new Button();
    changeButton.setGraphic(new ImageView(Icons.ADD_16));
    changeButton.setOnAction(event -> processSelect());

    final HBox container = new HBox(resourceLabel, changeButton);
    container.prefWidthProperty().bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));

    resourceLabel.prefWidthProperty().bind(container.widthProperty());

    FXUtils.addToPane(container, this);

    FXUtils.addClassesTo(container, CSSClasses.DEF_HBOX, CSSClasses.TEXT_INPUT_CONTAINER);
    FXUtils.addClassesTo(changeButton, CSSClasses.FLAT_BUTTON, CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
    FXUtils.addClassTo(resourceLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL);

    DynamicIconSupport.addSupport(changeButton);
}
 
Example 5
Project: FX-Test   File: BaseTestFXComponentTest.java   Source Code and License 6 votes vote down vote up
public LoginComponent(BorderPane p) {
	GridPane g = new GridPane();

	{
		g.add(new Label("Username"), 0, 0);
		username = new TextField();
		g.add(username, 1, 0);
	}

	{
		g.add(new Label("Password"), 0, 1);
		password = new PasswordField();
		g.add(password, 1, 1);
	}

	Button button = new Button("Login");
	button.setOnAction(e -> {
		if( username.getText().equals("[email protected]") ) {
			if( password.getText().equals("test") ) {
				status = Status.ok();
			} else {
				status = Status.status(Status.State.ERROR, 2, "Invalid password for '"+username.getText()+"'", null);
			}
		} else {
			status = Status.status(Status.State.ERROR, 1, "Unknown username", null);
		}
	});
	g.add(button, 1, 2);
	g.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
	g.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
	p.setCenter(g);
}
 
Example 6
Project: NoMoreOversleeps   File: MainDialog.java   Source Code and License 6 votes vote down vote up
private void addIntegrationButtonsToVbox(Integration integration, VBox vbox)
{
	for (String buttonKey : integration.getActions().keySet())
	{
		System.out.println("*" + buttonKey);
		final Action clickableButton = integration.getActions().get(buttonKey);
		if (clickableButton.isHiddenFromFrontend())
		{
			continue;
		}
		final Button jfxButton = new Button(clickableButton.getName());
		jfxButton.setPadding(new Insets(2, 4, 2, 4));
		jfxButton.setMinWidth(256);
		jfxButton.setMaxWidth(256);
		jfxButton.setAlignment(Pos.BASELINE_LEFT);
		jfxButton.setContentDisplay(ContentDisplay.RIGHT);
		jfxButton.setTooltip(new Tooltip(buttonKey + "\n" + clickableButton.getDescription())); // I tried it, but it looks a bit janky
		jfxButton.setOnAction(new EventHandler<ActionEvent>()
		{
			@Override
			public void handle(ActionEvent arg0)
			{
				try
				{
					triggerEvent("<" + clickableButton.getName() + "> from frontend", null);
					clickableButton.onAction(null);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
		vbox.getChildren().add(jfxButton);
	}
}
 
Example 7
Project: voogasalad-ltub   File: MessagingView.java   Source Code and License 6 votes vote down vote up
private VBox makeInputBox() {
	VBox inputBox = new VBox(10);
	Label username = new Label(USERNAME_LABEL);
	Label messageName = new Label(MESSAGE_LABEL);
	TextField userField = new TextField(); 
	TextField inputField = new TextField();
	Button sendButton = new Button("Send");
	sendButton.setOnAction(e -> {
		String message = inputField.getText(); 
		String sender = userField.getText(); 
		//FIXME: fix connection stuff
		myUser.recieveMessage(sender, message);
	});
	
	HBox usernameField  = new HBox(); 
	usernameField.getChildren().addAll(username, userField);
	HBox messageField = new HBox(); 
	messageField.getChildren().addAll(messageName, inputField);
	inputBox.getChildren().addAll(usernameField, messageField, sendButton);
	
	return inputBox;
	
}
 
Example 8
Project: Socket_Chat   File: ClientGUI.java   Source Code and License 6 votes vote down vote up
private GridPane initGridPane() {

        GridPane gridPane = new GridPane();
        //
        TextField faddress = new TextField();
        faddress.setPromptText("Enter server adders");
        faddress.setOnAction(s -> client.makeConnection(faddress.getText()));
        //text field init
        TextField textField = new TextField();

        textField.setPromptText("Enter command");
        textField.setOnAction(s -> {
            process(textField.getText());
            textField.setText("");
        });

        //btn
        Button button = new Button("Connect");
        button.setOnAction(s -> client.makeConnection(faddress.getText()));
        gridPane.add(button, 0, 0);
        gridPane.add(faddress, 1, 0, 1, 1);
        gridPane.add(clientConsole.view, 0, 1, 2, 1);
        gridPane.add(textField, 0, 2, 2, 1);

        gridPane.setAlignment(Pos.CENTER);


        //grid settings
        gridPane.setHgap(10);
        gridPane.setVgap(10);


        return gridPane;
    }
 
Example 9
Project: Dronology   File: ButtonGenerator.java   Source Code and License 6 votes vote down vote up
/**
 * Initial return to home base command
 * @param flightZoneView
 * @param btnText
 * @param stage
 * @return
 */
Button makeReturnHomeButton(final FlightZoneView flightZoneView, String btnText, Stage stage){
    Button platoonBtn = createButton(btnText, 120);
    platoonBtn.setOnAction(
    new EventHandler<ActionEvent>() {
       @Override
       public void handle(final ActionEvent e) {
      	    try {
				flightZoneView.flightManager.getFlights().groundAllFlights();
			} catch (FlightZoneException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
   	     }
    });
    return platoonBtn;
}
 
Example 10
Project: voogasalad-ltub   File: MasterDeveloperInterface.java   Source Code and License 6 votes vote down vote up
private void instantiate() {
			Button spriteButton = new Button(myResources.getString(CREATE_NEW_SPRITE));
			Button screenButton = new Button(myResources.getString(CREATE_NEW_SCREEN));
			Button attributeButton = new Button(myResources.getString(CREATE_NEW_ATTRIBUTE));
			spriteButton.setOnAction((clicked) -> {
				Tab spriteTab = new Tab(myResources.getString(CREATE_NEW_SPRITE),
						new SpriteCreationScreen(myModelData));
				developerTabs.getTabs().add(spriteTab);
			});
//			screenButton.setOnAction((clicked) -> {
//				Tab screenTab = new Tab(myResources.getString(CREATE_NEW_SCREEN),
//						new ScreenModelCreator(myModelData.getScreenSprites(), myGeneralDataCreator, new ScreenModelData()));
//				developerTabs.getTabs().add(screenTab);
//			});
			screenButton.setOnAction((clicked) -> {
//				Tab screenTab = new Tab(myResources.getString(CREATE_NEW_SCREEN),
//						new ScreenModelCreator(myModelData.getScreenSprites(), myGeneralDataCreator, new ScreenModelData()));
				//developerTabs.getTabs().add(screenTab);
			});
//			attributeButton.setOnAction((clicked) -> {
//				Tab attributeTab = new Tab(myResources.getString(CREATE_NEW_ATTRIBUTE), new GroundUpAttributeCreator());
//				developerTabs.getTabs().add(attributeTab);
//			});
			this.getChildren().addAll(//spriteButton, 
					screenButton);//, attributeButton);
		}
 
Example 11
Project: Calculadora-JavaFx   File: Controller.java   Source Code and License 6 votes vote down vote up
@FXML
private void processDot(ActionEvent event) {

    //Impede que pontos (vírgula) sejam concatenados como resultado de uma operação
    if (start) {
        output.setText("");
        start = false;
    }

    //Impede que o ponto (vírgula) seja clicada mais de uma vez
    if (dot) {
        return;
    }

    //Impede que inicie um número clicando no ponto (vírgula)
    if (!number1Value) {
        return;
    }

    String value = ((Button) event.getSource()).getText();
    output.setText(output.getText() + value);
    dot = true;
}
 
Example 12
Project: Goliath-Overclocking-Utility-FX   File: NotifyTab.java   Source Code and License 6 votes vote down vote up
public NotifyTab()
{
    super();
    super.setText("Notification");
    super.setClosable(false);
    
    pane = new Pane();
    box = new VBox();        
    header = new Label();
    desc = new Label();
    
    okButton = new Button("Ok");
    okButton.setPrefWidth(50);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    box.getChildren().addAll(header, desc, okButton);
    box.setPadding(new Insets(15, 15, 15, 15));
    box.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(box);
    
    super.setContent(pane);
}
 
Example 13
Project: can4eve   File: JavaFXDisplay.java   Source Code and License 6 votes vote down vote up
/**
 * create the Menu Bar
 * 
 * @param scene
 */
public MenuBar createMenuBar(Scene scene, com.bitplan.gui.App app) {
  MenuBar lMenuBar = new MenuBar();
  for (com.bitplan.gui.Menu amenu : app.getMainMenu().getSubMenus()) {
    Menu menu = new Menu(i18n(amenu.getId()));
    lMenuBar.getMenus().add(menu);
    for (com.bitplan.gui.MenuItem amenuitem : amenu.getMenuItems()) {
      MenuItem menuItem = new MenuItem(i18n(amenuitem.getId()));
      menuItem.setOnAction(this);
      menuItem.setId(amenuitem.getId());
      menu.getItems().add(menuItem);
    }
  }

  hideMenuButton = new Button(I18n.get(I18n.HIDE_MENU));
  hideMenuButton.setOnAction(new EventHandler<ActionEvent>() {
    @Override
    public void handle(ActionEvent e) {
      showMenuBar(scene, lMenuBar, !lMenuBar.isVisible());
    }
  });
  return lMenuBar;
}
 
Example 14
Project: Notebook   File: SettingFragment.java   Source Code and License 6 votes vote down vote up
@Override
public void initData(Parent node, Map<String, String> bundle) {
	et_download_path = (TextField) node.lookup("#et_download_path");
	et_deploy_path = (TextField) node.lookup("#et_deploy_path");
	et_secret = (TextField) node.lookup("#et_secret");
	et_git_username = (TextField) node.lookup("#et_git_username");
	et_git_passwd = (PasswordField) node.lookup("#et_git_passwd");
	et_app_password = (PasswordField) node.lookup("#et_app_password");
	et_app_password_second = (PasswordField) node.lookup("#et_app_password_second");
	btn_submit = (Button) node.lookup("#btn_submit");

	readFromProperty();

	btn_submit.setOnAction(e->{
		String message = "";
		if(!et_app_password.getText().trim().equals(et_app_password_second.getText().trim())){
			message = "�����������벻һ�£�";
			DialogHelper.alert("����", message);
			return;
		}
		if(!"".equals(et_app_password.getText().trim()) && et_app_password.getText().trim().length() < 5){
			message = "���볤��̫��,������ȫ��";
			DialogHelper.alert("����", message);
			return;
		}

		writeToProperty();
	});


}
 
Example 15
Project: Mafia-TCoS-CS319-Group2A   File: CreditsController.java   Source Code and License 6 votes vote down vote up
@FXML
public void buttonPressed(MouseEvent actionEvent) throws IOException {
    Button button = (Button)actionEvent.getSource();
    if ((button).getText().equals("BACK"))
    {
        Stage current = (Stage)button.getScene().getWindow();
        Parent root = FXMLLoader.load(getClass().getResource("menuSample.fxml"));
        current.setMaximized(true);
        current.setScene(new Scene(root, screenSize.getWidth(), screenSize.getHeight()));
        //current.setFullScreen(true);
        current.show();
    }
}
 
Example 16
Project: GazePlay   File: GameContext.java   Source Code and License 6 votes vote down vote up
public void createToggleFullScreenButtonInGameScreen(@NonNull GazePlay gazePlay) {

        EventHandler<Event> eventHandler = new EventHandler<javafx.event.Event>() {
            @Override
            public void handle(javafx.event.Event e) {
                gazePlay.toggleFullScreen();
            }
        };

        Image buttonGraphics = new Image("data/common/images/fullscreen.png");

        Button button = new Button("FullScreen", new ImageView(buttonGraphics));
        button.addEventHandler(MouseEvent.MOUSE_CLICKED, eventHandler);

        // button.recomputeSizeAndPosition(scene);
        menuHBox.getChildren().add(button);
    }
 
Example 17
Project: marathonv5   File: FileSelectionStage.java   Source Code and License 6 votes vote down vote up
private HBox createBrowserField() {
    HBox browseFieldBox = new HBox(5);
    dirField = new TextField();
    dirField.setId("DirectoryField");
    dirField.textProperty().addListener((observable, oldValue, newValue) -> updateOKButton());
    HBox.setHgrow(dirField, Priority.ALWAYS);
    Button browseButton = FXUIUtils.createButton("browse", "Browse directory", true, "Browse");
    FileSelectionHandler browserListener;
    String fileType = fileSelectionInfo.getFileType();
    if (fileType != null) {
        browserListener = new FileSelectionHandler(this,
                new ExtensionFilter(fileType, Arrays.asList(fileSelectionInfo.getExtensionFilters())), this, null,
                fileSelectionInfo.getTitle());
    } else {
        browserListener = new FileSelectionHandler(this, null, this, null, fileSelectionInfo.getTitle());
        browserListener.setMode(FileSelectionHandler.DIRECTORY_CHOOSER);
    }
    browserListener.setPreviousDir(new File(System.getProperty(Constants.PROP_PROJECT_DIR, ProjectLayout.projectDir)));
    browseButton.setOnAction(browserListener);
    Label label = createLabel("Name: ");
    label.setMinWidth(Region.USE_PREF_SIZE);
    label.setId("FileSelectedLabel");
    browseFieldBox.getChildren().addAll(label, dirField, browseButton);
    VBox.setMargin(browseFieldBox, new Insets(5, 5, 5, 5));
    return browseFieldBox;
}
 
Example 18
Project: marathonv5   File: RFXButtonBaseTest.java   Source Code and License 6 votes vote down vote up
@Test public void click() {
    Button button = (Button) getPrimaryStage().getScene().getRoot().lookup(".button");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(new Runnable() {
        @Override public void run() {
            RFXButtonBase rfxButtonBase = new RFXButtonBase(button, null, null, lr);
            Point2D sceneXY = button.localToScene(new Point2D(3, 3));
            PickResult pickResult = new PickResult(button, sceneXY.getX(), sceneXY.getY());
            Point2D screenXY = button.localToScreen(new Point2D(3, 3));
            MouseEvent me = new MouseEvent(button, button, MouseEvent.MOUSE_PRESSED, 3, 3, sceneXY.getX(), screenXY.getY(),
                    MouseButton.PRIMARY, 1, false, false, false, false, true, false, false, false, false, false, pickResult);
            rfxButtonBase.mouseButton1Pressed(me);
        }
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording select = recordings.get(0);
    AssertJUnit.assertEquals("click", select.getCall());
    AssertJUnit.assertEquals("", select.getParameters()[0]);
}
 
Example 19
Project: voogasalad-ltub   File: GameManager.java   Source Code and License 6 votes vote down vote up
private HBox initSystemSettings() {
	HBox settingBox = new HBox();
	settingBox.setAlignment(Pos.TOP_RIGHT);
	settingBox.setSpacing(15);

	Button musicButton = new Button();
	ImageView musicImageView = new ImageView(
			new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("music"))));
	musicImageView.setFitWidth(20);
	musicImageView.setPreserveRatio(true);
	musicButton.setGraphic(musicImageView);
	musicButton.setOnMousePressed(e -> {
		// TODO show a menu of several choices of background music
		System.out.println("Here should be a menu of background music choices.");
	});
	settingBox.getChildren().add(musicButton);
	return settingBox;
}
 
Example 20
Project: vars-annotation   File: FilterableTreeItemDemo.java   Source Code and License 6 votes vote down vote up
private Node createAddItemPane() {
    HBox box = new HBox(6);
    TextField firstname = new TextField();
    firstname.setPromptText("Enter first name ...");
    TextField lastname = new TextField();
    lastname.setPromptText("Enter last name ...");

    Button addBtn = new Button("Add new actor to \"Folder 1\"");
    addBtn.setOnAction(event -> {
        FilterableTreeItem<Actor> treeItem = new FilterableTreeItem<>(new Actor(firstname.getText(), lastname.getText()));
        folder1.getInternalChildren().add(treeItem);
    });
    addBtn.disableProperty().bind(Bindings.isEmpty(lastname.textProperty()));

    box.getChildren().addAll(firstname, lastname, addBtn);
    TitledPane pane = new TitledPane("Add new element", box);
    pane.setCollapsible(false);
    return pane;
}
 
Example 21
Project: Lernkartei_2017   File: RenameView.java   Source Code and License 5 votes vote down vote up
@Override
public void refreshView ()
{
	renameLayout.getChildren().clear();
	doorname="";
	if(getFXController().getLastViewName().matches("views.StackView.*"))
	{
		doorname = getMyModel().getDataList("").get(getMyModel().getDataList("").size()-1);
	}
	
		oldValue = getMyModel().getString("");
		TextField front = new TextField(getMyModel().getString(""));
		front.setPromptText("Eingabe erforderlich");

		Button saveBtn = new Button("Speichern"); // \u270d \u2055 \u2699 \u270E
		saveBtn.setId("small");
		saveBtn.setOnAction(e ->
		{		
			saveNameAndExit(oldValue, front.getText(), doorname);
		});
		saveBtn.setOnKeyReleased(e ->
		{
			if (e.getCode() == KeyCode.ENTER)
				saveNameAndExit(oldValue, front.getText(), doorname);
		});
		
		front.setOnKeyReleased(e ->
		{
			if (e.getCode() == KeyCode.ENTER)
			{
				saveNameAndExit(oldValue, front.getText(), doorname);
			}		
		});

		renameLayout.getChildren().addAll(front, saveBtn);
	
	scroller.setContent(renameLayout);
}
 
Example 22
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Create the additional envs control.
 */
@FXThread
private void createAdditionalEnvsControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_ENVS_FOLDER_LABEL + ":");
    final HBox fieldContainer = new HBox();

    additionalEnvsField = new TextField();
    additionalEnvsField.setEditable(false);
    additionalEnvsField.prefWidthProperty().bind(root.widthProperty());

    final Button addButton = new Button();
    addButton.setGraphic(new ImageView(Icons.ADD_12));
    addButton.setOnAction(event -> processAddEF());

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> processRemoveEF());
    removeButton.disableProperty().bind(additionalEnvsField.textProperty().isEmpty());

    FXUtils.addToPane(label, fieldContainer, container);
    FXUtils.addToPane(additionalEnvsField, addButton, removeButton, fieldContainer);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(additionalEnvsField, CSSClasses.TRANSPARENT_TEXT_FIELD);
    FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(additionalEnvsField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
    FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
            CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);

    DynamicIconSupport.addSupport(addButton, removeButton);
}
 
Example 23
Project: NoMoreOversleeps   File: JavaFxHelper.java   Source Code and License 5 votes vote down vote up
public static Button createButtonMaxW(String text, double width)
{
	Button button = createButton();
	button.setText(text);
	button.setMaxWidth(width);
	return button;
}
 
Example 24
Project: LIRE-Lab   File: CommandTriggerFactory.java   Source Code and License 5 votes vote down vote up
public Button createButton(Command<E> command, CommandArgProvider<E> provider) {
    Button button = new Button();

    button.setGraphic(command.getIcon());
    button.setTooltip(new Tooltip(command.getLabel()));
    button.setOnAction(event -> command.execute(provider.provide()));

    return button;
}
 
Example 25
Project: WebPLP   File: WatcherWindow.java   Source Code and License 5 votes vote down vote up
private Node createRegisterControlPanel()
{
	BorderPane registerPanel = new BorderPane();
	
	Label watchRegisterLabel = new Label("Watch Register: ");
	registerPanel.setLeft(watchRegisterLabel);
	setAlignment(watchRegisterLabel, Pos.CENTER);
	
	TextField registerNameField = new TextField();
	registerPanel.setCenter(registerNameField);
	setAlignment(registerNameField, Pos.CENTER);
	
	Button watchRegisterButton = new Button("Add");
	watchRegisterButton.setOnAction((event) -> watchRegister(registerNameField
			.getText()));
	registerPanel.setRight(watchRegisterButton);
	setAlignment(watchRegisterButton, Pos.CENTER);
	
	Pair<Node, ComboBox<String>> optionsRowPair = createDisplayOptionsRow();
	Node displayOptions = optionsRowPair.getKey();
	ComboBox<String> displayDropdown = optionsRowPair.getValue();
	displayDropdown.setOnAction((event) -> {
		String selection = displayDropdown.getSelectionModel().getSelectedItem();
		Function<Long, String> function = valueDisplayOptions.get(selection);
		registerDisplayFunction.set(function);
	});
	
	VBox controlPanel = new VBox();
	controlPanel.getChildren().add(registerPanel);
	controlPanel.getChildren().add(displayOptions);
	controlPanel.setAlignment(Pos.CENTER);
	setAlignment(controlPanel, Pos.CENTER);
	controlPanel.setPadding(new Insets(CP_PADDING));
	controlPanel.setSpacing(CP_SPACING);
	
	return controlPanel;
}
 
Example 26
Project: voogasalad-ltub   File: SpawnerLevelEditorHolder.java   Source Code and License 5 votes vote down vote up
private void createSpawnerButton(){
		Button spawnerButton = new Button("Add Spawner to all levels");
//		spawnerButton.setOnAction(action -> getLevelData().stream().forEach(level -> {
//			level.addSpawner(myCreationSpawner.getSpawner());
//		}));
//		addNode(spawnerButton);

	}
 
Example 27
Project: main_carauto_board   File: ApplicationSettingsController.java   Source Code and License 5 votes vote down vote up
public static void initSettings(final ComboBox<StyleList> listStylesBox, final ComboBox<LanguageList> listLanguages,
                                TextField txtFieldPathToVideo, final Button btnApplySettings) {
    LOGGER.info("Application settings tab is initialising ...");
    populateComboBoxWithStyles(listStylesBox);
    populateComboBoxWithLanguages(listLanguages);

    // TODO: 11/29/2017 pop-up window or suggest to reload map (routes will be erased if reloaded)
    //it retrieves all settings from all fields and boxes and write them into EXTERNAL file only.
    btnApplySettings.setOnAction(action -> {

        final String styleValueFromComboBox = listStylesBox.getValue().toString(); // TODO: 12/29/2017 check NULL listStylesBox.getValue()
        final String languagesValueFromComboBox = listLanguages.getValue().toString(); // TODO: 12/29/2017 check NULL listLanguages.getValue()
        final String pathToVideoFolder = txtFieldPathToVideo.getText();

        if (styleValueFromComboBox != null) {
            PropertiesHelper.setProperty(PropertyList.STYLE, styleValueFromComboBox);
        }
        if (languagesValueFromComboBox != null) {
            PropertiesHelper.setProperty(PropertyList.LANGUAGE, languagesValueFromComboBox);
        }
        if (pathToVideoFolder != null) {
            PropertiesHelper.setProperty(PropertyList.VIDEO_FOLDER, pathToVideoFolder);
        }
    });

    LOGGER.info("Application settings tab initialised");
}
 
Example 28
Project: Goliath-Overclocking-Utility-FX   File: TitlePane.java   Source Code and License 5 votes vote down vote up
public TitlePane(String name, Stage appStage)
{
    super();
    super.getStyleClass().add("title-pane");
    super.setPadding(new Insets(0,0,0,0));
    super.setOnMousePressed(new AppMovementHandler());
    super.setOnMouseDragged(new AppDragHandler());
    
    stage = appStage;
    
    titleLabel = new Label(name);
    
    HBox buttonBox = new HBox();
    
    exit = new Button("Exit");
    exit.getStyleClass().add("close");
    //exit.setGraphic(new ImageView(new Image(new File("src/images/x.png").toURI().toString())));
    exit.setOnMouseClicked(new ExitHandler());
    
    minimize = new Button("Minimize");
    minimize.getStyleClass().add("minimize");
    //minimize.setGraphic(new ImageView(new Image(new File("src/images/minus.png").toURI().toString())));
    minimize.setOnMouseClicked(new MinimizeHandler());
    
    buttonBox.getChildren().addAll(minimize, exit);
    
    super.setLeft(titleLabel);
    super.setRight(buttonBox);
}
 
Example 29
Project: GameAuthoringEnvironment   File: BasicUIFactory.java   Source Code and License 5 votes vote down vote up
public Button createImageButton (Node imgview,
                                 EventHandler<ActionEvent> action) {
    Button newButton = new Button();
    newButton.setGraphic(imgview);
    newButton.setOnAction(action);
    return newButton;
}
 
Example 30
Project: EasyFXML   File: BaseEasyFxmlTest.java   Source Code and License 5 votes vote down vote up
@Test
public void load_with_stylesheet() {
    final Button testButton = this.assertSuccessAndGet(
        this.easyFxml.loadNode(TEST_NODES.BUTTON, Button.class)
    );

    this.assertAppliedStyle(testButton, TEST_NODES.BUTTON.getStylesheet().getStyle());
}
 
Example 31
Project: jmonkeybuilder   File: NodeSelectorDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Handle a selected object.
 */
@FXThread
private void processSelect(@Nullable final Object object) {
    final Object result = object instanceof TreeNode ? ((TreeNode) object).getElement() : object;
    final Class<T> type = getType();
    final Button okButton = getOkButton();
    okButton.setDisable(!type.isInstance(result));
    selected = type.isInstance(result) ? type.cast(result) : null;
}
 
Example 32
Project: jmonkeybuilder   File: ExternalFileEditorDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Handle selected element in the tree.
 */
@FXThread
private void processSelected(@Nullable final TreeItem<ResourceElement> newValue) {
    final ResourceElement element = newValue == null ? null : newValue.getValue();
    final Path file = element == null ? null : element.getFile();
    final Button okButton = notNull(getOkButton());
    okButton.setDisable(file == null || !Files.isWritable(file));
}
 
Example 33
Project: jmonkeybuilder   File: FilterList.java   Source Code and License 5 votes vote down vote up
/**
 * Create components of this component.
 */
private void createComponents() {

    listView = new ListView<>();
    listView.setCellFactory(param -> new FilterListCell(this));
    listView.setEditable(false);
    listView.setFocusTraversable(true);
    listView.prefHeightProperty().bind(heightProperty());
    listView.prefWidthProperty().bind(widthProperty());
    listView.setFixedCellSize(FXConstants.LIST_CELL_HEIGHT);

    final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel();
    selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) ->
            selectHandler.accept(newValue));

    final Button addButton = new Button();
    addButton.setGraphic(new ImageView(Icons.ADD_12));
    addButton.setOnAction(event -> addFilter());

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> removeFilter());
    removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull());

    final HBox buttonContainer = new HBox(addButton, removeButton);

    FXUtils.addToPane(listView, this);
    FXUtils.addToPane(buttonContainer, this);

    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(listView, CSSClasses.TRANSPARENT_LIST_VIEW);

    DynamicIconSupport.addSupport(addButton, removeButton);
}
 
Example 34
Project: marathonv5   File: AbstractSimpleAction.java   Source Code and License 5 votes vote down vote up
public Button getButtonWithText() {
    String cmd = commandName;
    if (cmd == null) {
        cmd = expand(name);
    }
    Button button = FXUIUtils.createButton(name, description, true, cmd);
    button.setOnAction(this);
    buttons.add(button);
    return button;
}
 
Example 35
Project: PSE   File: VMenuItemIcon.java   Source Code and License 5 votes vote down vote up
/**
 * VMenuItem constructor.
 * @param iconName iconName
 * @param myParent VMenuItem parent.
 * @param workspace Workspace.
 */
public VMenuItemIcon(String iconName,VMenuItem myParent,Workspace workspace){
    this.workspace = workspace;
    setMyParent(myParent);
    setIconName(iconName);
    setItemIcon(new ImageView( sample.Main.class.getResource(PATH + iconName + EXTENSION).toString() ) );
    setItemButton(new Button());
    setPaneIndicator(new Pane());
    createComponent();
}
 
Example 36
Project: Dronology   File: ButtonGenerator.java   Source Code and License 5 votes vote down vote up
/**
 * Load last flight plan
 * @param flightZoneView
 * @param btnText
 * @param stage
 * @return
 */
Button makeQuickFlightPickerButton(final FlightZoneView flightZoneView, String btnText, Stage stage){
    Button quickLoad = createButton(btnText, 120);
    quickLoad.setOnAction(
    new EventHandler<ActionEvent>() {
       @Override
       public void handle(final ActionEvent e) {
      	       flightZoneView.flightManager.loadFlightFromXML();
   	       }
    });
    return quickLoad;
}
 
Example 37
Project: gatepass   File: Office_Entry.java   Source Code and License 5 votes vote down vote up
private VBox getActionPane(){
progress= new Text("Office\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");

Image iconf= new Image(Office_Entry.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);

Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);

txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);		
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");

txtsearch= new TextField();
initFilter();

Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");

Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
	setAddAttendance();
});

btnView.setOnAction(e -> {
	timelineDown.play();
});
btnCloseView.setOnAction(e -> {
	timelineUp.play();
});


VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);

HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);

VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));

HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
 }
 
Example 38
Project: jmonkeybuilder   File: AppStateList.java   Source Code and License 5 votes vote down vote up
/**
 * Create components of this component.
 */
private void createComponents() {

    listView = new ListView<>();
    listView.setCellFactory(param -> new AppStateListCell(this));
    listView.setEditable(false);
    listView.setFocusTraversable(true);
    listView.prefHeightProperty().bind(heightProperty());
    listView.prefWidthProperty().bind(widthProperty());
    listView.setFixedCellSize(FXConstants.LIST_CELL_HEIGHT);

    final MultipleSelectionModel<EditableSceneAppState> selectionModel = listView.getSelectionModel();
    selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) ->
            selectHandler.accept(newValue));

    final Button addButton = new Button();
    addButton.setGraphic(new ImageView(Icons.ADD_12));
    addButton.setOnAction(event -> addAppState());

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> removeAppState());
    removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull());

    final HBox buttonContainer = new HBox(addButton, removeButton);

    FXUtils.addToPane(listView, this);
    FXUtils.addToPane(buttonContainer, this);

    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(listView, CSSClasses.TRANSPARENT_LIST_VIEW);

    DynamicIconSupport.addSupport(addButton, removeButton);
}
 
Example 39
Project: GameAuthoringEnvironment   File: MainUserInterface.java   Source Code and License 5 votes vote down vote up
private Node createLogin () {
    HBox box = new HBox(Integer.parseInt(mySpecs.getString(SPACING_KEY)));
    box.setAlignment(Pos.CENTER);
    Button fbButton =
            createButton(myLabels.getString("splashloginfb"), e -> loginWithFacebook());
    fbButton.setId(mySpecs.getString("fbbutton"));
    box.getChildren()
            .add(fbButton);
    return box;
}
 
Example 40
Project: jedai-ui   File: Step1Controller.java   Source Code and License 5 votes vote down vote up
/**
 * Show the advanced configuration window for the pressed button
 *
 * @param actionEvent Button action event
 */
public void configBtnHandler(ActionEvent actionEvent) {
    if (actionEvent.getSource() instanceof Button) {
        // Get button ID
        String id = ((Button) actionEvent.getSource()).getId();

        // Get the required parameters to give to configuration modal
        ListProperty<JPair<String, Object>> modelProperty = null;
        String readerType = null;
        boolean groundTruth = false;
        IDocumentation reader;

        switch (id) {
            case "entitiesD1ConfigBtn":
                readerType = model.getEntityProfilesD1Type();
                modelProperty = model.entityProfilesD1ParametersProperty();

                break;
            case "entitiesD2ConfigBtn":
                readerType = model.getEntityProfilesD2Type();
                modelProperty = model.entityProfilesD2ParametersProperty();

                break;
            case "gTruthConfigBtn":
                readerType = model.getGroundTruthType();
                modelProperty = model.groundTruthParametersProperty();
                groundTruth = true;

                break;
        }

        reader = MethodConfiguration.getDataReader(groundTruth, readerType);

        // Now that we have all required parameters, show the configuration window
        MethodConfiguration.displayModal(getClass(), injector, reader, modelProperty);
    }
}
 
Example 41
Project: voogasalad-ltub   File: GridPaneManager.java   Source Code and License 5 votes vote down vote up
private Node getAllSpritesButton() {
			GridPane buttonPane = new GridPane();
			for(int i = 0; i < NUMER_OF_COLUMN_SPRITE; i ++){
				for(int j = 0; j < NUMER_OF_COLUMN_SPRITE; j++){
					Button button = new Button();
					spriteButtonMap.put(new Pair<Integer, Integer>(i, j ), button);
				}
			}
			return buttonPane;
}
 
Example 42
Project: ExtremeGuiMakeover   File: FeaturesPane.java   Source Code and License 5 votes vote down vote up
public FeaturesPane() {
    super();

    getStylesheets().add(FeaturesPane.class.getResource("/options-pane.css").toExternalForm());

    getStyleClass().add("options-pane");

    Button all = new Button("All");
    all.setOnAction(evt -> features.forEach(f -> f.setActive(true)));
    all.setMaxWidth(Double.MAX_VALUE);
    all.setId("all-button");
    Util.installWindowDragListener(all);

    Button reset = new Button("Reset");
    reset.setOnAction(evt -> features.forEach(f -> f.setActive(false)));
    reset.setMaxWidth(Double.MAX_VALUE);
    reset.setId("reset-button");
    Util.installWindowDragListener(reset);

    HBox top = new HBox(all, reset);
    top.getStyleClass().add("toolbar");
    top.setFillHeight(true);
    HBox.setHgrow(all, Priority.ALWAYS);
    HBox.setHgrow(reset, Priority.ALWAYS);

    getChildren().add(top);
}
 
Example 43
Project: marathonv5   File: HTMLView.java   Source Code and License 5 votes vote down vote up
public HTMLView() {
    viewport = ToolBarContainer.createDefaultContainer(Orientation.RIGHT);
    webView = new WebView();
    viewport.setContent(webView);
    VLToolBar bar = new VLToolBar();
    Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true);
    Button prevPage = FXUIUtils.createButton("prev", "Previous Page", false);
    WebHistory history = webView.getEngine().getHistory();
    prevPage.setOnAction((event) -> {
        history.go(-1);
    });
    bar.add(prevPage);
    Button nextPage = FXUIUtils.createButton("next", "Next Page", false);
    nextPage.setOnAction((event) -> {
        history.go(1);
    });
    bar.add(nextPage);
    openInBrowser.setOnAction((event) -> {
        try {
            URI uri = ProjectHTTPDServer.getURI(fileHandler.getCurrentFile().toPath());
            if (uri != null)
                Desktop.getDesktop().browse(uri);
            else
                Desktop.getDesktop().open(fileHandler.getCurrentFile());
        } catch (IOException e) {
            e.printStackTrace();
        }
    });
    bar.add(openInBrowser);
    history.currentIndexProperty().addListener((ob, o, n) -> {
        nextPage.setDisable(n.intValue() == history.getEntries().size() - 1);
        prevPage.setDisable(n.intValue() == 0);
    });
    viewport.getToolBarPanel().add(bar);
}
 
Example 44
Project: main_carauto_board   File: WebCamPreviewController.java   Source Code and License 5 votes vote down vote up
public WebCamPreviewController(final Button btnStartCamera, final Button btnStopCamera, final Button btnDisposeCamera,
                               final ComboBox<WebCamInfo> cbCameraOptions, final Pane bpWebCamPaneHolder,
                               final FlowPane fpBottomPane, final ImageView imgWebCamCapturedImage) {
    this.btnStartCamera = btnStartCamera;
    this.btnStopCamera = btnStopCamera;
    this.btnDisposeCamera = btnDisposeCamera;
    this.cbCameraOptions = cbCameraOptions;
    this.bpWebCamPaneHolder = bpWebCamPaneHolder;
    this.fpBottomPane = fpBottomPane;
    this.imgWebCamCapturedImage = imgWebCamCapturedImage;
}
 
Example 45
Project: jmonkeybuilder   File: RenameDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Validate a new name.
 */
@FXThread
private void validateName(@NotNull final String name) {
    final Function<String, Boolean> validator = getValidator();
    final Button okButton = getOkButton();
    okButton.setDisable(!(validator == null || validator.apply(name)));
}
 
Example 46
Project: GameAuthoringEnvironment   File: SceneTabViewer.java   Source Code and License 5 votes vote down vote up
/**
 * Create Add level button tab. This makes the UI design clean and by disabling the tab and only
 * enabling the button, there won't be any awkward UI errors.
 *
 * @return
 */
private Tab createButtonTab () {
    Tab createLevelTab = new Tab();
    Button addNewLevelButton = new Button("+");
    addNewLevelButton.setOnAction(e -> addNewNamedLevel());
    createLevelTab.setGraphic(addNewLevelButton);
    createLevelTab.setDisable(true);
    createLevelTab.setClosable(false);
    return createLevelTab;
}
 
Example 47
Project: marathonv5   File: StageSample.java   Source Code and License 5 votes vote down vote up
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}
 
Example 48
Project: GameAuthoringEnvironment   File: BasicUIFactory.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a button with the given CSS style class
 *
 * @param text
 * @param action
 * @return
 */

@Override
public Button createStyledButton (String text,
                                  EventHandler<ActionEvent> action,
                                  String styleClass) {
    Button newButton = createStyledButton(text, styleClass);
    newButton.setOnAction(action);
    return newButton;
}
 
Example 49
Project: NoMoreOversleeps   File: JavaFxHelper.java   Source Code and License 5 votes vote down vote up
public static Button createButton()
{
	final Button button = new Button();
	button.setOnKeyPressed(new EventHandler<KeyEvent>()
	{
		@Override
		public void handle(KeyEvent evt)
		{
			if (evt.getCode() == KeyCode.ENTER)
				button.fire();
		}
	});
	return button;
}
 
Example 50
Project: strongbox   File: GetGroupIdentifier.java   Source Code and License 5 votes vote down vote up
public Optional<SecretsGroupIdentifier> getGroupIdentifier() {
    Stage dialog = new Stage();
    dialog.initModality(Modality.WINDOW_MODAL);
    dialog.initOwner(parent);
    dialog.initStyle(StageStyle.UTILITY);

    VBox layout = new VBox();
    Label label = new Label("Create Secrets Group");

    Text nameLabel = new Text("Name:");
    TextField name = new TextField();
    HBox n = new HBox();
    n.getChildren().addAll(nameLabel, name);

    ObservableList<Region> regions =
            FXCollections.observableArrayList(Region.values());

    Text regionLabel = new Text("Region:");
    ComboBox<Region> region = new ComboBox<>(regions);
    region.setValue(defaultRegion);


    HBox r = new HBox();
    r.getChildren().addAll(regionLabel, region);

    HBox actions = new HBox();
    Button create = new Button("Create");
    Button cancel = new Button("Cancel");
    actions.getChildren().addAll(create, cancel);

    create.setOnAction(f -> {
        if (name.getText() != null) {
            secretsGroupIdentifier = Optional.of(new SecretsGroupIdentifier(region.getValue(), name.getText()));
        }
        dialog.close();
    });

    cancel.setOnAction(f -> {
        dialog.close();
    });

    layout.getChildren().addAll(label, n, r, actions);

    Scene scene2 = new Scene(layout, 370, 250);
    dialog.setScene(scene2);

    dialog.showAndWait();


    return secretsGroupIdentifier;
}
 
Example 51
Project: marathonv5   File: TilePaneSample.java   Source Code and License 5 votes vote down vote up
public TilePaneSample() {

     TilePane tilePane = new TilePane();
     tilePane.setPrefColumns(3); //preferred columns

     Button[] buttons = new Button[18];
     for (int j = 0; j < buttons.length; j++) {
         buttons[j] = new Button("button" + (j + 1), new ImageView(ICON_48));
         tilePane.getChildren().add(buttons[j]);
     }
     getChildren().add(tilePane);
 }
 
Example 52
Project: marathonv5   File: FileSelectionStage.java   Source Code and License 5 votes vote down vote up
private ButtonBarX createButtonBar() {
    ButtonBarX buttonBar = new ButtonBarX();
    buttonBar.setId("FileSelectionButtonBar");
    okButton = FXUIUtils.createButton("ok", "OK", true, "OK");
    okButton.setDisable(true);
    okButton.setOnAction((e) -> {
        onOK();
    });
    Button cancelButton = FXUIUtils.createButton("cancel", "Cancel", true, "Cancel");
    cancelButton.setOnAction((e) -> {
        onCancel();
    });
    buttonBar.getButtons().addAll(okButton, cancelButton);
    return buttonBar;
}
 
Example 53
Project: AchillesFx   File: SimpleBaseActivity.java   Source Code and License 5 votes vote down vote up
private void initViews() {
        Button button1 = (Button) findViewById("button1");
//        text1 = (TextField) findViewById("text1");
        button1.setOnAction(event -> text1.setText("clicked!"));
        this.intentTestButton.setOnAction(event -> {
            SecondActivity secondActivity = new SecondActivity(getContext());
            ActivityIntent intent = new ActivityIntent(getContext(), this, secondActivity);
            intent.start();
        });
    }
 
Example 54
Project: marathonv5   File: MPFConfigurationStage.java   Source Code and License 5 votes vote down vote up
private ButtonBarX createButtonBar() {
    ButtonBarX buttonBar = new ButtonBarX();
    buttonBar.setId("ConfigurationButtonBar");
    saveButton = FXUIUtils.createButton("save", "Save", true, "Save");
    saveButton.setOnAction((e) -> {
        onSave();
    });
    Button cancelButton = FXUIUtils.createButton("cancel", "Cancel", true, "Cancel");
    cancelButton.setOnAction((e) -> dispose());
    testButton = FXUIUtils.createButton("test", "Test Settings...", true, "Test");
    testButton.setOnAction((e) -> onTest());
    buttonBar.getButtons().addAll(saveButton, cancelButton, testButton);
    return buttonBar;
}
 
Example 55
Project: LIRE-Lab   File: ToolBarController.java   Source Code and License 5 votes vote down vote up
private void initLeftToolBar() {
    leftToolBar.getChildren().clear();
    List<Command<Void>> leftToolBarCommands = applicationCommands.getLeftToolBarCommands();
    for (Command<Void> command : leftToolBarCommands) {
        Button button = commandTriggerFactory.createButton(command, () -> null);
        button.setId("toolbar-" + command.getNodeId());
        leftToolBar.getChildren().add(button);
    }

}
 
Example 56
Project: jmonkeybuilder   File: BaseAssetEditorDialog.java   Source Code and License 5 votes vote down vote up
@Override
@FXThread
protected void createActions(@NotNull final VBox root) {
    super.createActions(root);

    final Button okButton = notNull(getOkButton());
    okButton.disableProperty().bind(buildDisableCondition());
}
 
Example 57
Project: gatepass   File: Office_Entry.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void configureBox(HBox root) {
	  StackPane container = new StackPane();
	  //container.setPrefHeight(700);
	  container.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
	  container.setStyle("-fx-border-width:1px;-fx-border-style:solid;-fx-border-color:#999999;");

	 table= new TableView<OfficeClass>();
	  Label lview= new Label();
	  lview.setText("View Records");
	  lview.setId("lview");
	  bottomPane= new VBox();
	  
	  tclock= new Text(); 
	  tclock.setId("lview");
		//tclock.setFont(Font.font("Calibri", 20));
		final Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {  
		     @Override  
		     public void handle(ActionEvent event) {  
		          tclock.setText(DateFormat.getDateTimeInstance().format(new Date()));
		     }  
		}));  
		timeline.setCycleCount(Animation.INDEFINITE);  
		timeline.play();
	  
	  bottomPane.getChildren().addAll(tclock, lview);
	  bottomPane.setAlignment(Pos.CENTER);
	  
	  nocol= new TableColumn<>("no");
	  nocol.setMinWidth(130);
	  nocol.setCellValueFactory(new PropertyValueFactory<>("no"));
		
	  
	  namecol= new TableColumn<>("First Name");
		namecol.setMinWidth(170);
		namecol.setCellValueFactory(new PropertyValueFactory<>("name"));
		
		admcol= new TableColumn<>("Admission Number");
		admcol.setMinWidth(180);
		admcol.setCellValueFactory(new PropertyValueFactory<>("adm"));
		
		
		timecol= new TableColumn<>("Signin");
		timecol.setMinWidth(140);
		timecol.setCellValueFactory(new PropertyValueFactory<>("timein"));
		
		datecol= new TableColumn<>("Date");
		datecol.setMinWidth(180);
		datecol.setCellValueFactory(new PropertyValueFactory<>("date"));
		
		table.getColumns().addAll(nocol,namecol, admcol, timecol, datecol);
		table.setItems(getAtt());
		att= getAtt();
        table.setItems(FXCollections.observableArrayList(att));
        table.setMinHeight(500);
       
        btnrefresh = new Button("Refresh");
        btnrefresh.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent t) {
            	table.setItems(getAtt());
            }
        });
        laytable= new VBox(10);
        laytable.getChildren().addAll(table, btnrefresh);
        laytable.setAlignment(Pos.TOP_LEFT);
        
        container.getChildren().addAll(bottomPane,laytable);
		setAnimation();
		sc.setContent(container);
		root.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672)");
		root.getChildren().addAll(getActionPane(),sc);
		
		//service.start();
	 }
 
Example 58
Project: octoBubbles   File: VoiceController.java   Source Code and License 4 votes vote down vote up
private void voice(){ //change to the tool that are recognised from the voice-input
    Button previousButton = diagramController.buttonInUse;
    AbstractDiagramController.ToolEnum previousTool = diagramController.getTool();

    String buttonMode = "";
    while(buttonMode.equals("") || buttonMode == null) {
        buttonMode = voiceCommands();
    }

    if (buttonMode.equals("create class")) {
        diagramController.setTool(AbstractDiagramController.ToolEnum.CREATE_CLASS);
        diagramController.setButtonClicked(diagramController.createBtn);
    }
    else if (buttonMode.equals("create package")) {
        diagramController.setTool(AbstractDiagramController.ToolEnum.CREATE_PACKAGE);
        diagramController.setButtonClicked(diagramController.packageBtn);
    }
    else if (buttonMode.equals("create edge")) {
        diagramController.setTool(AbstractDiagramController.ToolEnum.EDGE);
        diagramController.setButtonClicked(diagramController.edgeBtn);
    }
    else if (buttonMode.equals("choose select")) {
        diagramController.setTool(AbstractDiagramController.ToolEnum.SELECT);
        diagramController.setButtonClicked(diagramController.selectBtn);
    }
    else if (buttonMode.equals("choose draw")) {
        diagramController.setTool(AbstractDiagramController.ToolEnum.DRAW);
        diagramController.setButtonClicked(diagramController.drawBtn);
    }
    else if (buttonMode.equals("choose move")) {
        diagramController.setTool(AbstractDiagramController.ToolEnum.MOVE_SCENE);
        diagramController.setButtonClicked(diagramController.moveBtn);
    }
    else if (buttonMode.equals("undo")) {
        diagramController.getUndoManager().undoCommand();
        diagramController.setTool(previousTool);
        diagramController.setButtonClicked(previousButton);
    }
    else if (buttonMode.equals("redo")) {
        diagramController.getUndoManager().redoCommand();
        diagramController.setTool(previousTool);
        diagramController.setButtonClicked(previousButton);
    }
    // Running this function until the program is closed
    if(voiceEnabled){
        voice();
    }
}
 
Example 59
Project: LCL   File: Container.java   Source Code and License 4 votes vote down vote up
static Container create(String fxmlName) throws IOException {
    Button button = new Button(fxmlName);
    button.setPrefSize(200, 50);
    return create(fxmlName, button);
}
 
Example 60
Project: fwm   File: EventTabController.java   Source Code and License 4 votes vote down vote up
public Button getPlayButton(){
	return playButton;
}