Java Code Examples for javafx.scene.control.TextField.setPromptText()

The following are Jave code examples for showing how to use setPromptText() of the javafx.scene.control.TextField class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: marathonv5   File: SearchBoxSample.java   Source Code and License Vote up 10 votes
public SearchBox() {
    setId("SearchBox");
    getStyleClass().add("search-box");
    setMinHeight(24);
    setPrefSize(200, 24);
    setMaxSize(Control.USE_PREF_SIZE, Control.USE_PREF_SIZE);
    textBox = new TextField();
    textBox.setPromptText("Search");
    clearButton = new Button();
    clearButton.setVisible(false);
    getChildren().addAll(textBox, clearButton);
    clearButton.setOnAction(new EventHandler<ActionEvent>() {                
        @Override public void handle(ActionEvent actionEvent) {
            textBox.setText("");
            textBox.requestFocus();
        }
    });
    textBox.textProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            clearButton.setVisible(textBox.getText().length() != 0);
        }
    });
}
 
Example 2
Project: marathonv5   File: StringBindingSample.java   Source Code and License Vote up 6 votes
public StringBindingSample() {
    final SimpleDateFormat format = new SimpleDateFormat("mm/dd/yyyy");
    final TextField dateField = new TextField();
    dateField.setPromptText("Enter a birth date");
    dateField.setMaxHeight(TextField.USE_PREF_SIZE);
    dateField.setMaxWidth(TextField.USE_PREF_SIZE);

    Label label = new Label();
    label.textProperty().bind(new StringBinding() {
        {
            bind(dateField.textProperty());
        }            
        @Override protected String computeValue() {
            try {
                Date date = format.parse(dateField.getText());
                Calendar c = Calendar.getInstance();
                c.setTime(date);

                Date today = new Date();
                Calendar c2 = Calendar.getInstance();
                c2.setTime(today);

                if (c.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR) - 1
                        && c.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
                    return "You were born yesterday";
                } else {
                    return "You were born " + format.format(date);
                }
            } catch (Exception e) {
                return "Please enter a valid birth date (mm/dd/yyyy)";
            }
        }
    });

    VBox vBox = new VBox(7);
    vBox.setPadding(new Insets(12));
    vBox.getChildren().addAll(label, dateField);
    getChildren().add(vBox);
}
 
Example 3
Project: Lernkartei_2017   File: RenameView.java   Source Code and License Vote up 5 votes
@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 4
Project: Lernkartei_2017   File: UserListView.java   Source Code and License Vote up 5 votes
@Override
public Parent constructContainer()
{
	
	bp.setId("loginviewbg");
	
	list = new ListView<String>();
	items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
	list.setItems(items);		
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	SearchUser = new HBox();
	Bottom = new HBox();
	
	txtUserName = new TextField();
	txtUserName.setMinHeight(50);
	txtUserName.setMinWidth(700);
	txtUserName.setPromptText("Email-Adresse des Benutzers");
	
	btnSearch = new AppButton("Suchen");
	btnAdd = new AppButton("Hinzuf�gen");
	back = new BackButton(getFXController(),"Zur�ck");
	
	SearchUser.getChildren().addAll(txtUserName,btnSearch);
	Bottom.getChildren().addAll(back,btnAdd);
	AllFields.getChildren().addAll(SearchUser,list,Bottom);
	
	bp.setLeft(AllFields);
	
	//btnSearch.setOnAction(e -> getFXController().showView("userlist"));
	
	
	return bp;
}
 
Example 5
Project: GameAuthoringEnvironment   File: BasicUIFactory.java   Source Code and License Vote up 5 votes
@Override
public TextField createTextField (String holder, double width) {
    TextField field = this.createTextField(width);
    field.setPromptText(holder);
    return field;

}
 
