Java Reference
In-Depth Information
applicationArea.setStrokeWidth(2);
applicationArea.setStroke(Color.rgb(255, 255,
255, .70));
root.getChildren().add(applicationArea);
applicationArea.widthProperty().bind(scene.widthProperty());
applicationArea.heightProperty().bind(scene.heightProperty());
final Group phaseNodes = new Group();
root.getChildren().add(phaseNodes);
// starting initial anchor point
scene.setOnMousePressed((MouseEvent event) -> {
anchorPt = new Point2D(event.getScreenX(),
event.getScreenY());
});
// dragging the entire stage
scene.setOnMouseDragged((MouseEvent event) -> {
if (anchorPt != null && previousLocation !=
null) {
primaryStage.setX(previousLocation.getX()
+ event.getScreenX() - anchorPt.getX());
primaryStage.setY(previousLocation.getY()
+ event.getScreenY() - anchorPt.getY());
}
});
// set the current location
scene.setOnMouseReleased((MouseEvent event) -> {
previousLocation = new
Point2D(primaryStage.getX(), primaryStage.getY());
});
// Dragging over surface
scene.setOnDragOver((DragEvent event) -> {
Dragboard db = event.getDragboard();
if (db.hasFiles()) {
Search WWH ::




Custom Search