当前位置: 首页>>代码示例>>Java>>正文


Java TextField.setPrefWidth方法代码示例

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


在下文中一共展示了TextField.setPrefWidth方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTopBar

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private HBox createTopBar()
{
	HBox counterHBox = new HBox();
	counterHBox.setPadding(new Insets(15, 15, 15, 15));
	counterHBox.setSpacing(10);
	
	Label programCounterLabel = new Label("Program Count");
	programCounterLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
	
	TextField programCounterText = new TextField();
	programCounterText.setPrefWidth(50);
	
	Label nextInstructionLabel = new Label("Next Instruction");
	nextInstructionLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
	
	TextField nextInstructionText = new TextField();
	nextInstructionText.setPrefWidth(200);
	counterHBox.getChildren().addAll(programCounterLabel, programCounterText,
			nextInstructionLabel, nextInstructionText);
			
	return counterHBox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:23,代码来源:CpuWindow.java

示例2: createControlPane

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private HBox createControlPane()
{
	HBox hbox = new HBox();
	setAlignment(hbox, Pos.CENTER);
	hbox.setAlignment(Pos.CENTER_LEFT);
	hbox.setPadding(new Insets(10, 10, 10, 10));
	hbox.setSpacing(5);
	
	Label label = new Label("Send");
	label.setMinWidth(Label.USE_PREF_SIZE);
	hbox.getChildren().add(label);
	
	ComboBox<String> dropdown = createDisplayOptionsDropdown();
	dropdown.setMinWidth(ComboBox.USE_PREF_SIZE);
	hbox.getChildren().add(dropdown);
	
	TextField valueField = new TextField();
	valueField.setPrefWidth(Integer.MAX_VALUE);
	hbox.getChildren().add(valueField);
	
	Button send = new Button("Send");
	send.setMinWidth(Button.USE_PREF_SIZE);
	hbox.getChildren().add(send);
	
	Button clear = new Button("Clear");
	clear.setMinWidth(Button.USE_PREF_SIZE);
	clear.setOnAction((event) -> clear());
	hbox.getChildren().add(clear);
	
	return hbox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:32,代码来源:UARTPanel.java

示例3: initGUI

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void initGUI() {
    //Search facility
    Label searchLabel = new Label();
    Image dirImage = new Image("icon/ZOOM_IN.png");
    searchLabel.setGraphic(new ImageView(dirImage));
    keywordInput = new TextField("Type in search keyword...");
    keywordInput.setPrefWidth(230);
    //Add actionlistener
    keywordInput.textProperty().addListener((observalbe, oldvalue, newvalue)->{           
       updateTreeView(newvalue.toUpperCase());
    });
    //Add focus listener
    keywordInput.focusedProperty().addListener((observalbe, oldvalue, newvalue)->{
        if (newvalue) {
           if (getNodeLayerCount(currentSelectedNode) >= 2) {
              keywordInput.setText("");
           }
        }
    });
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    hBox.getChildren().addAll(searchLabel, keywordInput);
    setTop(hBox); 
    treeView = new TreeView();
    treeView.setMinWidth(200);;
    treeView.setEditable(false);
    treeView.setOnMouseClicked(onTreeItemClicked()); //<-Handle mouse click event
    setCenter(treeView);
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:30,代码来源:MarketDataTreeViewNode.java

示例4: HTMLEditorSample

import javafx.scene.control.TextField; //导入方法依赖的package包/类
public HTMLEditorSample() {
    final VBox root = new VBox();
    root.setPadding(new Insets(8, 8, 8, 8));
    root.setSpacing(5);
    root.setAlignment(Pos.BOTTOM_LEFT);

    final GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(10);

    final ChoiceBox sendTo = new ChoiceBox(FXCollections.observableArrayList("To:", "Cc:", "Bcc:"));

    sendTo.setPrefWidth(100);
    GridPane.setConstraints(sendTo, 0, 0);
    grid.getChildren().add(sendTo);

    final TextField tbTo = new TextField();
    tbTo.setPrefWidth(400);
    GridPane.setConstraints(tbTo, 1, 0);
    grid.getChildren().add(tbTo);

    final Label subjectLabel = new Label("Subject:");
    GridPane.setConstraints(subjectLabel, 0, 1);
    grid.getChildren().add(subjectLabel);

    final TextField tbSubject = new TextField();
    tbTo.setPrefWidth(400);
    GridPane.setConstraints(tbSubject, 1, 1);
    grid.getChildren().add(tbSubject);

    root.getChildren().add(grid);

    Platform.runLater(() -> {
        final HTMLEditor htmlEditor = new HTMLEditor();
        htmlEditor.setPrefHeight(370);
        root.getChildren().addAll(htmlEditor, new Button("Send"));
    });

    final Label htmlLabel = new Label();
    htmlLabel.setWrapText(true);
    getChildren().add(root);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:HTMLEditorSample.java

示例5: showFileMovableDialog

import javafx.scene.control.TextField; //导入方法依赖的package包/类
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;
	}
}
 
开发者ID:zhazhapan,项目名称:qiniu,代码行数:44,代码来源:Dialogs.java

示例6: createMemoryControlPanel

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private Node createMemoryControlPanel()
{
	BorderPane addressPanel = new BorderPane();
	
	Label watchAddressLabel = new Label("Watch Address: ");
	addressPanel.setLeft(watchAddressLabel);
	setAlignment(watchAddressLabel, Pos.CENTER);
	
	TextField addressField = new TextField();
	addressPanel.setCenter(addressField);
	setAlignment(addressField, Pos.CENTER);
	
	Button watchAddressButton = new Button("Add");
	watchAddressButton.setOnAction((event) -> watchMemoryAddress(addressField
			.getText()));
	addressPanel.setRight(watchAddressButton);
	setAlignment(watchAddressButton, Pos.CENTER);
	
	BorderPane rangePanel = new BorderPane();
	
	Label watchRangeFromLabel = new Label("Watch Range From ");
	rangePanel.setLeft(watchRangeFromLabel);
	setAlignment(watchRangeFromLabel, Pos.CENTER);
	
	HBox inputBox = new HBox();
	
	TextField fromField = new TextField();
	inputBox.getChildren().add(fromField);
	fromField.setPrefWidth(Integer.MAX_VALUE);
	
	Label toLabel = new Label(" To ");
	toLabel.setMinSize(Label.USE_PREF_SIZE, Label.USE_PREF_SIZE);
	inputBox.getChildren().add(toLabel);
	inputBox.setAlignment(Pos.CENTER);
	
	TextField toField = new TextField();
	toField.setPrefWidth(Integer.MAX_VALUE);
	inputBox.getChildren().add(toField);
	
	rangePanel.setCenter(inputBox);
	setAlignment(inputBox, Pos.CENTER);
	
	Button watchRangeButton = new Button("Add");
	watchRangeButton.setOnAction((event) -> watchMemoryRange(fromField.getText(),
			toField.getText()));
	rangePanel.setRight(watchRangeButton);
	setAlignment(watchRangeButton, 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);
		memoryDisplayFunction.set(function);
	});
	
	VBox controlPanel = new VBox();
	controlPanel.getChildren().add(addressPanel);
	controlPanel.getChildren().add(rangePanel);
	controlPanel.getChildren().add(displayOptions);
	controlPanel.setAlignment(Pos.CENTER);
	setAlignment(controlPanel, Pos.CENTER);
	controlPanel.setPadding(new Insets(CP_PADDING));
	controlPanel.setSpacing(CP_SPACING);
	
	return controlPanel;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:69,代码来源:WatcherWindow.java

示例7: ASMCreationPanel

import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
 * @param onCreateASM
 *            Method to call when "create" is clicked. This parameter must be
 *            non-null.
 * 
 * @throws IllegalArgumentException
 *             if onCreateASM is null
 */
public ASMCreationPanel(Consumer<ASMCreationDetails> onCreateASM)
{
	if (onCreateASM == null)
		throw new IllegalArgumentException("onCreateASM must be non-null");
	
	this.onCreateASM = onCreateASM;
	this.setPadding(new Insets(20));
	GridPane grid = new GridPane();
	HBox buttons = new HBox(10);
	grid.setHgap(10);
	grid.setVgap(30);
	grid.setPadding(new Insets(10, 10, 10, 10));
	
	Label ASMFileName = new Label();
	ASMFileName.setText("File Name: ");
	ASMFileName.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
	
	nameText = new TextField();
	nameText.setText("");
	nameText.requestFocus();
	nameText.setPrefWidth(200);
	
	Label projectName = new Label();
	projectName.setText("Add to Project: ");
	projectName.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
	
	projectListDropdown = new ComboBox<>();
	
	Button create = new Button();
	create.setText("Create");
	create.setOnAction(this::onCreateASMClicked);
	
	grid.add(ASMFileName, 0, 0);
	grid.add(nameText, 1, 0);
	grid.add(projectName, 0, 1);
	grid.add(projectListDropdown, 1, 1);
	
	this.setCenter(grid);
	buttons.getChildren().add(create);
	buttons.setAlignment(Pos.BASELINE_RIGHT);
	this.setBottom(buttons);
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:51,代码来源:ASMCreationPanel.java

示例8: ICalWebSourcePane

import javafx.scene.control.TextField; //导入方法依赖的package包/类
public ICalWebSourcePane() {
    urlField = new TextField();
    urlField.setPrefWidth(300);
    nameField = new TextField();
    styleComboBox = new ComboBox<>();
    styleComboBox.getItems().setAll(Calendar.Style.values());
    styleComboBox.setButtonCell(new StyleCell());
    styleComboBox.setCellFactory(listView -> new StyleCell());

    acceptButton = new Button("Accept");
    cancelButton = new Button("Cancel");

    GridPane gridPane = new GridPane();
    gridPane.add(new Label("URL"), 0, 0);
    gridPane.add(urlField, 1, 0);
    gridPane.add(new Label("Name"), 0, 1);
    gridPane.add(nameField, 1, 1);
    gridPane.add(new Label("Color"), 0, 2);
    gridPane.add(styleComboBox, 1, 2);
    gridPane.getStyleClass().add("center");
    gridPane.setVgap(5);
    gridPane.setHgap(5);
    gridPane.setPadding(new Insets(10));

    GridPane.setHgrow(urlField, Priority.ALWAYS);
    GridPane.setHgrow(nameField, Priority.ALWAYS);
    GridPane.setHgrow(styleComboBox, Priority.ALWAYS);

    ButtonBar buttonBar = new ButtonBar();
    buttonBar.getButtons().addAll(acceptButton, cancelButton);

    VBox bottomPane = new VBox();
    bottomPane.getChildren().addAll(new Separator(), buttonBar);
    bottomPane.getStyleClass().add("bottom");
    bottomPane.setFillWidth(true);
    bottomPane.setSpacing(10);

    setCenter(gridPane);
    setBottom(bottomPane);
    getStyleClass().add("ical-web-source-pane");
    setPadding(new Insets(15));
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:43,代码来源:ICalWebSourcePane.java

示例9: loadPropertyViewer

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void loadPropertyViewer(){
	keysBox = new ComboBox<String>();
	keysBox.setPrefWidth(150);
	valField = new TextField();
	valField.setPrefWidth(150);
	final Button save = new Button("Save"), newProp = new Button("New"), 
			delete = new Button("Delete");
	save.setDisable(true);
	delete.setDisable(true);
	
	keysBox.getItems().add("");
	String[] keys = getKeys();
	keysBox.getItems().addAll(keys);
	keysBox.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue)->{
		local = true;
		if(newValue.intValue() != 0){
			cProp = props.get(newValue.intValue() - 1);
			valField.setText(cProp.getValue());
			delete.setDisable(false);
		}else {
			valField.setText("");
			delete.setDisable(true);
		}
		local = false;
		save.setDisable(true);
	});
	valField.textProperty().addListener((observable, oldValue, newValue)->{
		if(!local && keysBox.getSelectionModel().getSelectedIndex() > 0)
			save.setDisable(false);
	});
	
	delete.setOnAction((e)->{
		int i = keysBox.getSelectionModel().getSelectedIndex();
		if(i != 0){
			keysBox.getItems().remove(i);
			props.get(i - 1).remove();
			props.remove(i - 1);
		}
		keysBox.getSelectionModel().select(i - 1);
	});
	save.setOnAction((e)->{
		String newVal = valField.getText();
		if(!newProp(cProp, newVal))
			FlashFXUtils.showErrorDialog(this, "Error", "Value is incompatible with property type");
		save.setDisable(true);
	});
	newProp.setOnAction((e)->{
		Property prop = PropertyViewer.showPropertyCreator(this);
		if(prop != null){
			props.add(prop);
			keysBox.getItems().add(prop.getName());
		}
	});
	VBox viewerNode = new VBox();
	viewerNode.getChildren().addAll(keysBox, valField);
	viewerNode.setSpacing(10);
	viewerNode.setAlignment(Pos.CENTER);
	viewerNode.setPadding(new Insets(10, 10, 10, 10));
	HBox buttonNode = new HBox();
	buttonNode.getChildren().addAll(save, newProp, delete);
	buttonNode.setSpacing(10);
	buttonNode.setAlignment(Pos.CENTER_RIGHT);
	buttonNode.setPadding(new Insets(0, 5, 5, 0));
	BorderPane pane = new BorderPane();
	pane.setBottom(buttonNode);
	pane.setCenter(viewerNode);
	setScene(new Scene(pane, 200, 200));
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:69,代码来源:PropertyViewer.java

示例10: loadPropertyCreator

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void loadPropertyCreator(){
	nameField = new TextField();
	nameField.setPrefWidth(150);
	valField = new TextField();
	valField.setPrefWidth(150);
	valField.setDisable(true);
	final ComboBox<Property.Type> typeBox = new ComboBox<Property.Type>();
	typeBox.setPrefWidth(150);
	typeBox.getItems().addAll(Property.Type.values());
	final Button save = new Button("Save"), cancel = new Button("Cancel");
	save.setDisable(true);
	
	nameField.textProperty().addListener((observable, oldValue, newValue)->{
		if(valField.isDisabled() && !newValue.equals(""))
			valField.setDisable(false);
	});
	valField.textProperty().addListener((observable, oldValue, newValue)->{
		if(!valField.getText().equals(""))
			save.setDisable(false);
		else save.setDisable(true);
	});
	
	save.setOnAction((e)->{
		String newVal = valField.getText();
		String keyName = nameField.getText();
		Property.Type t = typeBox.getValue();
		System.out.println(t);
		System.out.println(newVal);
		
		cProp = new Property(keyName, t);
		if(!newProp(cProp, newVal))
			FlashFXUtils.showErrorDialog(this, "Error", "Value is incompatible with property type");
		else close();
	});
	cancel.setOnAction((e)->{
		cProp = null;
		close();
	});
	
	VBox viewerNode = new VBox();
	viewerNode.getChildren().addAll(nameField, valField, typeBox);
	viewerNode.setSpacing(10);
	viewerNode.setAlignment(Pos.CENTER);
	viewerNode.setPadding(new Insets(10, 10, 10, 10));
	HBox buttonNode = new HBox();
	buttonNode.getChildren().addAll(save, cancel);
	buttonNode.setSpacing(10);
	buttonNode.setAlignment(Pos.CENTER_RIGHT);
	buttonNode.setPadding(new Insets(0, 5, 5, 0));
	BorderPane pane = new BorderPane();
	pane.setBottom(buttonNode);
	pane.setCenter(viewerNode);
	setScene(new Scene(pane, 200, 200));
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:55,代码来源:PropertyViewer.java

示例11: createPathTextField

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void createPathTextField() {
    pathTextField = new TextField();
    pathTextField.setPrefWidth(250);
    pathTextField.setPromptText("File path...");
}
 
开发者ID:luisbraganca,项目名称:file-transfer,代码行数:6,代码来源:NetPane.java

示例12: createConsoleTabContent

import javafx.scene.control.TextField; //导入方法依赖的package包/类
private VBox createConsoleTabContent()
{
	//TODO: Connect to backend
	VBox vbox = new VBox(10);
	
	Label title = new Label();
	title.setText("Debug Console (PLPSimCL)");
	title.setFont(Font.font("Arial", FontWeight.NORMAL, 12));
	
	TextArea consoleTextArea = new TextArea();
	consoleTextArea.setMinHeight(400);
	
	HBox interactionLine = new HBox(15);
	
	TextField executeStatement = new TextField();
	executeStatement.setPrefWidth(750);
	
	Button executeButton = new Button("Execute");
	Button clearButton = new Button("Clear");
	
	interactionLine.getChildren().addAll(executeStatement, executeButton, clearButton);
	
	vbox.getChildren().addAll(title, consoleTextArea, interactionLine);
	
	return vbox;
	
	
	
	
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:31,代码来源:CpuWindow.java


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