Example 6
Project: marathonv5   File: StringBindingSample.java   Source Code and License Vote up 5 votes
public StringBindingSample() {
    final SimpleDateFormat format = new SimpleDateFormat("mm/dd/yyyy");
    final TextField dateField = new TextField();
    dateField.setPromptText("Enter a birth date");
    dateField.setMaxHeight(TextField.USE_PREF_SIZE);
    dateField.setMaxWidth(TextField.USE_PREF_SIZE);

    Label label = new Label();
    label.textProperty().bind(new StringBinding() {
        {
            bind(dateField.textProperty());
        }            
        @Override protected String computeValue() {
            try {
                Date date = format.parse(dateField.getText());
                Calendar c = Calendar.getInstance();
                c.setTime(date);

                Date today = new Date();
                Calendar c2 = Calendar.getInstance();
                c2.setTime(today);

                if (c.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR) - 1
                        && c.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
                    return "You were born yesterday";
                } else {
                    return "You were born " + format.format(date);
                }
            } catch (Exception e) {
                return "Please enter a valid birth date (mm/dd/yyyy)";
            }
        }
    });

    VBox vBox = new VBox(7);
    vBox.setPadding(new Insets(12));
    vBox.getChildren().addAll(label, dateField);
    getChildren().add(vBox);
}
 
Example 7
Project: marathonv5   File: TextValidatorSample.java   Source Code and License Vote up 5 votes
public TextValidatorSample() {
    String validatorCss = TextValidatorSample.class.getResource("Validators.css").toExternalForm();
    
    TextField dateField = new TextField();
    dateField.setPromptText("Enter a Large Number");
    dateField.setMaxHeight(TextField.USE_PREF_SIZE);

    TextInputValidatorPane<TextField> pane = new TextInputValidatorPane<TextField>();
    pane.setContent(dateField);
    pane.setValidator(new Validator<TextField>() {
        public ValidationResult validate(TextField control) {
            try {
                String text = control.getText();
                if (text == null || text.trim().equals("")) return null;
                double d = Double.parseDouble(text);
                if (d < 1000) {
                    return new ValidationResult("Should be > 1000", ValidationResult.Type.WARNING);
                }
                return null; // succeeded
            } catch (Exception e) {
                // failed
                return new ValidationResult("Bad number", ValidationResult.Type.ERROR);
            }
        }
    });

    StackPane rootSP = new StackPane();
    rootSP.setPadding(new Insets(12));
    rootSP.getChildren().add(pane);
    pane.getStylesheets().add(validatorCss);
    getChildren().add(rootSP);
}
 
Example 8
Project: Lernkartei_2017   File: DMOModifyDoorView.java   Source Code and License Vote up 4 votes
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	AllFields = new HBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	AllFields.setPadding(new Insets(200,0,0,0));
	//AllFields.setMinWidth(740);
	
	Value = new VBox();
	Value.setMinWidth(400);
	Value.setSpacing(35);
	Buttons = new VBox();
	Buttons.setSpacing(5);
	Name = new HBox();
	
	inputName = new TextField();
	inputName.setPromptText("Names der Door");
	inputName.setAlignment(Pos.CENTER_LEFT);
	inputName.setMinWidth(50);
	
	name = new Label("Name");
	removeDoor = new Label("Door l�schen");
	removeStacks = new Label("Enfert den/die Stack/s der Door");
	titel = new Label("Bearbeiten");

	btnRemoveDoor = new AppButton("Entfernen");
	btnRemoveStack = new AppButton("L�schen");
	btnModify = new AppButton("�ndern");
	back = new BackButton(getFXController(),"Abbrechen");
	
	//Buttons.getChildren().addAll(,,btnRemoveStack,back);
	Name.getChildren().addAll(name,inputName);
	Value.getChildren().addAll(Name,removeDoor,removeStacks);
	Buttons.getChildren().addAll(btnModify,btnRemoveStack,btnRemoveDoor,back);
	AllFields.getChildren().addAll(Value,Buttons);
	
	/*inside.setLeft(AllFields);
	inside.setRight(Buttons);*/
	
	bp.setCenter(AllFields);
	
	/*
	btnCreate.setOnAction(e -> getFXController().showView("serverdoorview"));
	--Listenter to crete a door
	*/
	
	
	return bp;
}
 
