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: voogasalad-ltub   File: GameChooser.java   View source code 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 2
Project: voogasalad-ltub   File: SingleStat.java   View source code 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 3
Project: jmonkeybuilder   File: ResourcePropertyEditorControl.java   View source code 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 4
Project: voogasalad-ltub   File: MessagingView.java   View source code 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 5
Project: Dronology   File: ButtonGenerator.java   View source code 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 6
Project: voogasalad-ltub   File: MasterDeveloperInterface.java   View source code 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 7
Project: Calculadora-JavaFx   File: Controller.java   View source code 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 8
Project: Goliath-Overclocking-Utility-FX   File: NotifyTab.java   View source code 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 9
Project: can4eve   File: JavaFXDisplay.java   View source code 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 10
Project: Notebook   File: SettingFragment.java   View source code 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 11
Project: Mafia-TCoS-CS319-Group2A   File: CreditsController.java   View source code 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 12
Project: marathonv5   File: ColorButtonSample.java   View source code 6 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 13
Project: GazePlay   File: GameContext.java   View source code 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 14
Project: marathonv5   File: FileSelectionStage.java   View source code 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 15
Project: marathonv5   File: RFXButtonBaseTest.java   View source code 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 16
Project: voogasalad-ltub   File: GameManager.java   View source code 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 17
Project: vars-annotation   File: FilterableTreeItemDemo.java   View source code 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 18
Project: Lernkartei_2017   File: RenameView.java   View source code 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 19
Project: jmonkeybuilder   File: SettingsDialog.java   View source code 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 20
Project: NoMoreOversleeps   File: JavaFxHelper.java   View source code 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 21
Project: LIRE-Lab   File: CommandTriggerFactory.java   View source code 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 22
Project: FX-Test   File: BaseTestFXComponentTest.java   View source code 5 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 23
Project: NoMoreOversleeps   File: MainDialog.java   View source code 5 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 24
Project: Socket_Chat   File: ClientGUI.java   View source code 5 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 25
Project: WebPLP   File: WatcherWindow.java   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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);
    }
}