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


Java Dragboard.getString方法代码示例

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


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

示例1: targetSetOnDragDropped

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void targetSetOnDragDropped(ScreenMap target, DragEvent e) {
	Dragboard db = e.getDragboard();
	boolean success = false;
	if (e.getDragboard().hasImage()) {
		String imageName = db.getString();
		Point2D point = target.sceneToLocal(e.getSceneX(), e.getSceneY());
		GamePoint gameCoords = new GamePoint(point.getX()/target.getScreenWidth(), point.getY()/target.getScreenHeight());
		for (Pair<String, Image> p : myScreenObjects.keySet()) {
			String iName = p.getKey();
			if (imageName.equals(iName)) {
				XStreamHandler xstream = new XStreamHandler();
				File tempSpriteFile = new File("data/tempSprites/tempSprite.xml");
				xstream.saveToFile(myScreenObjects.get(p), tempSpriteFile);
				SpriteMakerModel xmlSprite = (SpriteMakerModel) xstream.getAttributeFromFile(tempSpriteFile);
				xmlSprite.addComponent(new Position(gameCoords, 0)); //heading 0 because all sprites default to this
				myModel.addBackgroundTile(xmlSprite);
				break;
			}
		}
		success = true;
	}
	e.setDropCompleted(success);
	e.consume();
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:25,代码来源:ScreenObjectHolder.java

示例2: installWidgetsFromString

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
/**
 * @param event The {@link DragEvent} containing the dragged data.
 * @param selection_tracker Used to get the grid steps from its model to be
 *            used in offsetting multiple widgets.
 * @param widgets The container of the created widgets.
 */
private static void installWidgetsFromString (
    final DragEvent event,
    final SelectedWidgetUITracker selection_tracker,
    final List<Widget> widgets
) {

    final Dragboard db = event.getDragboard();
    final String xmlOrText = db.getString();

    try {
        widgets.addAll(ModelReader.parseXML(xmlOrText).getChildren());
    } catch ( Exception ex ) {
        installWidgetsFromString(event, xmlOrText, selection_tracker, widgets);
    }

}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:23,代码来源:WidgetTransfer.java

示例3: handleDragDroppedAction

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
/**
 * handleDragDroppedAction() method.
 *
 * @param argEvent the event handled
 */
@FXML
protected final void handleDragDroppedAction(final DragEvent argEvent) {
    final Dragboard board = argEvent.getDragboard();
    boolean success = false;
    if (board.hasString()) {
        final TreeView target = (TreeView) argEvent.getSource();
        @SuppressWarnings("unchecked") final TreeItem<String> tmp = new TreeItem(board.getString());
        //noinspection unchecked
        target.getRoot().getChildren().add(tmp);
        success = true;
    }
    argEvent.setDropCompleted(success);
    argEvent.consume();
    LOG.info("Drag dropped");
}
 
开发者ID:yeamanan,项目名称:ProjectTwo,代码行数:21,代码来源:SurvivorEditorController.java

示例4: onCaretPosition

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
static void onCaretPosition(TextInputControl textinput,
		Dragboard dragboard) {
	int caret = textinput.getCaretPosition();
	String insert = dragboard.getString();
	
	String t1 = textinput.getText().substring(0, textinput.getCaretPosition());
	String t2 = textinput.getText().substring(textinput.getCaretPosition(), textinput.getText().length());
	textinput.setText(t1 + insert + t2);
	textinput.positionCaret(caret + insert.length());
}
 
开发者ID:coalang-soft,项目名称:dragdropfx,代码行数:11,代码来源:DnDTextInput.java


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