Example 9
Project: gatepass   File: Users.java   Source Code and License Vote up 4 votes
@SuppressWarnings("unchecked")
public void showUsers()
{
	primaryStage = new Stage();
	primaryStage.setTitle("e-Tracker Users");
	primaryStage.setResizable(false);
	primaryStage.initModality(Modality.APPLICATION_MODAL);
	primaryStage.getIcons().add(new Image("/pic/slogo.png"));
	//name
	namecol = new TableColumn<>("Username");
	namecol.setMinWidth(250);
	namecol.setCellValueFactory(new PropertyValueFactory<>("name"));//has to be the same as in the UserCreation class
			
	//level
	levelcol = new TableColumn<>("User Level");
	levelcol.setMinWidth(250);
	levelcol.setCellValueFactory(new PropertyValueFactory<>("level"));
	
	table= new TableView<>();
	table.setItems(getProduct());
	table.getColumns().addAll(namecol, levelcol);
	table.getSelectionModel().selectedItemProperty().addListener(
               (observable, oldValue, newValue) -> showPersonDetails(newValue));
	
	txtname= new TextField();
	txtname.setEditable(false);
	txtname.setPromptText("Username");
	
	txtlevel= new TextField();
	txtlevel.setEditable(false);
	txtlevel.setPromptText("User Level e.g. Admin");
	
	badd= new Button("Add...");
	badd.setOnAction(e ->{
		addClicked();
	});
	bdel= new Button("Delete");
	bdel.setOnAction(e ->{
		deleteClicked();
	});
	
	bedit= new Button("Edit...");
	bedit.setOnAction( e ->{
		setPressbEdit();
	});

	HBox layout2= new HBox();
	layout2.setSpacing(10); //similar to that 10
	//layout2.setPadding(new Insets(20,20,20,20));
	layout2.getChildren().addAll(txtname, txtlevel, bedit, badd, bdel);
	layout2.setAlignment(Pos.CENTER_RIGHT);
	
	VBox layout = new VBox(12);
	layout.getChildren().addAll(table, layout2);
	layout.setPadding(new Insets(20,20,20,20));
	layout.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
	Scene scene= new Scene(layout);
	scene.getStylesheets().add(Users.class.getResource("users.css").toExternalForm());
	primaryStage.setScene(scene);
	
	if(MainWindow.ladmins.getText().equals("User") || MainWindow.ladmins.getText().equals("Office Admin") || 
	   MainWindow.ladmins.getText().equals("Gate Admin"))
	{
		badd.setDisable(true);
		bdel.setDisable(true);
		bedit.setDisable(true);
	}
}
 
Example 10
Project: Lernkartei_2017   File: SaveDownloadstackOwnDMODoorSelectionView.java   Source Code and License Vote up 4 votes
@Override
public Parent constructContainer()
{
	bp = new BorderPane();
	bp.setId("userviewbg");
	
	back = new BackButton(getFXController(),"Zur�ck");
	
	tabPane = new TabPane();
	tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
	tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
		   @Override
		   public void changed(ObservableValue<? extends Tab> ov, Tab tabOld, Tab tabNew) {
		      refreshView();
		   }
		});
	 
    	    
    Center = new VBox();
    Search = new HBox();
    Top = new VBox();
    
    
    txtSearch = new TextField();
    txtSearch.setPromptText("Suche nach Doors");
    txtSearch.setMinWidth(740);
    txtSearch.setMinHeight(50);;
    btnSearch = new AppButton("Suchen");
    btnCreate = new AppButton("++Erstellen++");
    btnCreate.setMinWidth(590);
    btnCreate.setOnAction(e -> getFXController().showView("createdoorview"));
    
    StackShowList.setSpacing(20);
    Center.setSpacing(20);
    
    
    sMain = new ScrollPane();
    sMain.setContent(Center);
    
    Search.getChildren().addAll(txtSearch,btnSearch);
    Center.getChildren().addAll(StackShowList,btnCreate);
    
	back = new AppButton("Zur�ck");
	back.setOnAction(e-> getFXController().showView("saveuploadstackonserverdialogview"));
	
	
	Bottom = new VBox();

	Bottom.getChildren().addAll(back);
	Top.getChildren().addAll(Search,tabPane); 
	
	bp.setTop(Top);
	bp.setCenter(sMain);
	bp.setBottom(Bottom);
	
	getFXController().getModel("serverstack").registerView(this);
	
	return bp;
}
 
