本文整理汇总了Java中javafx.scene.control.TextAreaBuilder类的典型用法代码示例。如果您正苦于以下问题:Java TextAreaBuilder类的具体用法?Java TextAreaBuilder怎么用?Java TextAreaBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextAreaBuilder类属于javafx.scene.control包,在下文中一共展示了TextAreaBuilder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.control.TextAreaBuilder; //导入依赖的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
示例2: start
import javafx.scene.control.TextAreaBuilder; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
final TextArea testText = TextAreaBuilder.create()
.text("Test")
.prefHeight(50)
.prefWidth(500)
.build();
final ChoiceBox<Interpolator> interpolatorChoiceBox = new ChoiceBox<Interpolator>();
interpolatorChoiceBox.getItems().addAll(FXCollections.observableArrayList(
Interpolator.LINEAR,
Interpolator.DISCRETE,
Interpolator.EASE_BOTH,
Interpolator.EASE_IN,
Interpolator.EASE_OUT
));
interpolatorChoiceBox.setPrefHeight(25);
interpolatorChoiceBox.setPrefWidth(500);
interpolatorChoiceBox.getSelectionModel().selectFirst();
final Text lcdText = TextBuilder.create()
.x(100)
.y(100)
.fontSmoothingType(FontSmoothingType.LCD)
.build();
lcdText.textProperty().bind(testText.textProperty());
final Circle point = CircleBuilder.create()
.centerX(100)
.centerY(100)
.radius(2)
.fill(Color.RED)
.build();
Pane root = VBoxBuilder.create()
.children(
PaneBuilder.create()
.minWidth(500)
.minHeight(500)
.children(
lcdText,
point)
.onMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
point.setCenterX(event.getX());
point.setCenterY(event.getY());
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.seconds(5),
new KeyValue(lcdText.xProperty(), event.getX(),
interpolatorChoiceBox.getSelectionModel().getSelectedItem())),
new KeyFrame(Duration.seconds(5),
new KeyValue(lcdText.yProperty(), event.getY(),
interpolatorChoiceBox.getSelectionModel().getSelectedItem()))
)
.build()
.play();
}
})
.build(),
testText,
interpolatorChoiceBox)
.build();
Scene scene = new Scene(root, 500, 575);
primaryStage.setTitle("Test Animnation LCD Text");
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:82,代码来源:AnimationLCDTextTestApp.java
示例3: start
import javafx.scene.control.TextAreaBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
final TextArea textArea = TextAreaBuilder.create()
.prefWidth(WIDTH)
.prefHeight(HEIGHT)
.wrapText(true)
.id("terminal")
.text("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nGob's Program: Y/N?\n? ")
.build();
textArea.positionCaret(999);
textArea.setOnKeyReleased(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent keyEvent) {
textArea.setText(textArea.getText(0, textArea.getText().length() - 1));
textArea.positionCaret(999);
String input = keyEvent.getCode().getName().toUpperCase();
if("Y".equals(input) ||
"N".equals(input)) {
// Trying to replace lower case input with upper case.
textArea.appendText(input + "\n");
new Thread(new Runnable() {
@Override public void run() {
while(true) {
// This little delay helps create the scrolling effect.
try { Thread.sleep(50); } catch(InterruptedException e) {}
textArea.appendText(PENUS + "\n");
}
}
}).start();
}
else {
textArea.positionCaret(999);
}
}
});
StackPane root = new StackPane();
root.getChildren().add(textArea);
Scene scene = new Scene(root, WIDTH, HEIGHT);
scene.getStylesheets().add(
JavaFx.class.getResource("gobs-program.css").toExternalForm());
stage.setTitle("Gob's Program");
stage.setScene(scene);
stage.show();
}
开发者ID:infinitemule,项目名称:gobs-program,代码行数:65,代码来源:JavaFx.java
示例4: start
import javafx.scene.control.TextAreaBuilder; //导入依赖的package包/类
@Override
public void start(final Stage primaryStage) {
primaryStage.setTitle("java-buddy.blogspot.com");
Group root = new Group();
final TextArea textArea = TextAreaBuilder.create()
.prefWidth(400)
.wrapText(true)
.build();
ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("noborder-scroll-pane");
scrollPane.setContent(textArea);
scrollPane.setFitToWidth(true);
scrollPane.setPrefWidth(400);
scrollPane.setPrefHeight(180);
Button buttonLoad = new Button("Load");
buttonLoad.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent arg0) {
FileChooser fileChooser = new FileChooser();
//Set extension filter
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
fileChooser.getExtensionFilters().add(extFilter);
//Show save file dialog
File file = fileChooser.showOpenDialog(primaryStage);
if(file != null){
textArea.setText(readFile(file));
}
}
});
VBox vBox = VBoxBuilder.create()
.children(buttonLoad, scrollPane)
.build();
root.getChildren().add(vBox);
primaryStage.setScene(new Scene(root, 500, 400));
primaryStage.show();
}
开发者ID:fedevelatec,项目名称:Pruebas,代码行数:48,代码来源:JavaFX_OpenFile.java
注:本文中的javafx.scene.control.TextAreaBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论