use of javafx.scene.image.ImageView in project TeachingInSimulation by ScOrPiOzzy.
the class DrawingController method addDrawingPreviewBtn.
private void addDrawingPreviewBtn(final Resource resource) {
String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
Image image = new Image(url, 70, 70, true, true);
ImageView view = new ImageView(image);
ToggleButton toggle = new ToggleButton();
toggle.setGraphic(view);
toggle.getStyleClass().add("drawing-btn");
toggle.setUserData(resource);
ContextMenu menu = new ContextMenu();
MenuItem item = new MenuItem(MsgUtil.getMessage("button.delete"));
item.setOnAction(e -> {
AlertUtil.showConfirm(stage, MsgUtil.getMessage("alert.confirmation.data.delete"), resp -> {
if (ButtonType.YES == resp) {
drawings.remove(String.valueOf(resource.getId()));
refresh();
}
});
});
menu.getItems().add(item);
toggle.setContextMenu(menu);
group.getToggles().add(toggle);
btns.getChildren().add(toggle);
}
use of javafx.scene.image.ImageView in project TeachingInSimulation by ScOrPiOzzy.
the class TestReslution2 method start.
@Override
public void start(Stage stage) throws Exception {
final Pane pane = new StackPane();
Scene scene = new Scene(pane, 600, 300);
stage.setScene(scene);
Button b = new Button("Snap");
final ImageView iv = new ImageView();
iv.fitWidthProperty().bind(pane.widthProperty());
iv.fitHeightProperty().bind(pane.heightProperty());
pane.getChildren().add(iv);
pane.getChildren().add(b);
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
doSnap(iv);
display();
}
});
}
});
stage.show();
}
use of javafx.scene.image.ImageView in project OTP2_R6_svaap by JNuutinen.
the class GameBackground method update.
@Override
public void update(double deltaTime) {
if (deltaTime < 100) {
// fiksaa oudon bugin tason alussa
centerImage.setX(centerImage.getX() - (scrollSpeed * deltaTime));
nextHorizontalImage.setX(nextHorizontalImage.getX() - (scrollSpeed * deltaTime));
}
if (centerImage.getImage().getWidth() + centerImage.getX() <= 0) {
ImageView iv = centerImage;
centerImage = nextHorizontalImage;
nextHorizontalImage = iv;
nextHorizontalImage.setX(centerImage.getX() + centerImage.getImage().getWidth());
}
}
use of javafx.scene.image.ImageView in project jgnash by ccavanaugh.
the class JasperViewerDialogController method refresh.
private void refresh() {
final List<Node> children = pagePane.getChildren();
children.clear();
for (int i = 0; i < pageCount.get(); i++) {
try {
final BufferedImage bufferedImage = (BufferedImage) JasperPrintManager.printPageToImage(jasperPrint.get(), i, (float) zoom);
final ImageView imageView = new ImageView(SwingFXUtils.toFXImage(bufferedImage, null));
imageView.setEffect(dropShadow);
children.add(imageView);
} catch (final JRException ex) {
StaticUIMethods.displayException(ex);
}
}
setPageIndex(0);
}
use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class DockTabPaneSkin method clone.
/**
* VERY HACKY - this lets us 'duplicate' Label and ImageView nodes to be used in a
* Tab and the tabs menu at the same time.
*/
private static Node clone(Node n) {
if (n == null) {
return null;
}
if (n instanceof ImageView) {
ImageView iv = (ImageView) n;
ImageView imageview = new ImageView();
imageview.setImage(iv.getImage());
return imageview;
}
if (n instanceof Label) {
Label l = (Label) n;
Label label = new Label(l.getText(), l.getGraphic());
return label;
}
return null;
}
Aggregations