Example 11
Project: ClusterDeviceControlPlatform   File: ViewUtil.java   Source Code and License Vote up 4 votes
public static Optional<TcpMsgResponseRandomDeviceStatus> randomDeviceStatus() throws NumberFormatException {
    Dialog<TcpMsgResponseRandomDeviceStatus> dialog = new Dialog<>();
    dialog.setTitle("随机状态信息");
    dialog.setHeaderText("随机设备的状态信息");

    ButtonType loginButtonType = new ButtonType("发送", ButtonBar.ButtonData.OK_DONE);
    dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);

    // Create the username and password labels and fields.
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 150, 10, 10));

    TextField textFieldGroupId = new TextField();
    textFieldGroupId.setPromptText("1 - 120");

    TextField textFieldLength = new TextField();
    textFieldLength.setPromptText("1 - 60_0000");

    TextField textFieldStatus = new TextField();
    textFieldStatus.setPromptText("1 - 6");


    grid.add(new Label("组号: "), 0, 0);
    grid.add(textFieldGroupId, 1, 0);
    grid.add(new Label("范围: "), 0, 1);
    grid.add(textFieldLength, 1, 1);
    grid.addRow(2, new Label("状态码: "));
    //      grid.add(, 0, 2);
    grid.add(textFieldStatus, 1, 2);

    // Enable/Disable login button depending on whether a username was entered.
    Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
    loginButton.setDisable(true);

    // Do some validation (using the Java 8 lambda syntax).
    textFieldGroupId.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldLength, textFieldStatus)));
    textFieldLength.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldLength, textFieldStatus)));
    textFieldStatus.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldLength, textFieldStatus)));

    dialog.getDialogPane().setContent(grid);

    // Request focus on the username field by default.
    Platform.runLater(textFieldGroupId::requestFocus);

    dialog.setResultConverter(dialogButton -> {

        if (dialogButton == loginButtonType) {
            try {
                TcpMsgResponseRandomDeviceStatus tcpMsgResponseDeviceStatus = new TcpMsgResponseRandomDeviceStatus(Integer.parseInt(
                        textFieldGroupId.getText().trim()),
                        Integer.parseInt(textFieldStatus.getText().trim()),
                        Integer.parseInt(textFieldLength.getText().trim()));
                return tcpMsgResponseDeviceStatus;
            } catch (NumberFormatException e) {
                System.out.println("空");
                return new TcpMsgResponseRandomDeviceStatus(-1, -1, -1);
            }
        }
        return null;
    });
    return dialog.showAndWait();
}
 
