• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TextFieldBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javafx.scene.control.TextFieldBuilder的典型用法代码示例。如果您正苦于以下问题:Java TextFieldBuilder类的具体用法?Java TextFieldBuilder怎么用?Java TextFieldBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TextFieldBuilder类属于javafx.scene.control包,在下文中一共展示了TextFieldBuilder类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: TextFieldEventsCounter

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
public TextFieldEventsCounter(final String counterName) {
    if (counterName == null) {
        throw new IllegalArgumentException("Counter name cannot be null.");
    }
    try {
        this.counterName = counterName;
        Label label = LabelBuilder.create().text(counterName + " : ").prefWidth((new Text(counterName + " : ")).getBoundsInParent().getWidth() + 30).build();
        final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(counterName.toUpperCase() + COUNTER_SUFFIX).build();
        counter.addListener(new ChangeListener<Number>() {
            public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                log("Counter " + counterName + ": new value : <" + t1 + ">.");
                tf.setText(t1.toString());
            }
        });
        getChildren().addAll(label, tf);
    } catch (Throwable ex) {
        log(ex);
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:20,代码来源:TextFieldEventsCounter.java


示例2: StringPropertyValueSetter

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
public StringPropertyValueSetter(Property listeningProperty, BindingType btype, Object testedControl, String initialString) {
    try {
        final TextField tf = TextFieldBuilder.create().text(initialString).id(createId(listeningProperty, btype)).build();
        this.leadingControl = tf;
        this.leadingProperty = (Property) tf.textProperty();
        this.listeningProperty = listeningProperty;
        tf.setId(createId(listeningProperty, btype));

        propertyValueType = PropertyValueType.STRING;
        initialValue1 = initialString;

        bindComponent(btype, testedControl);
    } catch (Throwable ex) {
        log(ex);
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:StringPropertyValueSetter.java


示例3: getListener

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
private HBox getListener(String name) {
    HBox hb = new HBox();
    Label label = new Label(name + " : ");
    TextField tf = TextFieldBuilder.create().id(getListenerTextFieldID(name)).build();
    hm.put(name, tf);

    hb.getChildren().addAll(label, tf);
    return hb;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:10,代码来源:ScrollEventApp.java


示例4: CustomPopUp

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
public CustomPopUp(StackPane parentWindow) {
	super();
	this.parent = parentWindow;
	setMaxHeight(200);
	setMaxWidth(200);
	getChildren().add(
			StackPaneBuilder.create().style(style).minHeight(200).minWidth(200).alignment(Pos.TOP_RIGHT)
					.children(ButtonBuilder.create().text("Close").onAction(new EventHandler<ActionEvent>() {
						@Override
						public void handle(ActionEvent paramT) {
							parent.getChildren().remove(CustomPopUp.this);
						}
					}).build(), TextFieldBuilder.create().translateY(20).build()).build());
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:15,代码来源:JavaFXOnTrayIconDemo.java


示例5: CustomPopUp

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
public CustomPopUp() {
	super();
	getContent().add(
			StackPaneBuilder.create().style(style).minHeight(200).minWidth(200).alignment(Pos.TOP_RIGHT)
					.children(ButtonBuilder.create().text("Close").onAction(new EventHandler<ActionEvent>() {
						@Override
						public void handle(ActionEvent paramT) {
							CustomPopUp.this.hide();
						}
					}).build(), TextFieldBuilder.create().translateY(20).build()).build());
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:12,代码来源:PopupOnTransparentStageDemo.java


示例6: configureScroller

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
private void configureScroller() {
	CustomTextField field = new CustomTextField();
	field.setType(CustomTextField.TextFieldType.POSITIVE_INTEGER);
	field.setPromptText("hello");
	field.setMaxCharLength(5);
	HBox hb1 = HBoxBuilder.create().spacing(10).children(new Label("INTEGER_ONLY   : ") 
                                                            ,CustomTextFieldBuilder.create()
                                                            		.type(CustomTextField.TextFieldType.POSITIVE_INTEGER)
                                                            		.maxCharLength(5).build()
                                                    ).build();
	
	CustomPromptTextField promptField = new CustomPromptTextField();
	promptField.setPromptText("Enter value");
	
	vb.getChildren().addAll(HBoxBuilder.create().spacing(10)
			                           .children(new Label("POSITIVE_INTEGER   : ") 
                                                    ,CustomTextFieldBuilder.create()
		                                                 .type(CustomTextField.TextFieldType.POSITIVE_INTEGER)
		                                                 .maxCharLength(5).build() ).build()
		                       
		                       ,HBoxBuilder.create().spacing(10)
			                           .children(new Label("ALPHABET   : ") 
		                               ,CustomTextFieldBuilder.create()
		                                    .type(CustomTextField.TextFieldType.ALPHABET)
		                                    .maxCharLength(5).build() ).build()
                           
		                   ,HBoxBuilder.create().spacing(10)
			                           .children(new Label("Double   : ") 
		                               ,CustomTextFieldBuilder.create()
		                                    .type(CustomTextField.TextFieldType.DOUBLE)
		                                    .maxCharLength(13).build() ).build()
		                   ,promptField
		                   ,TextFieldBuilder.create().promptText("Enter value").build()
	 		                       
			);
	
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:38,代码来源:CustomTextFieldDemo.java


示例7: createUI

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
/**
 * create the UI on first call
 * 
 * @return
 */
private Node createUI() {
	final AnchorPane anchor = AnchorPaneBuilder.create()
			.styleClass("roundedAnchorPaneFX").build();
	final Label heading = LabelBuilder.create()
			.text(this.getResourceBundle().getString("javafxCompTop"))
			.alignment(Pos.CENTER).styleClass("propLabel").build();
	final Button top = ButtonBuilder.create()
			.text(this.getResourceBundle().getString("send")).layoutX(120)
			.onMouseClicked(this.getEventHandler()).alignment(Pos.CENTER)
			.build();
	this.textField = TextFieldBuilder.create().text("")
			.styleClass("propTextField").alignment(Pos.CENTER).build();

	AnchorPane.setBottomAnchor(top, 25.0);
	AnchorPane.setRightAnchor(top, 25.0);

	AnchorPane.setRightAnchor(heading, 50.0);
	AnchorPane.setTopAnchor(heading, 10.0);

	AnchorPane.setTopAnchor(this.textField, 50.0);
	AnchorPane.setRightAnchor(this.textField, 25.0);

	anchor.getChildren().addAll(heading, top, this.textField);

	GridPane.setHgrow(anchor, Priority.ALWAYS);
	GridPane.setVgrow(anchor, Priority.ALWAYS);

	return anchor;
}
 
开发者ID:JacpFX,项目名称:JacpFX-misc,代码行数:35,代码来源:ComponentTop.java


示例8: createUI

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
/**
 * create the UI on first call
 * 
 * @return
 */
private Node createUI() {
	final AnchorPane anchor = AnchorPaneBuilder.create()
			.styleClass("roundedAnchorPaneFX").build();
	final Label heading = LabelBuilder.create()
			.text(this.getResourceBundle().getString("javafxComp"))
			.alignment(Pos.CENTER_RIGHT).styleClass("propLabelBig").build();

	final Button left = ButtonBuilder
			.create()
			.text(this.getResourceBundle().getString("send"))
			.layoutX(120)
			.onMouseClicked(
					this.getActionListener("id01.id003",
							"hello stateful component").getListener())
			.alignment(Pos.CENTER).build();

	this.textField = TextFieldBuilder.create().text("")
			.styleClass("propTextField").alignment(Pos.CENTER).build();

	AnchorPane.setRightAnchor(heading, 25.0);
	AnchorPane.setTopAnchor(heading, 15.0);

	AnchorPane.setTopAnchor(left, 80.0);
	AnchorPane.setRightAnchor(left, 25.0);

	AnchorPane.setTopAnchor(this.textField, 50.0);
	AnchorPane.setRightAnchor(this.textField, 25.0);
	AnchorPane.setLeftAnchor(this.textField, 25.0);

	anchor.getChildren().addAll(heading, left, this.textField);

	GridPane.setHgrow(anchor, Priority.ALWAYS);
	GridPane.setVgrow(anchor, Priority.ALWAYS);

	return anchor;
}
 
开发者ID:JacpFX,项目名称:JacpFX-misc,代码行数:42,代码来源:ComponentLeft.java


示例9: start

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
@Override
public void start(final Stage stage) throws Exception {
    final TextField xField = TextFieldBuilder.create().promptText("x").build();
    final TextField yField = TextFieldBuilder.create().promptText("y").build();

    final TextArea awtField = TextAreaBuilder.create().promptText("awt").build();
    final TextArea glassField = TextAreaBuilder.create().promptText("glass").build();

    Button act = new Button("Get colors");
    act.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
            try {
                int x = Integer.parseInt(xField.getText());
                int y = Integer.parseInt(yField.getText());

                stage.setX(x + 1);
                stage.setY(y + 1);

                java.awt.Robot robotAwt = new java.awt.Robot();
                com.sun.glass.ui.Robot robotGlass = new GetAction<com.sun.glass.ui.Robot>() {
                    @Override
                    public void run(Object... os) throws Exception {
                        setResult(com.sun.glass.ui.Application.GetApplication().createRobot());
                    }
                }.dispatch(Root.ROOT.getEnvironment());

                java.awt.Color glassColor = new java.awt.Color(robotGlass.getPixelColor((int) Math.round(x), (int) Math.round(y)));
                java.awt.Color awtColor = robotAwt.getPixelColor((int) Math.round(x), (int) Math.round(y));

                awtField.setText("AWT robot " + getColorDescription(awtColor));
                glassField.setText("Glass robot " + getColorDescription(glassColor));
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
        }
    });

    stage.initStyle(StageStyle.UNDECORATED);
    stage.setScene(new Scene(new VBox(5, xField, yField, act, awtField, glassField)));
    stage.show();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:42,代码来源:ColorHelper.java


示例10: createLoginDialog

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
/**
 * Creates a {@linkplain DialogService} that displays a
 * login screen
 *
 * @param primaryStage
 *            the primary application {@linkplain Stage}
 */
public DialogService createLoginDialog(final Stage primaryStage) {
       final TextField username = TextFieldBuilder.create().promptText(
			"Username").build();
	final PasswordField password = PasswordFieldBuilder.create().promptText(
			"Password").build();
	final Button closeBtn = ButtonBuilder.create().text("Close").build();
	final Service<Void> submitService = new Service<Void>() {
		@Override
		protected Task<Void> createTask() {
			return new Task<Void>() {
				@Override
				protected Void call() throws Exception {
					final boolean hasUsername = !username.getText()
							.isEmpty();
					final boolean hasPassword = !password.getText()
							.isEmpty();
					if (hasUsername && hasPassword) {
						// TODO : perform some sort of authentication here
						// or you can throw an exception to see the error
						// message in the dialog window
					} else {
						final String invalidFields = (!hasUsername ? username
								.getPromptText() : "")
								+ ' '
								+ (!hasPassword ? password.getPromptText()
										: "");
						throw new RuntimeException("Invalid "
								+ invalidFields);
					}
					return null;
				}
			};
		}
	};
	final DialogService dialogService = dialog(primaryStage,
			"Test Dialog Window",
			"Please provide a username and password to access the application",
			null, "Login", 550d, 300d, submitService, closeBtn, username, password);
	if (closeBtn != null) {
	      closeBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
	            @Override
	            public void handle(final MouseEvent event) {
	                  dialogService.hide();
	            }
	      });
	}
	return dialogService;
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:56,代码来源:DialogServiceTest.java


示例11: createLoginDialog

import javafx.scene.control.TextFieldBuilder; //导入依赖的package包/类
/**
 * Creates a {@linkplain DialogService} that displays a
 * login screen
 *
 * @param primaryStage
 *            the primary application {@linkplain Stage}
 */
public DialogService createLoginDialog(final Stage primaryStage) {
       final TextField username = TextFieldBuilder.create().promptText(
			"Username").build();
	final PasswordField password = PasswordFieldBuilder.create().promptText(
			"Password").build();
	final Button closeBtn = ButtonBuilder.create().text("Close").build();
	final Service<Void> submitService = new Service<Void>() {
		@Override
		protected Task<Void> createTask() {
			return new Task<Void>() {
				@Override
				protected Void call() throws Exception {
					final boolean hasUsername = !username.getText()
							.isEmpty();
					final boolean hasPassword = !password.getText()
							.isEmpty();
					if (hasUsername && hasPassword) {
						// TODO : perform some sort of authentication here
						// or you can throw an exception to see the error
						// message in the dialog window
					} else {
						final String invalidFields = (!hasUsername ? username
								.getPromptText() : "")
								+ ' '
								+ (!hasPassword ? password.getPromptText()
										: "");
						throw new RuntimeException("Invalid "
								+ invalidFields);
					}
					return null;
				}
				
			};
		}
	};
	final DialogService dialogService = dialog(primaryStage,
			"Test Dialog Window",
			"Please provide a username and password to access the application",
			null, "Login", 550d, 300d, submitService, closeBtn, username, password);
	if (closeBtn != null) {
	      closeBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
	            @Override
	            public void handle(final MouseEvent event) {
	                  dialogService.hide();
	            }
	      });
	}
	return dialogService;
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:57,代码来源:DialogServiceTest.java



注:本文中的javafx.scene.control.TextFieldBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ColumnValue类代码示例发布时间:2022-05-22
下一篇:
Java EntityHorse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap