Search in sources :

Example 1 with ImageView

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();
        }
    });
}
Also used : MouseEvent(javafx.scene.input.MouseEvent) ByteArrayInputStream(java.io.ByteArrayInputStream) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) Pane(javafx.scene.layout.Pane) AnchorPane(javafx.scene.layout.AnchorPane) Main(net.plan99.payfile.gui.Main) DropShadow(javafx.scene.effect.DropShadow) FXML(javafx.fxml.FXML)

Example 2 with ImageView

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();
}
Also used : SosSensor(il.ac.technion.cs.smarthouse.sensors.sos.SosSensor) Button(javafx.scene.control.Button) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 3 with ImageView

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;
}
Also used : ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) StackPane(javafx.scene.layout.StackPane)

Example 4 with ImageView

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);
}
Also used : HBox(javafx.scene.layout.HBox) MalformedURLException(java.net.MalformedURLException) Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) VBox(javafx.scene.layout.VBox) File(java.io.File) URL(java.net.URL)

Example 5 with ImageView

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);
}
Also used : ToggleButton(javafx.scene.control.ToggleButton) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Aggregations

ImageView (javafx.scene.image.ImageView)206 Image (javafx.scene.image.Image)90 Button (javafx.scene.control.Button)45 Label (javafx.scene.control.Label)41 Insets (javafx.geometry.Insets)35 Tooltip (javafx.scene.control.Tooltip)32 VBox (javafx.scene.layout.VBox)29 Scene (javafx.scene.Scene)25 File (java.io.File)24 ChangeListener (javafx.beans.value.ChangeListener)24 Node (javafx.scene.Node)21 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)20 AnchorPane (javafx.scene.layout.AnchorPane)20 Callback (javafx.util.Callback)20 Pane (javafx.scene.layout.Pane)18 GridPane (javafx.scene.layout.GridPane)17 HBox (javafx.scene.layout.HBox)17 StackPane (javafx.scene.layout.StackPane)17 Inject (javax.inject.Inject)17 List (java.util.List)16