Example 12
Project: Lernkartei_2017   File: LoginView.java   Source Code and License Vote up 4 votes
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");

	Errorbox = new HBox(50);
	Errorbox.setAlignment(Pos.CENTER);
	Errorbox.setPadding(new Insets(20));

	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));

	Controls = new HBox(50);
	Controls.setAlignment(Pos.CENTER);
	Controls.setPadding(new Insets(20));

	txtName = new TextField();
	txtName.setPromptText("Username");

	pwPassword = new PasswordField();
	pwPassword.setPromptText("Passwort");
	;

	home = new HomeButton(getFXController());
	reg = new AppButton("Noch kein Profil?");
	log = new AppButton("Login");

	errorText = new Label("");
	Errorbox.getChildren().addAll(errorText);

	Controls.getChildren().addAll(home, reg);

	AllFields.getChildren().addAll(txtName, pwPassword, log);

	bp.setTop(Errorbox);
	bp.setCenter(AllFields);
	bp.setBottom(Controls);

	reg.setOnAction(e -> getFXController().showView("registerview"));
	log.setOnAction(e ->
	{

		// So that you can always check again who was logged in last,
		// but if user logged in, it should be set as ""
		Globals.lastRegisteredUser = "";

		String name = txtName.getText();
		String password = pwPassword.getText();

		// So that entries don't exist after leaving the view
		txtName.clear();
		pwPassword.clear();

		if (name.equals("[email protected]") && BCrypt.checkpw(password, "$2a$12$8hcwdnkJ7uO3FvDEG/1fv.vaSNI/FfZqEzfUZFUYRUHLzRjkV/Z5.")/*plaintext-password: "gibb"*/)
		{
			Globals.username = name;
			getFXController().showView("managementselectionview");
		} else
		{
			Alert alert = new Alert(AlertType.ERROR);
			alert.setTitle("Fehler 0x0001");
			alert.setHeaderText("Login-Daten inkorrekt.");
			alert.setContentText(
					"Benutzername und Passwort stimmen nicht �berein oder existieren nicht.\nStellen Sie sicher, dass Ihre Eingaben korrekt sind.");
			pwPassword.clear();
			txtName.clear();
			alert.showAndWait();
		}
	});

	return bp;
}
 
Example 13
Project: qiniu   File: Dialogs.java   Source Code and License Vote up 4 votes
public void showBucketAddableDialog() {
	ButtonType ok = new ButtonType(Values.OK, ButtonData.OK_DONE);
	Dialog<String[]> dialog = getDialog(ok);

	TextField bucket = new TextField();
	bucket.setPromptText(Values.BUCKET_NAME);
	TextField url = new TextField();
	url.setPromptText(Values.BUCKET_URL);
	// TextField zone = new TextField();
	ComboBox<String> zone = new ComboBox<String>();
	zone.getItems().addAll(Values.BUCKET_NAME_ARRAY);
	zone.setValue(Values.BUCKET_NAME_ARRAY[0]);

	GridPane grid = getGridPane();
	grid.add(new Label(Values.BUCKET_NAME), 0, 0);
	grid.add(bucket, 1, 0);
	grid.add(new Label(Values.BUCKET_URL), 0, 1);
	grid.add(url, 1, 1);
	grid.add(new Label(Values.BUCKET_ZONE_NAME), 0, 2);
	grid.add(zone, 1, 2);

	Node okButton = dialog.getDialogPane().lookupButton(ok);
	okButton.setDisable(true);

	// 监听文本框的输入状态
	bucket.textProperty().addListener((observable, oldValue, newValue) -> {
		okButton.setDisable(newValue.trim().isEmpty() || url.getText().isEmpty());
	});
	url.textProperty().addListener((observable, oldValue, newValue) -> {
		okButton.setDisable(newValue.trim().isEmpty() || bucket.getText().isEmpty());
	});

	dialog.getDialogPane().setContent(grid);

	Platform.runLater(() -> bucket.requestFocus());

	dialog.setResultConverter(dialogButton -> {
		if (dialogButton == ok) {
			return new String[] { bucket.getText(),
					zone.getValue() + " " + (Checker.isHyperLink(url.getText()) ? url.getText() : "example.com") };
		}
		return null;
	});

	Optional<String[]> result = dialog.showAndWait();
	result.ifPresent(res -> {
		logger.info("bucket name: " + res[0] + ", zone name: " + res[1]);
		Platform.runLater(() -> MainWindowController.getInstance().addItem(res[0]));
		QiniuApplication.buckets.put(res[0], res[1]);
		ConfigLoader.writeConfig();
	});
}
 
