use of javafx.scene.image.ImageView in project PayFile by mikehearn.
the class ClickableBitcoinAddress method showQRCode.
@FXML
protected void showQRCode(MouseEvent event) {
// Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
// lazy tonight.
final byte[] imageBytes = QRCode.from(uri()).withSize(320, 240).to(ImageType.PNG).stream().toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
ImageView view = new ImageView(qrImage);
view.setEffect(new DropShadow());
// Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
// Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
// non-centered on the screen. Finally fade/blur it in.
Pane pane = new Pane(view);
pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
view.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
overlay.done();
}
});
}
use of javafx.scene.image.ImageView in project Smartcity-Smarthouse by TechnionYP5777.
the class SosSensorSimulator method start.
@Override
public void start(final Stage s) throws Exception {
sensor = new SosSensor(Random.sensorId(), 40001);
for (boolean res = false; !res; ) res = sensor.register();
final Image sosImage = new Image(getClass().getResourceAsStream("/sensors/sos/sos_icon.png"), 320, 0, true, true);
final Button sosButton = new Button();
sosButton.setId("sosButton");
sosButton.setGraphic(new ImageView(sosImage));
sosButton.setStyle("-fx-focus-color: transparent;");
sosButton.setOnAction(event -> sensor.updateSystem());
final StackPane layout = new StackPane();
layout.getChildren().add(sosButton);
s.setScene(new Scene(layout, 320, 268));
s.setTitle("SOS Sensor Simulator");
s.show();
}
use of javafx.scene.image.ImageView in project Smartcity-Smarthouse by TechnionYP5777.
the class RoomViewController method setImageUrl.
public RoomViewController setImageUrl(final String location) {
image_url = location;
imagePane.getChildren().addAll(new StackPane(new ImageView(new Image(getClass().getResourceAsStream(image_url))), pane));
return this;
}
use of javafx.scene.image.ImageView in project SmartCity-Market by TechnionYP5777.
the class CustomerProductCellFormat method updateItem.
@Override
public void updateItem(CartProduct item, boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setGraphic(null);
setText(null);
return;
}
HBox hbx = new HBox(280);
// spacing = 5
VBox vbx = new VBox(5);
//vbox
Label productName = new Label("Name: " + item.getCatalogProduct().getName());
productName.getStyleClass().add("thisListLabel");
//productName.setFont(new Font(20));
Label productAmount = new Label("Amount: " + item.getTotalAmount());
productAmount.getStyleClass().add("thisListLabel");
//productAmount.setFont(new Font(20));
Label productPrice = new Label("Price: " + Double.valueOf(item.getCatalogProduct().getPrice()) + " nis");
productPrice.getStyleClass().add("thisListLabel");
//productPrice.setFont(new Font(20));
vbx.getChildren().addAll(productName, productAmount, productPrice);
vbx.setAlignment(Pos.CENTER_LEFT);
//image
long itemBarcode = item.getCatalogProduct().getBarcode();
URL imageUrl = null;
try {
imageUrl = new File("../Common/src/main/resources/ProductsPictures/" + itemBarcode + ".jpg").toURI().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException();
}
Image image = new Image(imageUrl + "", 100, 100, true, false);
ImageView productImage = new ImageView(image);
hbx.setSpacing(230);
hbx.getChildren().addAll(vbx, productImage);
setGraphic(hbx);
}
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);
}
Aggregations