Java Reference
In-Depth Information
double canvasWidth = gc.getCanvas().getWidth();
double canvasHeight = gc.getCanvas().getHeight();
gc.fill();
gc.strokeRect(
x,
//x of the upper left
corner
y,
//y of the upper left
corner
canvasWidth, //width of the rectangle
canvasHeight); //height of the rectangle
//gc.setFill(Color.RED);
//gc.setStroke(Color.BLUE);
//gc.setLineWidth(1);
}
}
Next, you will take a look at the sources to create the PrintDialog class, which
contains all of the application's printing logic. When use press the Print button, the dia-
log opens. It contains a handful of nodes that use the JavaFX Print API.
class PrintDialog extends Stage {
public PrintDialog(Stage owner, boolean modality,
String title, Node printNode) {
super();
initOwner(owner);
Modality m = modality
? Modality.APPLICATION_MODAL : Modality.NONE;
initModality(m);
setOpacity(.90);
setTitle(title);
Group root = new Group();
Scene scene = new Scene(root, 450, 150,
Color.WHITE);
setScene(scene);
Search WWH ::




Custom Search