Example 14
Project: NoMoreOversleeps   File: JavaFxHelper.java   Source Code and License Vote up 4 votes
public static TextField createTextField(String promptText)
{
	TextField field = new TextField();
	field.setPromptText(promptText);
	return field;
}
 
Example 15
Project: Lernkartei_2017   File: GroupCreateView.java   Source Code and License Vote up 4 votes
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	list = new ListView<String>();
	items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
	list.setItems(items);		
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	CheckGroup = new HBox(50);
	ShowStatus = new HBox(50);
	Option = new HBox(50);
	
	txtGroupName = new TextField();
	txtGroupName.setPromptText("Gruppenname");
	
	name = new Label("Name:");
	status = new Label("Status");
	statusValue = new Label("{Verf�gbarkeitsstatus}");
	
	btnCheck = new AppButton("Pr�fen");
	btnAdd = new AppButton("Hinzuf�gen");
	btnRemove = new AppButton("Entfernen");
	back = new BackButton(getFXController(),"Zur�ck");
	
	AllFields.getChildren().addAll(CheckGroup,ShowStatus,Option,list);
	
	CheckGroup.getChildren().addAll(name,txtGroupName,btnCheck);
	ShowStatus.getChildren().addAll(status,statusValue);
	Option.getChildren().addAll(back,btnAdd,btnRemove);
	
	bp.setCenter(AllFields);
	
	btnAdd.setOnAction(e -> getFXController().showView("userlistview"));
	back.setOnAction(e -> getFXController().showView("groupview"));
	
	/*Has to check if name of group already exists*/
	btnCheck.setOnAction(e -> getFXController().showView(""));
			
	return bp;
}
 
Example 16
Project: Lernkartei_2017   File: SaveDownloadstackOwnDMOView.java   Source Code and License Vote up 4 votes
@Override
public Parent constructContainer()
{
	bp = new BorderPane();
	bp.setId("userviewbg");
	
	back = new BackButton(getFXController(),"Zur�ck");
	
	tabPane = new TabPane();
	tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
	tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
		   @Override
		   public void changed(ObservableValue<? extends Tab> ov, Tab tabOld, Tab tabNew) {
		      refreshView();
		   }
		});
	 
    	    
    Center = new VBox();
    Search = new HBox();
    Top = new VBox();
    
    
    txtSearch = new TextField();
    txtSearch.setPromptText("Suche nach Doors");
    txtSearch.setMinWidth(740);
    txtSearch.setMinHeight(50);;
    btnSearch = new AppButton("Suchen");
    btnCreate = new AppButton("++Erstellen++");
    btnCreate.setMinWidth(590);
    btnCreate.setOnAction(e -> getFXController().showView("createdoorview"));
    
    StackShowList.setSpacing(20);
    Center.setSpacing(20);
    
    
    sMain = new ScrollPane();
    sMain.setContent(Center);
    
    Search.getChildren().addAll(txtSearch,btnSearch);
    Center.getChildren().addAll(StackShowList,btnCreate);
    
	back = new AppButton("Zur�ck");
	back.setOnAction(e-> getFXController().showView("savedownloadstackowndmodoorselectionview"));
	
	
	Bottom = new VBox();

	Bottom.getChildren().addAll(back);
	Top.getChildren().addAll(Search,tabPane);
	
	bp.setTop(Top);
	bp.setCenter(sMain);
	bp.setBottom(Bottom);
	
	getFXController().getModel("serverstack").registerView(this);
	
	return bp;
}
 
