热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.lucene.document.TextField类的使用及代码示例

本文整理了Java中org.apache.lucene.document.TextField类的一些代码示例,展示了TextField类的具体用法。这些代码示例主要来源于Github/Stackove

本文整理了Java中org.apache.lucene.document.TextField类的一些代码示例,展示了TextField类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextField类的具体详情如下:
包路径:org.apache.lucene.document.TextField
类名称:TextField

TextField介绍

[英]A field that is indexed and tokenized, without term vectors. For example this would be used on a 'body' field, that contains the bulk of a document's text.
[中]一个被索引和标记的字段,没有术语向量。例如,这将用于“body”字段,该字段包含文档的大部分文本。

代码示例

代码示例来源:origin: stackoverflow.com

@Override public void start(final Stage stage) throws IOException {
VBox optiOnPane= new VBox(10);
MenuBar menuBar = new MenuBar();
menuBar.getMenus().addAll(new Menu("School"), new Menu("Social"), new Menu("Network"));
root.getChildren().addAll(new TreeItem<>("Layout"), new TreeItem<>("is not"), new TreeItem<>("easy"));
TreeView notes = new TreeView<>(root);
optionPane.getChildren().addAll(menuBar, new Label("Kaiser Notes"), notes);
optionPane.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
VBox editorBox = new VBox(10);
TextField textField = new TextField();
editorBox.getChildren().addAll(textField, editor);
editorBox.setStyle("-fx-background-color: mistyrose; -fx-padding: 10;");
textField.setMinHeight(Control.USE_PREF_SIZE); // stop the textfield from getting squashed when the scene is sized small.
editorBox.setMinSize(0, 0); // stops the editor from overflowing it's bounds in a BorderPane.
layout.setLeft(optionPane);
layout.setCenter(editorBox);
stage.setScene(new Scene(layout));
stage.show();

代码示例来源:origin: stackoverflow.com

TextField textField = new TextField();
textField.textProperty().addListener((observable, oldValue, newValue) -> {
System.out.println("textfield changed from " + oldValue + " to " + newValue);
});

代码示例来源:origin: stackoverflow.com

TextField x = new TextField("text");
x.setRequired(true);

代码示例来源:origin: stackoverflow.com

textField = new TextField();
hbox.setStyle("-fx-background-color: #336699");
hbox.setAlignment(Pos.BOTTOM_CENTER);
HBox.setMargin(b2, new Insets(10,0,10,0));
HBox.setMargin(b1, new Insets(10,0,10,0));
hbox.getChildren().addAll(b1,b2);
borderPane.setTop(hbox);
borderPane.setCenter(table);
BorderPane.setAlignment(table, Pos.CENTER);
BorderPane.setMargin(table, new Insets(25));

代码示例来源:origin: stackoverflow.com

primaryStage.setTitle( "Hello World!" );
final List list = new ArrayList<>();
Button btn = new Button();
btn.setText( "Say 'Hello World'" );
btn.setOnAction( new EventHandler()
BooleanBinding bb = Bindings.createBooleanBinding( () -> oblist.contains( 1 ), oblist );
TextField txt = new TextField();
txt.textProperty().bind( bb.asString() );
VBox root = new VBox();
root.getChildren().addAll( btn, txt );
primaryStage.setScene( scene );
primaryStage.show();

代码示例来源:origin: stackoverflow.com

TextField tf = new TextField();
Label label = new Label("Your Name: ");
Button submit = new Button("submit");
GridPane root = new GridPane();
label.setLabelFor(tf);
root.setPadding(new Insets(10));
root.setVgap(5);
root.setHgap(5);
submit.setOnAction((ActionEvent event) -> {
if (!done.getAndSet(true)) {
System.out.println("Your name is " + tf.getText());
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

public void start(Stage primaryStage) {
HBox hbox = new HBox(10);
TextField field = new TextField();
HBox.setHgrow(field, Priority.ALWAYS);
hbox.setAlignment(Pos.BASELINE_LEFT);
hbox.getChildren().addAll(
new Label("Search:"), field, new Button("Go")
);
hbox.setPadding(new Insets(10));
Scene scene = new Scene(hbox, 600, 250, Color.WHITE);
primaryStage.setScene(scene);
primaryStage.show();
}

代码示例来源:origin: stackoverflow.com

while(!inputFile.exists()) {
window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("File was not found.");
window.setMinWidth(250);
window.setMaxHeight(100);
//form
TextField fileInput = new TextField();
Button inputButton = new Button("Upload File");
inputButton.setOnAction(e -> {
inputFile = new File(fileInput.getText());
window.close();
});
//Layout
VBox layout = new VBox(10);
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(fileInput, inputButton);
//Set scene and show in window.
Scene scene = new Scene(layout, 300, 100);
window.setScene(scene);
window.showAndWait();
}

代码示例来源:origin: stackoverflow.com

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TextFieldShadows extends Application {
@Override
public void start(final Stage stage) throws Exception {
TextField standardTextField = new TextField();
TextField styledTextField = new TextField();
styledTextField.setStyle(
"-fx-background-color: -fx-text-box-border, -fx-control-inner-background;"
);
VBox layout = new VBox(10, standardTextField, styledTextField);
layout.setPadding(new Insets(10));
stage.setScene(new Scene(layout));
stage.show();
}
public static void main(String[] args) throws Exception {
launch(args);
}
}

代码示例来源:origin: stackoverflow.com

VBox root = new VBox(10);
TextField textField = new TextField("Text Field");
Label label = new Label("Label");
root.getChildren().addAll(textField, label, text);
root.setAlignment(Pos.CENTER);
root.setPadding(new Insets(20));
Scene scene = new Scene(root);
scene.getStylesheets().add("text-css-test.css");
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

TextField textField = new TextField("http://stackoverflow.com/questions/39898704");
Button openURLButton = new Button("Open URL");
EventHandler handler = e -> open(textField.getText());
textField.setOnAction(handler);
openURLButton.setOnAction(handler);
Button openFileButton = new Button("Open File...");
openFileButton.setOnAction(e -> {
File file = fileChooser.showOpenDialog(primaryStage);
VBox root = new VBox(5,
new HBox(new Label("URL:"), textField, openURLButton),
new HBox(openFileButton)
);
root.setPadding(new Insets(20));
primaryStage.setScene(new Scene(root));
primaryStage.show();

代码示例来源:origin: stackoverflow.com

stage.setTitle("Validation Demo");
BorderPane borderPane = new BorderPane();
grid.add(scenetitle, 0, 0, 2, 1);
Label userName = new Label("User Name:");
grid.add(userName, 0, 1);
final TextField userTextField = new TextField();
grid.add(userTextField, 1, 1);
grid.add(pwBox, 1, 2);
btn.setOnAction(new EventHandler() {
if (userTextField.getText().equals("")) {
usernameValidator.getItems().clear();
usernameValidator.getItems().add(
&& !userTextField.getText().equals("")) {
actiontarget.setFill(Color.GREEN);
actiontarget.setText("Welcome");
userTextField.focusedProperty().addListener(
new ChangeListener() {
@Override

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage stage) {
TextField textField = new TextField();
Label label = new Label();
label.textProperty().bind(
Bindings.createStringBinding(
() -> new StringBuilder(textField.getText()).reverse().toString(),
textField.textProperty()
layout.setPadding(new Insets(10));
stage.setScene(new Scene(layout));
stage.show();

代码示例来源:origin: stackoverflow.com

public class Main extends Application {
@Override
public void start(Stage stage) {
final VBox vbox = new VBox();
vbox.setSpacing(5);
vbox.setPadding(new Insets(10, 0, 0, 10));
final TextField textField = new TextField();
final Button button = new Button();
vbox.getChildren().addAll(textField, button);
vbox.onKeyPressedProperty().set(new EventHandler() {
@Override public void handle(KeyEvent event) {
textField.requestFocus();
}
});
stage.setScene(new Scene(vbox, 300, 500));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage stage) {
TextField textField = new TextField();
textField.setPromptText("Enter text to be appended.");
Button append = new Button("Append");
append.setDefaultButton(true);
TextArea textArea = new TextArea();
textArea.setPromptText("Appended text is displayed here.");
textArea.setEditable(false);
append.setOnAction(event -> {
textArea.setText(textArea.getText() + textField.getText() + "\n");
textField.clear();
});
VBox layout = new VBox(10);
layout.getChildren().addAll(
textField,
append,
textArea
);
layout.setPadding(new Insets(10));
stage.setScene(new Scene(layout));
stage.show();

代码示例来源:origin: stackoverflow.com

public class Demo extends Application {
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root);
stage.setScene(scene);
TextField myTextField = new TextField("default");
Rectangle myRectangle = new Rectangle();
myRectangle.setHeight(30);
myRectangle.setFill(Color.AQUA);
myRectangle.widthProperty().bind(myTextField.widthProperty());
final VBox hb = new VBox(10);
hb.setPadding(new Insets(5));
hb.getChildren().addAll(myTextField, myRectangle);
scene.setRoot(hb);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}

代码示例来源:origin: stackoverflow.com

TextField textField = new TextField();
textField.setPromptText("Enter text");
textField.pseudoClassStateChanged(empty, true);
textField.textProperty().addListener((obs, oldText, newText) -> {
textField.pseudoClassStateChanged(empty, newText.isEmpty());
});
Button okButton = new Button("OK");
VBox root = new VBox(10, textField, okButton);
root.setAlignment(Pos.CENTER);
root.setPadding(new Insets(24));
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

Button button = new Button("Click Me");
TextField textField = new TextField();
button.addEventHandler(KeyEvent.KEY_PRESSED, e -> System.out.println("Key press on button"));
button.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> System.out.println("Mouse press on button"));
button.addEventHandler(ActionEvent.ACTION, e -> System.out.println("Action on button"));
textField.addEventHandler(ActionEvent.ACTION, e -> System.out.println("Action on text field"));
root.setAlignment(Pos.CENTER);
root.setPadding(new Insets(24));
primaryStage.setScene( new Scene(root) );
primaryStage.show();

代码示例来源:origin: stackoverflow.com

TextField tf1 = new TextField();
TextField tf2 = new TextField();
TextField tf3 = new TextField();
TextField tf4 = new TextField();
TextField tf5 = new TextField();
TextField tf6 = new TextField();
Button button = new Button("Submit");
button.disableProperty().bind(
emptyTextFieldBinding(tf1)
.or(emptyTextFieldBinding(tf2))
root.setAlignment(Pos.CENTER);
root.setPadding(new Insets(10));
Scene scene = new Scene(root, 150, 400);
primaryStage.setScene(scene);
primaryStage.show();
return Bindings.length(textField.textProperty()).isEqualTo(0);

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage primaryStage) throws Exception{
TextField textfield = new TextField();
ListView listView = new ListView();
listView.getItems().add("One");
listView.getItems().add("Two");
listView.getItems().add("Three");
Button button = new Button("Button");
VBox root = new VBox(5, textfield, listView, button);
root.addEventFilter(KeyEvent.KEY_PRESSED, event->{
if (event.getCode() == KeyCode.SPACE) {
System.out.println("GOOD");
}
});
root.setAlignment(Pos.CENTER);
root.setPadding(new Insets(10));
primaryStage.setScene(new Scene(root, 400, 400));
primaryStage.show();
}

推荐阅读
author-avatar
pyg2358_586
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有