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


Java TextInputDialog.setTitle方法代码示例

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


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

示例1: showLineJumpDialog

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
private void showLineJumpDialog() {
  TextInputDialog dialog = new TextInputDialog();
  dialog.setTitle("Goto Line");
  dialog.getDialogPane().setContentText("Input Line Number: ");
  dialog.initOwner(area.getValue().getScene().getWindow());
  TextField tf = dialog.getEditor();

  int lines = StringUtil.countLine(area.getValue().getText());
  ValidationSupport vs = new ValidationSupport();
  vs.registerValidator(tf, Validator.<String> createPredicateValidator(
      s -> TaskUtil.uncatch(() -> MathUtil.inRange(Integer.valueOf(s), 1, lines)) == Boolean.TRUE,
      String.format("Line number must be in [%d,%d]", 1, lines)));

  dialog.showAndWait().ifPresent(s -> {
    if (vs.isInvalid() == false) {
      area.getValue().moveTo(Integer.valueOf(s) - 1, 0);
    }
  });
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:20,代码来源:StatusBarManager.java

示例2: onTestImportSteamLibraryXML

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/** Test importing games into gamelist from Steam library (.xml file). */
public static void onTestImportSteamLibraryXML() {
    // TODO: ID field should be empty by default in final code.
    //       Leaving 'Stevoisiak' as default ID for testing.

    // TODO: Accept multiple formats for Steam ID.
    //       (ie: gabelogannewell, 76561197960287930, STEAM_0:0:11101,
    //            [U:1:22202], http://steamcommunity.com/id/gabelogannewell/,
    //            http://steamcommunity.com/profiles/76561197960287930/,
    //            http://steamcommunity.com/profiles/[U:1:22202]/)
    //       Convert types with (https://github.com/xPaw/SteamID.php)?
    TextInputDialog steamIdDialog = new TextInputDialog("Stevoisiak");
    steamIdDialog.setTitle("Import library from Steam");
    steamIdDialog.setHeaderText(null);
    steamIdDialog.setContentText("Please enter your steam ID.");

    Optional<String> steamID = steamIdDialog.showAndWait();
    if (steamID.isPresent()) {
        SteamCommunityGameImporter importer = new SteamCommunityGameImporter();
        importer.steamCommunityAddGames(steamID.get());
    }
}
 
开发者ID:Stevoisiak,项目名称:Virtual-Game-Shelf,代码行数:23,代码来源:MainMenuBar.java

示例3: tryToConnect

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * Connects to a server, depending on if it is passworded, the user will be
 * asked to enter a
 * password. If the server is not reachable the user can not connect.
 *
 * @param address
 *            server address
 * @param port
 *            server port
 */
public static void tryToConnect(final String address, final Integer port) {
	try (final SampQuery query = new SampQuery(address, port)) {
		final Optional<String[]> serverInfo = query.getBasicServerInfo();

		if (serverInfo.isPresent() && StringUtility.stringToBoolean(serverInfo.get()[0])) {
			final TextInputDialog dialog = new TextInputDialog();
			dialog.setTitle("Connect to Server");
			dialog.setHeaderText("Enter the servers password (Leave empty if u think there is none).");

			final Optional<String> result = dialog.showAndWait();
			result.ifPresent(password -> GTAController.connectToServer(address, port, password));
		}
		else {
			GTAController.connectToServer(address, port, "");
		}
	}
	catch (final IOException exception) {
		Logging.warn("Couldn't connect to server.", exception);
		showCantConnectToServerError();
	}
}
 
开发者ID:Bios-Marcel,项目名称:ServerBrowser,代码行数:32,代码来源:GTAController.java

示例4: onMouseClickedChangeTitle

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
private void onMouseClickedChangeTitle() {
    LoggerFacade.getDefault().debug(this.getClass(), "On mouse clicked change Title"); // NOI18N

    final TextInputDialog dialog = new TextInputDialog(lTitle.getText());
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.setHeaderText("Change title"); // NOI18N
    dialog.setResizable(Boolean.FALSE);
    dialog.setTitle("AudioClip"); // NOI18N
    
    final Optional<String> result = dialog.showAndWait();
    if (result.isPresent() && !result.get().isEmpty()) {
        lTitle.setText(result.get());
    }
    
    // TODO save to db
}
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:17,代码来源:AudioClipBoxPresenter.java

示例5: onMouseClickedChangeTitle

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
private void onMouseClickedChangeTitle() {
    LoggerFacade.getDefault().debug(this.getClass(), "On mouse clicked change Title"); // NOI18N

    final TextInputDialog dialog = new TextInputDialog(lTitle.getText());
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.setHeaderText("Change title"); // NOI18N
    dialog.setResizable(Boolean.FALSE);
    dialog.setTitle("Topic"); // NOI18N
    
    final Optional<String> result = dialog.showAndWait();
    if (result.isPresent() && !result.get().isEmpty()) {
        lTitle.setText(result.get());
    }
    
    // TODO save to db
}
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:17,代码来源:TopicPresenter.java

示例6: telaQuantidade

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * M�TODO QUE ABRE A TELA PARA INSERIR A QUANTIDADE DE PRODUTOS PARA ATENDER A ENCOMENDA
 * @return Quantidade de produtos para atender a encomenda
 */
public Integer telaQuantidade(){
	TextInputDialog dialog = new TextInputDialog();
	dialog.setTitle("BuyMe");
	dialog.setHeaderText("Atender encomenda");
	dialog.setContentText("Digite a quantidade que deseja atender com essa produ��o: ");

	Optional<String> result = dialog.showAndWait();
	if (result.isPresent()){
		if(Utils.isNumber(result.get())){
			return Integer.parseInt(result.get());
		}else{
			popup.getError("A quantidade deve ser um n�mero!");
	        
	        return 0;
		}
	}else{
		return 0;
	}
}
 
开发者ID:juan0101,项目名称:TG-BUYME,代码行数:24,代码来源:AtenderEncomendaController.java

示例7: actionPerformed

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent event) {
    final SamplesViewer viewer = ((SamplesViewer) getViewer());
    int position = viewer.getSamplesTable().getASelectedColumnIndex();
    String name = null;
    if (position != -1) {
        if (Platform.isFxApplicationThread()) {
            TextInputDialog dialog = new TextInputDialog("Attribute");
            dialog.setTitle("New attribute");
            dialog.setHeaderText("Enter attribute name:");

            Optional<String> result = dialog.showAndWait();
            if (result.isPresent()) {
                name = result.get().trim();
            }
        } else if (javax.swing.SwingUtilities.isEventDispatchThread()) {
            name = JOptionPane.showInputDialog(getViewer().getFrame(), "Enter new attribute name", "Untitled");
        }
    }
    if (name != null)
        execute("new attribute='" + name + "' position=" + position + ";");
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:22,代码来源:NewAttributeCommand.java

示例8: openIntInputDialog

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * show a dialog box to input an integer
 */
public static void openIntInputDialog(String title, String header, String message, int defaultVal, Consumer<Integer> callback) {
	TextInputDialog dialog = new TextInputDialog(""+defaultVal);
	Stage parent = GuiMode.getPrimaryStage(); // owner is null if JavaFX not fully loaded yet
	if(parent != null && parent.getOwner() != null) {
		dialog.initOwner(parent.getOwner());
	}
	dialog.setTitle(title);
	dialog.setHeaderText(header);
	dialog.setContentText(message);

	dialog.showAndWait().ifPresent((text) -> {
		int val = defaultVal;
		try {
			val = Integer.parseInt(text);
		} catch(NumberFormatException ignored) {
		}

		callback.accept(val);
	});
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:24,代码来源:UIUtils.java

示例9: openDoubleInputDialog

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * show a dialog box to input a double
 */
public static void openDoubleInputDialog(String title, String header, String message, double defaultVal, Consumer<Double> callback) {
	TextInputDialog dialog = new TextInputDialog(""+defaultVal);
	Stage parent = GuiMode.getPrimaryStage(); // owner is null if JavaFX not fully loaded yet
	if(parent != null && parent.getOwner() != null) {
		dialog.initOwner(parent.getOwner());
	}
	dialog.setTitle(title);
	dialog.setHeaderText(header);
	dialog.setContentText(message);

	dialog.showAndWait().ifPresent((text) -> {
		double val = defaultVal;
		try {
			val = Double.parseDouble(text);
		} catch(NumberFormatException ignored) {
		}

		callback.accept(val);
	});
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:24,代码来源:UIUtils.java

示例10: dropOnSourcePallet

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
private void dropOnSourcePallet(DragEvent event, int sourcePalletId) {
	event.setDropCompleted(true);
	TextInputDialog addBlocksDialog = new TextInputDialog();
	addBlocksDialog.setTitle("Add Blocks");
	addBlocksDialog.setHeaderText("Enter the amount of blocks you want to add");
	Optional<String> result = addBlocksDialog.showAndWait();
	result.ifPresent(count -> sourcePallets[sourcePalletId] += Integer.parseInt(count));
	
	String stateImagePath;
	if (sourcePallets[sourcePalletId] <= 5) {
		stateImagePath = "images/blocks-almost-empty.png";
	} else if (sourcePallets[sourcePalletId] > 5 && sourcePallets[sourcePalletId] <= 15) {
		stateImagePath = "images/blocks-normal.png";
	} else if (sourcePallets[sourcePalletId] > 15) {
		stateImagePath = "images/blocks-full.png";
	} else {
		stateImagePath = "";
	}
	Image stateImage = new Image(getClass().getResource(stateImagePath).toString());
	((BorderPane) event.getSource()).setCenter(new ImageView(stateImage));
	
	System.out.println(Arrays.toString(sourcePallets));
	event.consume();
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:25,代码来源:TrackManagerController.java

示例11: showTextInput

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * Shows a simple dialog that waits for the user to enter some text.
 * @param message The message is shown in the content text of the dialog.
 * @return The user input
    */
private String showTextInput(String message) {
	TextInputDialog dialog = new TextInputDialog();
	((Stage)dialog.getDialogPane().getScene().getWindow()).getIcons().add(new Image("file:pictures/icon.png"));
	dialog.setTitle("Please input a value");
	dialog.setHeaderText(null);
	dialog.setContentText(message);

	Optional<String> input = dialog.showAndWait();
	if (input.isPresent()) {
		if (!input.get().isEmpty()) {
			return input.get();
		} else {
			new TDDTDialog("alert", "Missing input");
		}
	}
	return "-1";
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:23,代码来源:TDDTDialog.java

示例12: handleFileNewProject

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
@FXML
private void handleFileNewProject(ActionEvent event) {
    TextInputDialog newProjectDialog = new TextInputDialog();
    newProjectDialog.setTitle("Create Project");
    newProjectDialog.setHeaderText("Create new project");
    newProjectDialog.setContentText("Project name:");

    newProjectDialog.showAndWait()
            .ifPresent(r -> {
                Path projectPath = workspaceService.getActiveWorkspace().getWorkingDirectory().resolve(r);
                try {
                    listViewProjects.getItems().add(projectService.create(new ProjectRequest(projectPath)));
                } catch (IOException e) {
                    Alert alert = new Alert(AlertType.ERROR);
                    alert.setTitle("Create project failed");
                    alert.setHeaderText("Failed to create new project.");
                    alert.showAndWait();
                    // TODO nickavv: create custom "stack trace dialog" to show the actual error
                }
            });
}
 
开发者ID:StarChart-Labs,项目名称:corona-ide,代码行数:22,代码来源:MainController.java

示例13: askNameFX

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * Ask for a new building name using TextInputDialog in JavaFX/8
 * @return new name
 */
public String askNameFX(String oldName) {
	String newName = null;
	TextInputDialog dialog = new TextInputDialog(oldName);
	dialog.setTitle(Msg.getString("BuildingPanel.renameBuilding.dialogTitle"));
	dialog.setHeaderText(Msg.getString("BuildingPanel.renameBuilding.dialog.header"));
	dialog.setContentText(Msg.getString("BuildingPanel.renameBuilding.dialog.content"));

	Optional<String> result = dialog.showAndWait();
	//result.ifPresent(name -> {});

	if (result.isPresent()){
	    logger.info("The old building name has been changed to: " + result.get());
		newName = result.get();
	}

	return newName;
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:22,代码来源:BuildingPanel.java

示例14: askNameFX

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
/**
 * Ask for a new building name using TextInputDialog in JavaFX/8
 * @return new name
 */
public String askNameFX(String oldName) {
	String newName = null;
	TextInputDialog dialog = new TextInputDialog(oldName);
	dialog.initOwner(desktop.getMainScene().getStage());
	dialog.initModality(Modality.APPLICATION_MODAL);
	dialog.setTitle(Msg.getString("BuildingPanel.renameBuilding.dialogTitle"));
	dialog.setHeaderText(Msg.getString("BuildingPanel.renameBuilding.dialog.header"));
	dialog.setContentText(Msg.getString("BuildingPanel.renameBuilding.dialog.content"));

	Optional<String> result = dialog.showAndWait();
	//result.ifPresent(name -> {});

	if (result.isPresent()){
	    //logger.info("The settlement name has been changed to : " + result.get());
		newName = result.get();
	}

	return newName;
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:24,代码来源:SettlementTransparentPanel.java

示例15: editValue

import javafx.scene.control.TextInputDialog; //导入方法依赖的package包/类
public void editValue(Optional<String> startValue) {
    TextInputDialog dialog = new TextInputDialog(startValue.orElse(this.getValue()));
    dialog.setTitle("Edit constant block");
    dialog.setHeaderText("Type a Haskell expression");

    Optional<String> result = dialog.showAndWait();

    result.ifPresent(value -> {
        this.setValue(value);
        GhciSession ghci = this.getToplevel().getGhciSession();

        try {
            Type type = ghci.pullType(value, this.getToplevel().getEnvInstance());
            this.output.setExactRequiredType(type);
            this.hasValidValue = true;
            this.outputSpace.setVisible(true);
        } catch (HaskellException e) {
            this.hasValidValue = false;
            this.outputSpace.setVisible(false);
        }
        
        this.initiateConnectionChanges();
    });
}
 
开发者ID:viskell,项目名称:viskell,代码行数:25,代码来源:ConstantBlock.java


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