Example 17
Project: Lernkartei_2017   File: DMOModifyStackView.java   Source Code and License Vote up 4 votes
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	AllFields = new HBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	AllFields.setPadding(new Insets(200,0,0,0));
	//AllFields.setMinWidth(740);
	
	Value = new VBox();
	Value.setMinWidth(400);
	Value.setSpacing(35);
	Buttons = new VBox();
	Buttons.setSpacing(5);
	Name = new HBox();
	
	inputName = new TextField();
	inputName.setPromptText("Names der Door");
	inputName.setAlignment(Pos.CENTER_LEFT);
	inputName.setMinWidth(50);
	
	name = new Label("Name");
	removeDoor = new Label("Stack l�schen");
	titel = new Label("Bearbeiten");

	btnRemoveDoor = new AppButton("Entfernen");
	btnRemoveStack = new AppButton("Entfernen");
	btnModify = new AppButton("�ndern");
	back = new BackButton(getFXController(),"Abbrechen");
	
	//Buttons.getChildren().addAll(,,btnRemoveStack,back);
	Name.getChildren().addAll(name,inputName);
	Value.getChildren().addAll(Name,removeDoor);
	Buttons.getChildren().addAll(btnModify,btnRemoveDoor,back);
	AllFields.getChildren().addAll(Value,Buttons);
	
	/*inside.setLeft(AllFields); 
	inside.setRight(Buttons);*/
	
	bp.setCenter(AllFields);
	
	/*
	btnCreate.setOnAction(e -> getFXController().showView("serverdoorview"));
	--Listenter to crete a door
	*/
	
	
	return bp;
}
 
Example 18
Project: qiniu   File: Dialogs.java   Source Code and License Vote up 4 votes
public Pair<FileAction, String[]> showFileMovableDialog(String bucket, String key, boolean setKey) {
	MainWindowController main = MainWindowController.getInstance();
	ButtonType ok = new ButtonType(Values.OK, ButtonData.OK_DONE);
	Dialog<String[]> dialog = getDialog(ok);

	TextField keyTextField = new TextField();
	keyTextField.setPrefWidth(300);
	keyTextField.setPromptText(Values.FILE_NAME);
	keyTextField.setText(key);
	ComboBox<String> bucketCombo = new ComboBox<String>();
	bucketCombo.getItems().addAll(main.bucketChoiceCombo.getItems());
	bucketCombo.setValue(bucket);
	CheckBox copyasCheckBox = new CheckBox(Values.COPY_AS);
	copyasCheckBox.setSelected(true);

	GridPane grid = getGridPane();
	grid.add(copyasCheckBox, 0, 0, 2, 1);
	grid.add(new Label(Values.BUCKET_NAME), 0, 1);
	grid.add(bucketCombo, 1, 1);
	if (setKey) {
		grid.add(new Label(Values.FILE_NAME), 0, 2);
		grid.add(keyTextField, 1, 2);
		Platform.runLater(() -> keyTextField.requestFocus());
	}

	dialog.getDialogPane().setContent(grid);
	dialog.setResultConverter(dialogButton -> {
		if (dialogButton == ok) {
			return new String[] { bucketCombo.getValue(), keyTextField.getText() };
		}
		return null;
	});

	Optional<String[]> result = dialog.showAndWait();
	if (result.isPresent()) {
		bucket = bucketCombo.getValue();
		key = keyTextField.getText();
		FileAction action = copyasCheckBox.isSelected() ? FileAction.COPY : FileAction.MOVE;
		return new Pair<FileAction, String[]>(action, new String[] { bucket, key });
	} else {
		return null;
	}
}
 
Example 19
Project: file-transfer   File: NetPane.java   Source Code and License Vote up 4 votes
private void createPathTextField() {
    pathTextField = new TextField();
    pathTextField.setPrefWidth(250);
    pathTextField.setPromptText("File path...");
}
 
Example 20
Project: graphing-loan-analyzer   File: GUI.java   Source Code and License Vote up 4 votes
/** Customizes text fields */
private void styleTextField(TextField textField, String name, Stage stage, boolean makeNumericOnly){
    textField.setPromptText( name );
    textField.setMaxWidth( stage.getWidth()/4 );
    if(makeNumericOnly) makeNumericOnly(textField);
}