Java Reference
In-Depth Information
WritableImage wim = new WritableImage(300, 300);
node.snapshot(null, wim);
ImageView iv = new ImageView();
iv.setImage(wim);
return new PrintDialog(parent, modal, "Printing
Menu", iv);
}
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
Canvas canvas = new Canvas(300, 300);
final GraphicsContext graphicsContext
= canvas.getGraphicsContext2D();
final Button printButton = new Button("Print");
final BooleanProperty printingProperty = new
SimpleBooleanProperty(false);
printButton.setOnAction(actionEvent-> {
printingProperty.set(true);
if (PRINT_DIALOG == null) {
PRINT_DIALOG
= createPrintDialog(primaryStage, true, canvas);
}
PRINT_DIALOG.sizeToScene();
PRINT_DIALOG.show();
});
printButton.setTranslateX(3);
final Button resetButton = new Button("Reset");
resetButton.setOnAction(actionEvent-> {
graphicsContext.clearRect(1, 1,
graphicsContext.getCanvas().getWidth()-2,
graphicsContext.getCanvas().getHeight()-2);
});
resetButton.setTranslateX(10);
Search WWH ::




Custom Search