Java Examples for javafx.scene.image.ImageView

The following java examples will help you to understand the usage of javafx.scene.image.ImageView. These source code samples are taken from different open source projects.

Example 1
Project: downlords-faf-client-master  File: ReplayVaultController.java View source code
private TreeTableCell<ReplayInfoBean, String> mapCellFactory(TreeTableColumn<ReplayInfoBean, String> column) {
    final ImageView imageVew = fxmlLoader.loadAndGetRoot("map_preview_table_cell.fxml", this);
    TreeTableCell<ReplayInfoBean, String> cell = new TreeTableCell<ReplayInfoBean, String>() {

        @Override
        protected void updateItem(String mapName, boolean empty) {
            super.updateItem(mapName, empty);
            if (empty || mapName == null) {
                setText(null);
                setGraphic(null);
            } else {
                imageVew.setImage(mapService.loadSmallPreview(mapName));
                setGraphic(imageVew);
                setText(mapName);
            }
        }
    };
    cell.setGraphic(imageVew);
    return cell;
}
Example 2
Project: Starbound-Mod-Manager-master  File: SettingsView.java View source code
protected void build() {
    root = new VBox();
    root.setSpacing(15);
    gamePathTitle = new Label();
    gamePathTitle.setId("settings-view-text-large");
    gamePathTitle.setTranslateX(10);
    gamePathTitle.setAlignment(Pos.TOP_LEFT);
    gamePathTitle.setPrefHeight(25);
    gamePathField = new TextField();
    gamePathField.setPrefHeight(37);
    gamePathField.prefWidthProperty().bind(root.widthProperty().subtract(56));
    gamePathButton = new Button();
    gamePathButton.setId("settings-path-button");
    gamePathButton.setPrefHeight(37);
    gamePathButton.setPrefWidth(36);
    gamePathButton.setGraphic(new ImageView(new Image(SettingsView.class.getClassLoader().getResourceAsStream("folder-icon.png"))));
    GridPane gamePathContainer = new GridPane();
    gamePathContainer.add(gamePathTitle, 1, 1);
    gamePathContainer.add(gamePathField, 1, 2);
    gamePathContainer.add(gamePathButton, 2, 2);
    modsPathTitle = new Label();
    modsPathTitle.setId("settings-view-text-large");
    modsPathTitle.setTranslateX(10);
    modsPathTitle.setAlignment(Pos.TOP_LEFT);
    modsPathTitle.setPrefHeight(25);
    modsPathField = new TextField();
    modsPathField.setPrefHeight(37);
    modsPathField.prefWidthProperty().bind(root.widthProperty().subtract(56));
    modsPathButton = new Button();
    modsPathButton.setId("settings-path-button");
    modsPathButton.setPrefHeight(37);
    modsPathButton.setPrefWidth(36);
    modsPathButton.setGraphic(new ImageView(new Image(SettingsView.class.getClassLoader().getResourceAsStream("folder-icon.png"))));
    GridPane modInstallPathContainer = new GridPane();
    modInstallPathContainer.add(modsPathTitle, 1, 1);
    modInstallPathContainer.add(modsPathField, 1, 2);
    modInstallPathContainer.add(modsPathButton, 2, 2);
    ObservableList<Language> languageOptions = FXCollections.observableArrayList(localizer.getLanguages());
    languageSelector = new ComboBox<>(languageOptions);
    languageSelector.setValue(localizer.getCurrentLanguage());
    languageSelector.setFocusTraversable(false);
    languageSelector.setPrefWidth(300);
    languageSelector.setPrefHeight(37);
    openLogButton = new Button();
    openLogButton.setId("settings-standalone-button");
    openLogButton.setGraphic(new ImageView(new Image(SettingsView.class.getClassLoader().getResourceAsStream("log-icon.png"))));
    openLogButton.setPrefHeight(37);
    openLogButton.setGraphicTextGap(10);
    openLogButton.setAlignment(Pos.CENTER);
    ObservableList<Level> loggerLevelOptions = FXCollections.observableArrayList(Level.OFF, Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG, Level.TRACE);
    HBox loggerLevelContainer = new HBox();
    loggerLevelContainer.setAlignment(Pos.CENTER_LEFT);
    loggerLevelContainer.setSpacing(15);
    loggerLevelSelector = new ComboBox<>(loggerLevelOptions);
    loggerLevelSelector.setValue(settings.getPropertyLevel("loggerlevel"));
    loggerLevelSelector.setPrefWidth(183);
    loggerLevelSelector.setPrefHeight(37);
    loggerLevelSelector.setFocusTraversable(false);
    loggerLevelTitle = new Label();
    loggerLevelTitle.setId("settings-view-text-large");
    loggerLevelContainer.getChildren().addAll(loggerLevelTitle, loggerLevelSelector, openLogButton);
    HBox checkVersionContainer = new HBox();
    checkVersionBox = new CheckBox();
    checkVersionTitle = new Text();
    checkVersionContainer.getChildren().addAll(checkVersionBox, checkVersionTitle);
    HBox backupSavesOnLaunchContainer = new HBox();
    backupSavesOnLaunchBox = new CheckBox();
    backupSavesOnLaunchTitle = new Text();
    backupSavesOnLaunchContainer.getChildren().addAll(backupSavesOnLaunchBox, backupSavesOnLaunchTitle);
    HBox confirmButtonDelayContainer = new HBox();
    confirmButtonDelayContainer.setAlignment(Pos.CENTER_LEFT);
    confirmButtonDelayContainer.setSpacing(15);
    confirmButtonDelayField = new NumericTextField();
    confirmButtonDelayField.setId("fully-rounded-input");
    confirmButtonDelayField.setPrefHeight(37);
    confirmButtonDelayField.setPrefWidth(43);
    confirmButtonDelayTitle = new Label();
    confirmButtonDelayTitle.setId("settings-view-text-large");
    confirmButtonDelayContainer.getChildren().addAll(confirmButtonDelayField, confirmButtonDelayTitle);
    root.getChildren().addAll(gamePathContainer, modInstallPathContainer, languageSelector, loggerLevelContainer, //backupSavesOnLaunchContainer,
    confirmButtonDelayContainer);
    createListeners();
    updateStrings();
    updateColors();
}
Example 3
Project: Augendiagnose-master  File: EyePhotoPairNode.java View source code
/**
	 * Get the image view for a thumbnail.
	 *
	 * @param eyePhoto
	 *            The eye photo to be displayed.
	 * @return The image view.
	 */
private ImageView getImageView(final EyePhoto eyePhoto) {
    Image image = eyePhoto.getImage(Resolution.THUMB);
    image.progressProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(final ObservableValue<? extends Number> observable, final Number oldValue, final Number newValue) {
            if (newValue.doubleValue() == 1) {
                checkIfImagesLoaded();
            }
        }
    });
    ImageView imageView = new ImageView(image);
    imageView.setPreserveRatio(true);
    imageView.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(final MouseEvent event) {
            if (PreferenceUtil.getPreferenceBoolean(PreferenceUtil.KEY_SHOW_SPLIT_WINDOW) && !MainController.getInstance().isSplitPane()) {
                MainController.getInstance().setSplitPane(FxmlConstants.FXML_DISPLAY_PHOTOS);
            }
            DisplayImageHolderController controller = (DisplayImageHolderController) FxmlUtil.displaySubpage(FxmlConstants.FXML_DISPLAY_IMAGE_HOLDER, mParentController.getPaneIndex(), true);
            controller.setEyePhoto(eyePhoto);
        }
    });
    // Ensure that height is adapted to image width.
    imageView.fitHeightProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(final ObservableValue<? extends Number> observable, final Number oldValue, final Number newValue) {
            switch(eyePhoto.getRightLeft()) {
                case RIGHT:
                    mHeightRight = newValue.doubleValue();
                    break;
                case LEFT:
                    mHeightLeft = newValue.doubleValue();
                    break;
                default:
            }
            setPrefHeight(Math.max(mHeightLeft, mHeightRight));
            Platform.runLater(new Runnable() {

                @Override
                public void run() {
                    requestParentLayout();
                }
            });
        }
    });
    return imageView;
}
Example 4
Project: bgfinancas-master  File: Splash.java View source code
@Override
public void start(Stage stage) throws Exception {
    palco = stage;
    palco.initStyle(StageStyle.UNDECORATED);
    ImageView splash = new ImageView(new Image("/badernageral/bgfinancas/recursos/imagem/layout/splash.gif"));
    VBox layout = new VBox(20);
    layout.getChildren().add(splash);
    Scene scene = new Scene(layout);
    palco.setWidth(300);
    palco.setHeight(220);
    palco.setScene(scene);
    palco.show();
}
Example 5
Project: closurefx-builder-master  File: ClosureFXController.java View source code
private void openNewTab(File file, Closure closure) {
    final Document document = new Document(file);
    document.setClosure(closure);
    document.setBundle(bundle);
    document.setName(getNewName(file));
    boolean result = documentManager.addDocument(document);
    // if file is already open
    if (!result) {
        Tab existedTab = docTabPane.getTabs().get(documentManager.getIndex(document));
        docTabPane.getSelectionModel().select(existedTab);
        tooltipManager.addTooltip(new Status(StatusType.WARNING, bundle.getString(IConstants.TooltipMsg_DocumentExist), null));
    } else {
        // MAKE NEW TAB
        final Tab tab = new Tab(document.getName());
        tab.setClosable(false);
        tab.setGraphic(new ImageView(ResourceUtils.CLOSURE_ICON));
        tab.setTooltip(new Tooltip(getTooltip(file)));
        document.nameProperty().addListener(new ChangeListener<String>() {

            @Override
            public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                tab.setText(newValue);
            }
        });
        // document.dirtyProperty().addListener(new
        // ChangeListener<Boolean>() {
        // @Override
        // public void changed(
        // ObservableValue<? extends Boolean> observable,
        // Boolean oldValue, Boolean newValue) {
        // if (newValue) {
        // tab.getStyleClass().add(IConstants.CSS_TAB_BOLD);
        // } else {
        // tab.getStyleClass().add(IConstants.CSS_TAB_NORMAL);
        // }
        // }
        // });
        // CLOSURE EDITOR
        TabPane editor = document.load();
        Button closeButton = new Button();
        closeButton.setGraphic(new ImageView(ResourceUtils.BUTTON_CLOSE));
        closeButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
        closeButton.getStyleClass().addAll(IConstants.CSS_INVISIBLE_BUTTON, IConstants.CSS_CLOSE_BUTTON);
        // Handler for the close button.
        closeButton.setOnMouseReleased(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent paramT) {
                closeTab(tab, document);
            }
        });
        tab.setGraphic(closeButton);
        if (editor != null) {
            editor.setMinHeight(Control.USE_COMPUTED_SIZE);
            editor.setMinWidth(Control.USE_COMPUTED_SIZE);
            editor.setPrefHeight(Control.USE_COMPUTED_SIZE);
            editor.setPrefWidth(Control.USE_COMPUTED_SIZE);
            editor.setMaxHeight(1.7976931348623157E308);
            editor.setPrefWidth(Control.USE_COMPUTED_SIZE);
            HBox.setHgrow(editor, Priority.ALWAYS);
            VBox.setVgrow(editor, Priority.ALWAYS);
            VBox pane = new VBox();
            pane.setMinHeight(Control.USE_COMPUTED_SIZE);
            pane.setMinWidth(Control.USE_COMPUTED_SIZE);
            pane.setPrefHeight(Control.USE_COMPUTED_SIZE);
            pane.setPrefWidth(Control.USE_COMPUTED_SIZE);
            pane.setMaxHeight(Control.USE_COMPUTED_SIZE);
            pane.setMinHeight(Control.USE_COMPUTED_SIZE);
            pane.getChildren().add(editor);
            tab.setContent(pane);
        }
        docTabPane.getTabs().add(tab);
        docTabPane.getSelectionModel().select(tab);
    }
}
Example 6
Project: CSTIB-Echo-master  File: avitarCellFactory.java View source code
@Override
public void updateItem(Object item, boolean empty) {
    super.updateItem(item, empty);
    if (!isEmpty()) {
        cellContents = new GridPane();
        User user = (User) item;
        String dispName;
        if (user.getUsername() == null)
            dispName = "Anonymous";
        else if (user.getDisplayName() != null)
            dispName = user.getDisplayName();
        else
            dispName = user.getUsername();
        name = new Text(dispName);
        name.setWrappingWidth(50);
        avitar = new ImageView();
        avitar.setFitHeight(50);
        avitar.setFitWidth(50);
        avitar.setImage(user.getAvatarLink() == null ? new Image("http://www.gravatar.com/avatar/") : new Image(user.getAvatarLink()));
        cellContents.add(avitar, 0, 0);
        cellContents.add(name, 0, 1);
        setGraphic(cellContents);
        this.setDisable(true);
    }
}
Example 7
Project: e-fx-clipse-master  File: MediaPropertiesView.java View source code
@PostConstruct
void init(BorderPane pane) {
    VBox box = new VBox();
    GridPane mediaProperties = new GridPane();
    EMFDataBindingContext dbc = new EMFDataBindingContext();
    {
        Label l = new Label("Title");
        mediaProperties.add(l, 0, 0);
        TextField f = new TextField();
        IEMFValueProperty mProp = EMFProperties.value(MEDIA__TITLE);
        IJFXBeanValueProperty tProp = JFXBeanProperties.value("text");
        dbc.bindValue(tProp.observe(f), mProp.observeDetail(currentSelection));
        mediaProperties.add(f, 1, 0);
        GridPane.setHgrow(f, Priority.ALWAYS);
    }
    {
        Label l = new Label("Description");
        mediaProperties.add(l, 0, 1);
        GridPane.setValignment(l, VPos.TOP);
        TextArea area = new TextArea();
        area.setPrefColumnCount(5);
        mediaProperties.add(area, 1, 1);
        GridPane.setHgrow(area, Priority.ALWAYS);
        dbc.bindValue(EMFProperties.value(MEDIA__DESCRIPTION).observeDetail(currentSelection), JFXBeanProperties.value("text").observe(area));
    }
    TitledPane generalProps = new TitledPane("General Properties", mediaProperties);
    box.getChildren().add(generalProps);
    photoAreas = new TableView<PhotoArea>();
    {
        TableColumn<PhotoArea, String> col = new TableColumn<PhotoArea, String>();
        col.setText("Bounds");
        col.setPrefWidth(50);
        {
            TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
            subCol.setText("x");
            subCol.setPrefWidth(20);
            subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {

                @Override
                public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
                    return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__X).observe(param.getValue()));
                }
            });
            col.getColumns().add(subCol);
        }
        {
            TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
            subCol.setText("y");
            subCol.setPrefWidth(20);
            subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {

                @Override
                public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
                    return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__Y).observe(param.getValue()));
                }
            });
            col.getColumns().add(subCol);
        }
        {
            TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
            subCol.setText("width");
            subCol.setPrefWidth(20);
            subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {

                @Override
                public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
                    return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__WIDTH).observe(param.getValue()));
                }
            });
            col.getColumns().add(subCol);
        }
        {
            TableColumn<PhotoArea, Double> subCol = new TableColumn<PhotoArea, Double>();
            subCol.setText("heigth");
            subCol.setPrefWidth(20);
            subCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, Double>, ObservableValue<Double>>() {

                @Override
                public ObservableValue<Double> call(final CellDataFeatures<PhotoArea, Double> param) {
                    return AdapterFactory.adapt(EMFProperties.value(PHOTO_AREA__HEIGHT).observe(param.getValue()));
                }
            });
            col.getColumns().add(subCol);
        }
        photoAreas.getColumns().add(col);
    }
    {
        TableColumn<PhotoArea, String> col = new TableColumn<PhotoArea, String>();
        col.setText("Description");
        col.setMaxWidth(100);
        col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<PhotoArea, String>, ObservableValue<String>>() {

            @Override
            public ObservableValue<String> call(CellDataFeatures<PhotoArea, String> param) {
                //TODO We need to remove the dispose the observable created here
                IObservableValue v = EMFProperties.value(PHOTO_AREA__DESCRIPTION).observe(param.getValue());
                return AdapterFactory.adapt(v);
            }
        });
        col.setCellFactory(new Callback<TableColumn<PhotoArea, String>, TableCell<PhotoArea, String>>() {

            @Override
            public TableCell<PhotoArea, String> call(TableColumn<PhotoArea, String> param) {
                return new EditingCell();
            }
        });
        col.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<PhotoArea, String>>() {

            @Override
            public void handle(CellEditEvent<PhotoArea, String> event) {
                photoAreas.getSelectionModel().getSelectedItem().setDescription(event.getNewValue());
            }
        });
        photoAreas.getColumns().add(col);
    }
    photoAreas.setEditable(true);
    ContextMenu mCtx = new ContextMenu();
    MenuItem mItem = new MenuItem("Remove");
    mItem.setGraphic(new ImageView(new Image(getClass().getClassLoader().getResource("/icons/edit-delete.png").toExternalForm())));
    mItem.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            PhotoArea area = photoAreas.getSelectionModel().getSelectedItem();
            photoAreas.getItems().remove(area);
        }
    });
    mCtx.getItems().add(mItem);
    photoAreas.setContextMenu(mCtx);
    ObservableList<PhotoArea> list = AdapterFactory.adapt(EMFProperties.list(PHOTO__AREAS).observeDetail(currentSelection));
    photoAreas.setItems(list);
    TitledPane areaProps = new TitledPane("Media Area Properties", photoAreas);
    box.getChildren().add(areaProps);
    VBox.setVgrow(areaProps, Priority.ALWAYS);
    pane.setCenter(box);
}
Example 8
Project: Enzo-master  File: Demo.java View source code
@Override
public void start(Stage stage) {
    ImageView imgView = new ImageView(backgroundImage);
    PushButton button1 = PushButtonBuilder.create().status(PushButton.Status.DESELECTED).color(Color.CYAN).prefWidth(128).prefHeight(128).build();
    button1.setOnSelect( selectionEvent -> System.out.println("Select"));
    button1.setOnDeselect( selectionEvent -> System.out.println("Deselect"));
    StackPane pane = new StackPane();
    pane.setPadding(new Insets(10, 10, 10, 10));
    pane.getChildren().setAll(imgView, button1);
    Scene scene = new Scene(pane, 256, 256, Color.rgb(153, 153, 153));
    stage.setTitle("JavaFX PushButton");
    stage.setScene(scene);
    stage.show();
}
Example 9
Project: FxProjects-master  File: Clipboard.java View source code
/**
	 * pasteButton. Helper method to build the SplitMenuButton.
	 */
private void buildPasteButton() {
    // Create button and set text.
    this.pasteButton = new SplitMenuButton();
    this.pasteButton.setText("Paste");
    // Set alignment of button to text.
    this.pasteButton.setContentDisplay(ContentDisplay.TOP);
    // Retrieve and set image of clipboard. I will set image size to 24x24,
    // preserve the ratio and enable smoothing in the Image constructor.
    String imgPath = "/ui/common/images/clipboard.png";
    Image clipboard = new Image(this.getClass().getResourceAsStream(imgPath), 24.0, 24.0, true, true);
    // Create an ImageView for showing image.
    ImageView imageView = new ImageView(clipboard);
    // Set the gap b/n graphic and text. Assign the ImageView to the button.
    this.pasteButton.setGraphicTextGap(5.0);
    this.pasteButton.setGraphic(imageView);
    // Paste Menu Item
    MenuItem mnuPaste = new MenuItem("Paste");
    mnuPaste.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Paste clicked.");
        }
    });
    // Paste Special Menu Item
    MenuItem mnuPasteSpecial = new MenuItem("Paste Special...");
    mnuPasteSpecial.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Paste Special clicked.");
        }
    });
    // Paste As Hyperlink Menu Item
    MenuItem mnuPasteHyperlink = new MenuItem("Paste as Hyperlink");
    mnuPasteHyperlink.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Paste as Hyperlink clicked.");
        }
    });
    // Add all MenuItems to the MenuSplitButton's menu options.
    this.pasteButton.getItems().addAll(mnuPaste, mnuPasteSpecial, mnuPasteHyperlink);
    // Set the click event of the Button itself. Note that the JavaDocs
    // points out that MenuItem click events are not transferred to the
    // Buttons click event. So button doesnt reflect the last menu option
    // selected in the drop down portion of the SplitMenuButton.
    this.pasteButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            System.out.println("Button Clicked.");
        }
    });
}
Example 10
Project: itol-master  File: AddAttachmentMenu.java View source code
@SuppressWarnings("unchecked")
private void makeMenuItemsForClipboardFiles(List<MenuItem> menuItems) {
    try {
        Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
        if (transferable != null) {
            java.awt.Image clipboardImage = null;
            if (transferable != null && transferable.isDataFlavorSupported(DataFlavor.imageFlavor)) {
                clipboardImage = (java.awt.Image) transferable.getTransferData(DataFlavor.imageFlavor);
            }
            List<File> clipboardFiles = null;
            if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                clipboardFiles = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
            }
            if (clipboardImage != null || (clipboardFiles != null && !clipboardFiles.isEmpty())) {
                CustomMenuItem miSeparatorCliboard = makeSeparator("bnAddAttachment.menu.clipboard");
                menuItems.add(miSeparatorCliboard);
                if (clipboardImage != null) {
                    BufferedImage thumbnailImage = ThumbnailHelper.makeThumbnailImage(clipboardImage);
                    Image image = SwingFXUtils.toFXImage((BufferedImage) thumbnailImage, null);
                    CustomMenuItem miImage = new CustomMenuItem(new ImageView(image));
                    miImage.setOnAction(( e) -> {
                        List<Attachment> attachments = AttachmentTableViewHandler.paste(observableAttachments);
                        for (Attachment attachment : attachments) onAddAttachment.apply(attachment);
                    });
                    menuItems.add(miImage);
                }
                if (clipboardFiles != null) {
                    int nbOfFiles = clipboardFiles.size();
                    if (nbOfFiles == 1) {
                        makeBnAddAttachmentMenuItemsFiles(menuItems, clipboardFiles);
                    } else {
                        MenuItem mi = new MenuItem();
                        String miText;
                        try {
                            miText = MessageFormat.format(resb.getString("bnAddAttachment.menu.pasteNbOfFiles"), nbOfFiles);
                        } catch (Exception e) {
                            miText = "Paste " + nbOfFiles + " files";
                        }
                        mi.setText(miText);
                        mi.setOnAction(( e) -> {
                            List<Attachment> attachments = AttachmentTableViewHandler.paste(observableAttachments);
                            for (Attachment attachment : attachments) onAddAttachment.apply(attachment);
                        });
                        menuItems.add(mi);
                    }
                }
            }
        }
    } catch (Exception e) {
        log.log(Level.WARNING, "Failed to access clipboard.", e);
    }
}
Example 11
Project: JacpFX-demos-master  File: ChatMessageRight.java View source code
private void initLayout() {
    Text messageText = new Text(message);
    HBox.setMargin(messageText, new Insets(20, 45, 0, 0));
    VBox userView = new VBox();
    HBox.setMargin(userView, new Insets(0, 10, 0, 0));
    ImageView imageView = new ImageView(new Image("/images/user.png", 55, 55, false, false));
    imageView.setFitHeight(60);
    imageView.setFitWidth(60);
    userView.setAlignment(Pos.CENTER);
    Text nameText = new Text(name);
    VBox.setVgrow(nameText, Priority.ALWAYS);
    userView.getChildren().addAll(imageView, nameText);
    getChildren().addAll(messageText, userView);
}
Example 12
Project: JFXMaterial-master  File: ActionBar.java View source code
public void setTitle(String title) {
    materialText.setText(title);
    materialText.setFill(Color.WHITE);
    materialText.setLayoutX(50);
    materialText.setLayoutY(30);
    ImageView imageMenu = new ImageView(new Image(getClass().getResourceAsStream("assets/menu.png")));
    ImageView imagePrevious = new ImageView(new Image(getClass().getResourceAsStream("assets/previous.png")));
    imagePrevious.setScaleX(0.6);
    imagePrevious.setScaleY(0.6);
    imageMenu.setScaleX(0.6);
    imageMenu.setScaleY(0.6);
    imagePrevious.setRotate(+90);
    imageMenu.setOpacity(1);
    imagePrevious.setOpacity(0);
    pane = new Pane(imagePrevious, imageMenu);
    TabTitle item = new TabTitle(pane);
    getChildren().addAll(materialText, item);
    rotateTransition.setCycleCount(1);
    rotateTransition.setDuration(Duration.millis(500));
    pane.rotateProperty().addListener(( observable,  oldValue,  newValue) -> {
        imageMenu.setOpacity(1.0 + newValue.doubleValue() / 90.0);
        imagePrevious.setOpacity(-newValue.doubleValue() / 90.0);
    });
    item.addEventHandler(MouseEvent.MOUSE_CLICKED,  e -> {
        if (e.getButton() == MouseButton.PRIMARY) {
            if (isAnimationFinished) {
                if (!drawerOpen) {
                    rotateTransition.setNode(pane);
                    rotateTransition.setByAngle(-90);
                    isAnimationFinished = false;
                    rotateTransition.setOnFinished( ev -> {
                        isAnimationFinished = true;
                        drawerLayout.setDrawerOpen(true);
                        drawerOpen = true;
                    });
                    drawerLayout.startOpenAnimation(false);
                } else {
                    rotateTransition.setByAngle(90);
                    isAnimationFinished = false;
                    rotateTransition.setOnFinished( ev -> {
                        isAnimationFinished = true;
                        drawerOpen = false;
                        drawerLayout.setDrawerOpen(false);
                    });
                    drawerLayout.startOpenAnimation(true);
                }
                rotateTransition.play();
            }
        }
    });
}
Example 13
Project: mephisto_iii-master  File: StreamsUI.java View source code
/**
   * Only create the UI, using the initial stream as default which is also
   * played at the start of the radio UI.
   *
   * @param parent
   * @param stream the initially activated stream.
   */
private void createUI(ControllablePanel parent, Stream stream) {
    setMinWidth(Mephisto3.WIDTH);
    VBox labelBox = new VBox(20);
    labelBox.getStyleClass().add("streams-panel");
    labelBox.setMinHeight(Mephisto3.HEIGHT - 60);
    labelBox.setAlignment(Pos.TOP_LEFT);
    getChildren().add(labelBox);
    getChildren().add(serviceScroller);
    labelBox.setPadding(new Insets(20, 30, 30, 30));
    artistBackgroundImageView = new ImageView();
    ColorAdjust brightness = new ColorAdjust();
    brightness.setBrightness(-0.3);
    artistBackgroundImageView.setEffect(brightness);
    parent.getChildren().add(artistBackgroundImageView);
    nameLabel = ComponentUtil.createLabel(stream.getName(), "stream-name", labelBox);
    HBox artistLabelBox = new HBox();
    artistLabelBox.setMaxHeight(28);
    artistLabel = ComponentUtil.createLabel(LOADING_DATA_TITLE, "stream-artist", artistLabelBox);
    labelBox.getChildren().add(artistLabelBox);
    metaDataBusyIndicator = new ProgressIndicator();
    artistLabelBox.getChildren().add(metaDataBusyIndicator);
    titleLabel = ComponentUtil.createLabel("", "stream-title", labelBox);
    HBox spacer = new HBox();
    spacer.setMinHeight(70);
    labelBox.getChildren().add(spacer);
    imageLoader = new HBox();
    imageLoader.setOpacity(0);
    imageLoader.setMinHeight(20);
    imageLoader.setMaxWidth(Mephisto3.WIDTH);
    imageLoader.setAlignment(Pos.CENTER_RIGHT);
    labelBox.getChildren().add(imageLoader);
    ComponentUtil.createLabel("Suche nach Bildern...", "", imageLoader);
    imageDataBusyIndicator = new ProgressIndicator();
    imageLoader.getChildren().add(imageDataBusyIndicator);
    playerStatusBox = new StreamStatusBox();
    getChildren().add(playerStatusBox);
    //set the initial UI state
    playerStatusBox.updateStatus(stream.getName(), null, null);
}
Example 14
Project: metastone-master  File: HeroToken.java View source code
private void updateSecrets(Player player) {
    secretsAnchor.getChildren().clear();
    HashSet<String> secretsCopy = new HashSet<String>(player.getSecrets());
    for (String secretId : secretsCopy) {
        Card card = CardCatalogue.getCardById(secretId);
        ImageView secretIcon = null;
        if (card instanceof QuestCard) {
            secretIcon = new ImageView(IconFactory.getImageUrl("common/quest.png"));
        } else {
            secretIcon = new ImageView(IconFactory.getImageUrl("common/secret.png"));
        }
        secretsAnchor.getChildren().add(secretIcon);
        if (!player.hideCards() || card instanceof QuestCard) {
            Tooltip tooltip = new Tooltip();
            CardTooltip tooltipContent = new CardTooltip();
            tooltipContent.setCard(card);
            tooltip.setGraphic(tooltipContent);
            Tooltip.install(secretIcon, tooltip);
        }
    }
}
Example 15
Project: PeerWasp-master  File: SyncTreeItem.java View source code
private void updateIconInUIThread(ImageView icon) {
    javafx.application.Platform.runLater(new Runnable() {

        @Override
        public void run() {
            if (getGraphic() != null && getGraphic() instanceof Label) {
                Label oldLabel = (Label) getGraphic();
                oldLabel.setGraphic(icon);
                setGraphic(oldLabel);
            } else {
                Label newLabel = new Label(getValue().getPath().getFileName().toString());
                newLabel.setGraphic(icon);
                setGraphic(newLabel);
            }
        }
    });
}
Example 16
Project: pieShare-master  File: LoginController.java View source code
/**
     * Initializes the controller class.
     */
@Override
public void initialize(URL url, ResourceBundle rb) {
    animation = beanService.getBean(SpinAnimation.class);
    animation.setNode(labelWaitIcon);
    InputStream stDelete = getClass().getResourceAsStream("/images/wait_24.png");
    Image imageDelete = new Image(stDelete);
    labelWaitIcon.setText("");
    labelWaitIcon.setGraphic(new ImageView(imageDelete));
    labelWaitIcon.setVisible(false);
    labelWaitIcon.setDisable(true);
    PieUser user = beanService.getBean(PieShareAppBeanNames.getPieUser());
    if (user.getCloudName() != null) {
        userNameField.setText(user.getCloudName());
        userNameField.disableProperty().set(true);
    }
    if (user.hasPasswordFile()) {
        passwordFieldRepeat.setVisible(false);
        additionalOptionsPane.getChildren().clear();
    } else {
        try {
            additionalOptionsPane.setCenter(basePreferencesController.getControl());
        } catch (IOException ex) {
            PieLogger.error(this.getClass(), "Error setting BasePreferences Control", ex);
        }
    }
}
Example 17
Project: RegexGolf2-master  File: WordCellUI.java View source code
private void initComponents() {
    _outOfSynchIndicator = new ImageView();
    _outOfSynchIndicator.setImage(new Image("/regexgolf2/ui/img/warning.png"));
    _outOfSynchIndicator.setFitHeight(16);
    _outOfSynchIndicator.setPreserveRatio(true);
    _changedIndicator = new Label("*");
    _changedIndicator.setFont(new Font(16.0));
}
Example 18
Project: SmartModInserter-master  File: SavesTabController.java View source code
@Override
protected void updateItem(Save save, boolean empty) {
    Runnable r = () -> {
        super.updateItem(save, empty);
        if (!empty) {
            setText(null);
            GridPane pane = new GridPane();
            pane.setHgap(10);
            pane.setVgap(4);
            pane.setPadding(new Insets(0, 10, 0, 10));
            ImageView screenshot = new ImageView(save.getScreenshot());
            screenshot.setPreserveRatio(true);
            screenshot.setFitWidth(75);
            pane.add(screenshot, 0, 0, 1, 2);
            Label name = new Label(save.getName());
            Label fileName = new Label(save.getPath().getFileName().toString());
            pane.add(name, 1, 0, 1, 1);
            pane.add(fileName, 1, 1, 1, 1);
            setGraphic(pane);
        }
    };
    if (Platform.isFxApplicationThread()) {
        r.run();
    } else {
        Platform.runLater(r);
    }
}
Example 19
Project: Trydent-master  File: Sprite.java View source code
private void initImageView(double duration) {
    currentView = new ImageView(images[0]);
    if (duration > 0) {
        new ContinuousEvent() {

            @Override
            public void onUpdate() {
                int index = (int) (Time.getTime() / duration) % images.length;
                currentView.setImage(images[index]);
            }
        };
    }
    getFxNode().getChildren().add(currentView);
}
Example 20
Project: youtrack-worklog-viewer-master  File: TaskStatusTreeTableColumn.java View source code
@Override
protected void updateItem(Optional<LocalDateTime> item, boolean empty) {
    super.updateItem(item, empty);
    setText(StringUtils.EMPTY);
    if (empty || !item.isPresent()) {
        setGraphic(null);
        setTooltip(null);
    } else {
        LOGGER.debug("Setting graphic on column with a resolved date");
        setGraphic(new ImageView("/fx/img/accept.png"));
        setTooltip(new Tooltip(FormattingUtil.formatDateTime(item.get())));
    }
}
Example 21
Project: AIGS-master  File: MinesweeperPane.java View source code
/**
     * Draws the new image in JavaFX by invoking.<br>This method is needed because the program will crash if an existing part of a window element is changed without invoking.
     * @param imageView The ImageView object (field on board) to change
     * @param image The new image object
     * @since Version 1.1 (Raphael Stoeckli)
     */
public void setImage(ImageView imageView, Image image) {
    // IMPORTANT - Invoking!
    // This code is needed by JavaFX. If an image is changed outside of Platform.runLater, the programm will crash!
    Platform.runLater(new Runnable() {

        @Override
        public void run() {
            imageView.setImage(image);
        }
    });
}
Example 22
Project: bitcoin-exchange-master  File: OpenOffersView.java View source code
@Override
public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
    return new TableCell<OpenOfferListItem, OpenOfferListItem>() {

        final ImageView iconView = new ImageView();

        final Button button = new Button();

        {
            iconView.setId("image-remove");
            button.setText("Remove");
            button.setGraphic(iconView);
            button.setMinWidth(70);
        }

        @Override
        public void updateItem(final OpenOfferListItem item, boolean empty) {
            super.updateItem(item, empty);
            if (item != null) {
                button.setOnAction( event -> onRemoveOpenOffer(item.getOpenOffer()));
                setGraphic(button);
            } else {
                setGraphic(null);
            }
        }
    };
}
Example 23
Project: bitsquare-master  File: OpenOffersView.java View source code
@Override
public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
    return new TableCell<OpenOfferListItem, OpenOfferListItem>() {

        final ImageView iconView = new ImageView();

        final Button button = new Button();

        {
            iconView.setId("image-remove");
            button.setText("Remove");
            button.setGraphic(iconView);
            button.setMinWidth(70);
        }

        @Override
        public void updateItem(final OpenOfferListItem item, boolean empty) {
            super.updateItem(item, empty);
            if (item != null) {
                button.setOnAction( event -> onRemoveOpenOffer(item.getOpenOffer()));
                setGraphic(button);
            } else {
                setGraphic(null);
            }
        }
    };
}
Example 24
Project: blackmarket-master  File: Dialogs.java View source code
public static void showExceptionDialog(Throwable throwable) {
    Alert alert = new Alert(AlertType.ERROR);
    alert.setTitle("Sorry something wrong happened");
    String header = throwable.getMessage();
    header = isBlank(header) ? throwable.getClass().getSimpleName() : header;
    alert.setHeaderText(header);
    //		alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-"
    //				+ comics[RandomUtils.nextInt(0, 3)] +
    //				".png")));
    alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-sad.png")));
    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    throwable.printStackTrace(pw);
    String exceptionText = sw.toString();
    StringBuilder sb = new StringBuilder();
    //		sb.append("Error Message: ");
    //		sb.append(System.lineSeparator());
    //		sb.append(throwable.getMessage());
    sb.append("The exception stacktrace was:");
    sb.append(System.lineSeparator());
    sb.append(exceptionText);
    TextArea textArea = new TextArea(sb.toString());
    textArea.setEditable(false);
    textArea.setWrapText(false);
    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(150);
    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(textArea);
    alert.getDialogPane().setExpanded(true);
    alert.showAndWait();
}
Example 25
Project: Cachoeira-master  File: StartWindowView.java View source code
private Node createImageBox() {
    ImageView imageView = new ImageView(getClass().getResource("/img/cachoeira.png").toExternalForm());
    imageView.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.8), 4, 0, 0, 2));
    VBox imageVBox = new VBox(imageView);
    VBox.setVgrow(imageVBox, Priority.ALWAYS);
    imageVBox.setAlignment(Pos.CENTER);
    return imageVBox;
}
Example 26
Project: ColloidUI-master  File: DotController.java View source code
private void initAbilities() {
    crushingDarkness.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/img/crushing_darkness.jpg"))));
    crushingDarkness.setText(CRUSHING_DARKNESS);
    crushingDarkness.setVisible(false);
    spells.add(new SpellContainer(CRUSHING_DARKNESS, DURATION_CRUSHING_DARKNESS, crushingDarkness));
    affliction.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/img/affliction.jpg"))));
    affliction.setText(AFFLICTION);
    affliction.setVisible(false);
    spells.add(new SpellContainer(AFFLICTION, DURATION_AFFLICTION, affliction));
    creepingTerror.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/img/creeping_terror.jpg"))));
    creepingTerror.setText(CREEPING_TERROR);
    creepingTerror.setVisible(false);
    spells.add(new SpellContainer(CREEPING_TERROR, DURATION_CREEPING_TERROR, creepingTerror));
    wrath.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/img/wrath.jpg"))));
    wrath.setText(WRATH);
    wrath.setVisible(false);
    spells.add(new SpellContainer(WRATH, DURATION_WRATH, wrath));
}
Example 27
Project: e4-rendering-master  File: DetailsView.java View source code
private Node createDetailsPanel() {
    uiProp = JFXBeanProperties.value("text");
    ctx = new DataBindingContext();
    grid = new GridPane();
    grid.getStyleClass().add("my-gridpane");
    grid.setHgap(10);
    grid.setVgap(5);
    grid.setPadding(new Insets(10, 10, 10, 10));
    detailsPanelRow = 0;
    addSeparator("General");
    titleText = addProperty("Title", "title");
    addProperty("Name", "name");
    addProperty("Company", "company");
    addProperty("Job Title", "jobTitle");
    addProperty("Note", "note", 2);
    Image image = new Image(getClass().getResourceAsStream("dummy.png"));
    imageView = new ImageView(image);
    grid.add(imageView, 3, 0, 1, 5);
    GridPane.setValignment(imageView, VPos.BOTTOM);
    GridPane.setHalignment(imageView, HPos.LEFT);
    double scaleFactor = 102 / image.getHeight();
    imageView.setFitHeight(scaleFactor * image.getHeight());
    imageView.setFitWidth(scaleFactor * image.getWidth());
    titleText.heightProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            Image image = imageView.getImage();
            double scaleFactor = ((Double) newValue + 3.5) * 4 / image.getHeight();
            imageView.setFitHeight(scaleFactor * image.getHeight());
            imageView.setFitWidth(scaleFactor * image.getWidth());
        }
    });
    addSeparator("Business Address");
    addProperty("Street", "street", 2);
    addProperty("City", "city", 2);
    addProperty("Zip", "zip", 2);
    addProperty("Country", "country", 2);
    addSeparator("Business Phones");
    addProperty("Phone", "phone", 2);
    addProperty("Mobile", "mobile", 2);
    addSeparator("Business Internet");
    addProperty("E-Mail", "email", 2);
    addProperty("Web Site", "webPage", 2);
    ColumnConstraints separatorConstraints = new ColumnConstraints();
    separatorConstraints.setHalignment(HPos.LEFT);
    grid.getColumnConstraints().add(separatorConstraints);
    ColumnConstraints labelConstraints = new ColumnConstraints();
    labelConstraints.setHalignment(HPos.RIGHT);
    grid.getColumnConstraints().add(labelConstraints);
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setFitToWidth(true);
    scrollPane.setContent(grid);
    scrollPane.autosize();
    return scrollPane;
}
Example 28
Project: geotoolkit-master  File: FXToolBox.java View source code
private void init(final MapContext context) {
    getStylesheets().add("/org/geotoolkit/gui/javafx/buttonbar.css");
    //commit and rollback buttons
    final Button rollback = rollbackAction.createButton(ActionUtils.ActionTextBehavior.HIDE);
    final Button commit = commitAction.createButton(ActionUtils.ActionTextBehavior.HIDE);
    rollback.styleProperty().unbind();
    rollback.setStyle("-fx-base : #FFAAAA;");
    rollback.getStyleClass().add("buttongroup-left");
    commit.styleProperty().unbind();
    commit.setStyle("-fx-base : #AAFFAA;");
    commit.getStyleClass().add("buttongroup-right");
    commitRollBackBar.getChildren().addAll(rollback, commit);
    grid.setMaxWidth(Double.MAX_VALUE);
    tools.addListener((Change<? extends EditionTool.Spi> c) -> updateGrid());
    toolPerRow.addListener((ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> updateGrid());
    final GridPane top = new GridPane();
    top.getColumnConstraints().add(new ColumnConstraints(250, GridPane.USE_COMPUTED_SIZE, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true));
    top.getRowConstraints().add(new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE, Priority.NEVER, VPos.CENTER, false));
    top.getRowConstraints().add(new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE, Priority.NEVER, VPos.CENTER, false));
    top.getRowConstraints().add(new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.MAX_VALUE, Priority.ALWAYS, VPos.TOP, true));
    top.add(combo, 0, 0);
    top.add(commitRollBackBar, 1, 0);
    top.add(grid, 0, 1, 2, 1);
    top.add(accordion, 0, 2, 2, 1);
    top.setVgap(10);
    top.setHgap(10);
    setCenter(top);
    accordion.getPanes().add(helpPane);
    accordion.getPanes().add(paramsPane);
    helpPane.disableProperty().bind(helpPane.contentProperty().isNull());
    paramsPane.disableProperty().bind(paramsPane.contentProperty().isNull());
    combo.setMapContext(context);
    combo.setPrefWidth(50);
    combo.setMinWidth(50);
    combo.setMaxWidth(Double.MAX_VALUE);
    combo.valueProperty().addListener((ObservableValue<? extends MapLayer> observable, MapLayer oldValue, MapLayer newValue) -> updateGrid());
    commitAction.layerProperty().bind(GeotkFX.isInstance(combo.valueProperty(), FeatureMapLayer.class));
    rollbackAction.layerProperty().bind(GeotkFX.isInstance(combo.valueProperty(), FeatureMapLayer.class));
    //listen to grid size change
    final ToggleButton button = new ToggleButton();
    button.getStyleClass().add("buttongroup-right");
    button.setGraphic(new ImageView(GeotkFX.ICON_ADD));
    button.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    button.setAlignment(Pos.CENTER);
    button.setMaxHeight(GridPane.USE_PREF_SIZE);
    button.setMaxWidth(GridPane.USE_PREF_SIZE);
    final Scene snapScene = new Scene(button);
    snapScene.snapshot(null);
    final double buttonSize = button.getWidth();
    top.widthProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            dynamicNbCol = Math.max(1, (int) (newValue.intValue() / buttonSize));
            if (toolPerRow.get() == -1)
                updateGrid();
        }
    });
}
Example 29
Project: griffon-master  File: ImagePropertyEditor.java View source code
protected void handleAsClassWithArg(String str) {
    String[] args = str.split("\\|");
    if (args.length == 2) {
        Class<?> iconClass = null;
        try {
            iconClass = ImagePropertyEditor.class.getClassLoader().loadClass(args[0]);
        } catch (ClassNotFoundException e) {
            throw illegalValue(str, Image.class, e);
        }
        Constructor<?> constructor = null;
        try {
            constructor = iconClass.getConstructor(String.class);
        } catch (NoSuchMethodException e) {
            throw illegalValue(str, Image.class, e);
        }
        try {
            Object o = constructor.newInstance(args[1]);
            if (o instanceof Image) {
                super.setValueInternal(o);
            } else if (o instanceof ImageView) {
                super.setValueInternal(((ImageView) o).getImage());
            } else {
                throw illegalValue(str, Image.class);
            }
        } catch (InstantiationExceptionInvocationTargetException | IllegalAccessException |  e) {
            throw illegalValue(str, Image.class, e);
        }
    } else {
        throw illegalValue(str, Image.class);
    }
}
Example 30
Project: POL-POM-5-master  File: AbstractStepRepresentationWithHeader.java View source code
/**
     * Draw the header at the top of the window
     */
private void drawHeader() {
    // FIXME: use this variable to draw the title of the window
    final String title = this.getParentWizardTitle();
    Pane header = new Pane();
    header.setId("header");
    header.setPrefSize(722, 65);
    header.setLayoutX(-1);
    header.setLayoutY(-1);
    header.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    ImageView topImage = new ImageView(this.createTopImage());
    topImage.setLayoutX(626);
    header.getChildren().add(topImage);
    getParent().getRoot().setTop(header);
}
Example 31
Project: skadi-master  File: AuthorizationDialog.java View source code
private GridPane buildAuthPane() {
    final GridPane pane = new GridPane();
    pane.setHgap(10);
    pane.setVgap(10);
    // Step 1: Btn
    final Button btOpenTwitchPage = GlyphsDude.createIconButton(FontAwesomeIcon.EXTERNAL_LINK, "Open Twitch Authorization Page");
    btOpenTwitchPage.setOnAction( event -> {
        final URI authUrl = TwitchUtil.buildAuthUrl();
        DesktopUtil.openWebpage(authUrl);
    });
    final Label lbStep1 = new Label("Step 1: ");
    final Label lbDesc1 = new Label("Press the Button to open the Twitch authorization page:");
    GridPane.setValignment(lbStep1, VPos.BASELINE);
    GridPane.setValignment(lbDesc1, VPos.BASELINE);
    pane.add(lbStep1, 0, 0);
    pane.add(lbDesc1, 1, 0);
    pane.add(btOpenTwitchPage, 2, 0);
    // Step 2: desc twitch auth
    final Label lbStep2 = new Label("Step 2: ");
    final Label lbDesc2 = new Label("Follow the instructions on the Twitch authorization page:");
    GridPane.setValignment(lbStep2, VPos.BASELINE);
    GridPane.setValignment(lbDesc2, VPos.BASELINE);
    pane.add(lbStep2, 0, 1);
    pane.add(lbDesc2, 1, 1);
    pane.add(new ImageView(new Image(getClass().getResourceAsStream("/images/auth_prev_0.png"))), 2, 1);
    // Step 3: Result page copy auth token#
    final Label lbStep3 = new Label("Step 3: ");
    final Label lbDesc3 = new Label("After you authorized Skadi, you will be redirected to the Skadi authorization page:");
    GridPane.setValignment(lbStep3, VPos.BASELINE);
    GridPane.setValignment(lbDesc3, VPos.BASELINE);
    pane.add(lbStep3, 0, 2);
    pane.add(lbDesc3, 1, 2);
    pane.add(new ImageView(new Image(getClass().getResourceAsStream("/images/auth_prev_1.png"))), 2, 2);
    // Step 4: Paste auth token
    final Label lbStep4 = new Label("Step 4: ");
    final Label lbDesc4 = new Label("Paste the Authorization token from the Skadi authorization page here: ");
    GridPane.setValignment(lbStep4, VPos.BASELINE);
    GridPane.setValignment(lbDesc4, VPos.BASELINE);
    pane.add(lbStep4, 0, 3);
    pane.add(lbDesc4, 1, 3);
    pane.add(tfToken, 2, 3);
    //TODO
    return pane;
}
Example 32
Project: Solitaire-master  File: SuitStack.java View source code
@Override
public void gameStateChanged() {
    if (GameModel.instance().isEmptySuitStack(aIndex)) {
        getChildren().get(0).setVisible(false);
    } else {
        getChildren().get(0).setVisible(true);
        Card topCard = GameModel.instance().peekSuitStack(aIndex);
        ImageView image = (ImageView) getChildren().get(0);
        image.setImage(CardImages.getCard(topCard));
        aDragHandler.setCard(topCard);
    }
}
Example 33
Project: autopsy-master  File: GroupCellFactory.java View source code
@Override
protected synchronized void updateItem(final GroupTreeNode newItem, boolean empty) {
    //if there was a previous group, remove the listeners
    getGroup().ifPresent( oldGroup -> removeListeners(getGroupListener(), oldGroup));
    super.updateItem(newItem, empty);
    if (isNull(newItem) || empty) {
        clearCell(this);
    } else {
        DrawableGroup newGroup = newItem.getGroup();
        if (isNull(newGroup)) {
            //this cod epath should only be invoked for non-group Tree
            final String groupName = getGroupName();
            //"dummy" group in file system tree <=>  a folder with no drawables
            Platform.runLater(() -> {
                setTooltip(new Tooltip(groupName));
                setText(groupName);
                setGraphic(new ImageView(EMPTY_FOLDER_ICON));
                setStyle("");
            });
        } else {
            updateGroup(this, newGroup);
        }
    }
}
Example 34
Project: bikingFX-master  File: GalleryPictureTableCell.java View source code
void displayImage(final Image image) {
    final Node currentContent = this.container.getChildren().get(0);
    if (!(currentContent instanceof ProgressIndicator)) {
        final ImageView imageView = (ImageView) currentContent;
        imageView.setImage(image);
    } else {
        final ImageView imageView = new ImageView(image);
        imageView.fitWidthProperty().bind(this.container.widthProperty());
        imageView.setPreserveRatio(true);
        imageView.setCache(true);
        this.container.getChildren().set(0, imageView);
    }
}
Example 35
Project: CrocodileNote-master  File: Popups.java View source code
public void create(String msg, ReturnListener rl, int focusid, String... buttons) {
    setReturnListener(rl);
    myDialog = new Stage();
    myDialog.initModality(Modality.APPLICATION_MODAL);
    myDialog.setResizable(false);
    myDialog.setTitle(/*Base.appname*/
    "Warning");
    myDialog.getIcons().add(ico);
    ImageView iv = new ImageView(warn);
    Button[] bs = createButtons(buttons);
    HBox hb = HBoxBuilder.create().children(iv, t(msg)).spacing(10).padding(new Insets(10)).build();
    hb.setAlignment(Pos.TOP_LEFT);
    TilePane tileButtons = new TilePane(Orientation.HORIZONTAL);
    tileButtons.setPadding(new Insets(0, 0, 5, 0));
    tileButtons.setHgap(20);
    tileButtons.setAlignment(Pos.CENTER);
    tileButtons.getChildren().addAll(bs);
    tileButtons.setPrefColumns(bs.length);
    VBox vb = VBoxBuilder.create().children(hb, tileButtons).build();
    myDialog.setScene(new Scene(vb, Color.WHITESMOKE));
    myDialog.sizeToScene();
    myDialog.show();
    if (focusid > 0 && focusid < bs.length)
        bs[focusid].requestFocus();
}
Example 36
Project: EclipseDay-Presentation-master  File: PlaceView.java View source code
/**
     * {@inheritDoc}
     */
@Override
protected void initView() {
    // node().getParent().setOpacity(0);
    final ImageView toulouse = ImageViewBuilder.create().image(EDPImages.PLACE_BG.get()).build();
    final BoxBlur fx = BoxBlurBuilder.create().width(1).height(1).iterations(3).build();
    toulouse.setEffect(fx);
    node().getChildren().add(toulouse);
    node().getStyleClass().add(model().getSlide().getStyle());
    this.fadeTransition = new FadeTransition(Duration.seconds(4), node());
    this.fadeTransition.setFromValue(0.0f);
    this.fadeTransition.setToValue(1.0f);
    this.fadeTransition.setCycleCount(1);
    this.fadeTransition.setAutoReverse(false);
    final Timeline blurFx = new Timeline(new KeyFrame(Duration.seconds(0), new KeyValue(fx.widthProperty(), 15.0), new KeyValue(fx.heightProperty(), 15.0)), new KeyFrame(Duration.seconds(3), new KeyValue(fx.widthProperty(), 1), new KeyValue(fx.heightProperty(), 1)));
    this.transition = new ParallelTransition();
    this.transition.getChildren().addAll(this.fadeTransition, blurFx);
}
Example 37
Project: emfdatabinding-tutorial-master  File: ToolItemRenderer.java View source code
@Override
public Object createWidget(MUIElement element) {
    Button button = new Button();
    button.getStyleClass().add("toolbarButton");
    MToolItem item = (MToolItem) element;
    String uri = item.getIconURI();
    if (uri != null) {
        try {
            URL url = new URL(URI.createURI(uri).toString());
            ImageView icon = new ImageView(new Image(url.openStream()));
            button.setGraphic(icon);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return button;
}
Example 38
Project: FXForm2-master  File: ConstraintLabel.java View source code
@Override
public void onChanged(Change<? extends ConstraintViolation> change) {
    getChildren().clear();
    for (Object o : constraint.get()) {
        ConstraintViolation constraintViolation = (ConstraintViolation) o;
        Label errorLabel = new Label(constraintViolation.getMessage());
        if (constraintViolation.getConstraintDescriptor() != null) {
            errorLabel.getStyleClass().add(constraintViolation.getConstraintDescriptor().getAnnotation().getClass().getName());
        }
        errorLabel.setWrapText(true);
        errorLabel.setMinHeight(Region.USE_PREF_SIZE);
        ImageView warningView = new ImageView(WARNING);
        warningView.setFitHeight(15);
        warningView.setPreserveRatio(true);
        warningView.setSmooth(true);
        errorLabel.setGraphic(warningView);
        getChildren().add(errorLabel);
    }
}
Example 39
Project: FxHeatMap-master  File: HeatMapViewer.java View source code
@Override
public void init() {
    backgroundImage = new ImageView();
    heatMapImage = new ImageView();
    buttonLoadBackgroundImage = new Button("BackgroundImage");
    buttonLoadHeatMapImage = new Button("HeatmapImage");
    toggleButtonShowHeatMap = new ToggleButton("hide");
    toggleButtonShowHeatMap.setSelected(true);
    AnchorPane.setLeftAnchor(buttonLoadBackgroundImage, 10d);
    AnchorPane.setTopAnchor(buttonLoadBackgroundImage, 10d);
    AnchorPane.setRightAnchor(buttonLoadHeatMapImage, 10d);
    AnchorPane.setTopAnchor(buttonLoadHeatMapImage, 10d);
    AnchorPane.setRightAnchor(toggleButtonShowHeatMap, 10d);
    AnchorPane.setTopAnchor(toggleButtonShowHeatMap, 40d);
    pane = new AnchorPane(backgroundImage, heatMapImage, buttonLoadBackgroundImage, buttonLoadHeatMapImage, toggleButtonShowHeatMap);
    registerListeners();
}
Example 40
Project: FXyz-master  File: Skybox.java View source code
private void layoutViews() {
    for (ImageView v : views) {
        v.setFitWidth(getSize());
        v.setFitHeight(getSize());
    }
    back.setTranslateX(-0.5 * getSize());
    back.setTranslateY(-0.5 * getSize());
    back.setTranslateZ(-0.5 * getSize());
    front.setTranslateX(-0.5 * getSize());
    front.setTranslateY(-0.5 * getSize());
    front.setTranslateZ(0.5 * getSize());
    front.setRotationAxis(Rotate.Z_AXIS);
    front.setRotate(-180);
    front.getTransforms().add(new Rotate(180, front.getFitHeight() / 2, 0, 0, Rotate.X_AXIS));
    front.setTranslateY(front.getTranslateY() - getSize());
    top.setTranslateX(-0.5 * getSize());
    top.setTranslateY(-1 * getSize());
    top.setRotationAxis(Rotate.X_AXIS);
    top.setRotate(-90);
    bottom.setTranslateX(-0.5 * getSize());
    bottom.setTranslateY(0);
    bottom.setRotationAxis(Rotate.X_AXIS);
    bottom.setRotate(90);
    left.setTranslateX(-1 * getSize());
    left.setTranslateY(-0.5 * getSize());
    left.setRotationAxis(Rotate.Y_AXIS);
    left.setRotate(90);
    right.setTranslateX(0);
    right.setTranslateY(-0.5 * getSize());
    right.setRotationAxis(Rotate.Y_AXIS);
    right.setRotate(-90);
}
Example 41
Project: gef-master  File: JFaceCustomNodeExample.java View source code
@Override
protected Group doCreateVisual() {
    ImageView ian = new ImageView(new javafx.scene.image.Image(getClass().getResource("ibull.jpg").toExternalForm()));
    Polyline body = new Polyline(0, 0, 0, 60, 25, 90, 0, 60, -25, 90, 0, 60, 0, 25, 25, 0, 0, 25, -25, 0);
    body.setTranslateX(ian.getLayoutBounds().getWidth() / 2 - body.getLayoutBounds().getWidth() / 2 - 5);
    body.setTranslateY(-15);
    labelText = new Text();
    vbox = new VBox();
    vbox.getChildren().addAll(ian, body, labelText);
    return new Group(vbox);
}
Example 42
Project: idnadrev-master  File: ThumbnailGallery.java View source code
@Override
protected void updateItem(GridPane item, boolean empty) {
    super.updateItem(item, empty);
    if (item != null) {
        box2Thumbnail.get(item).forEach( t -> {
            CompletableFuture.supplyAsync(() -> t.getItem().getThumbNail(), controller.getExecutorService()).thenAcceptAsync( image -> {
                ImageView imageView = t.getImageView();
                if (image != null) {
                    imageView.setImage(image);
                    imageView.setFitHeight(image.getHeight());
                    imageView.setFitWidth(image.getWidth());
                } else {
                    imageView.setImage(null);
                }
            }, controller.getJavaFXExecutor());
        });
        setGraphic(item);
        log.info("Updating item {}", items.indexOf(item));
    } else {
        setGraphic(null);
    }
}
Example 43
Project: javafx-MultipleScreens-framework-master  File: Screen2Controller.java View source code
@FXML
private void openZellaWindow(ActionEvent event) {
    // Window content
    ImageView imageView = new ImageView("/assets/stub.png");
    // Custom window
    InternalWindow w = new InternalWindow();
    // Build custom title bar
    BorderPane titleBar = new BorderPane();
    titleBar.setStyle("-fx-background-color: red; -fx-padding: 3");
    Label label = new Label(paramsFromFirstScreen);
    label.setStyle("-fx-text-fill: green;");
    titleBar.setLeft(label);
    Button closeButton = new Button("close");
    closeButton.setOnAction(new DefaultWindowCloseEventHandler(w));
    titleBar.setRight(closeButton);
    // Build custom window
    BorderPane windowPane = new BorderPane();
    windowPane.setStyle("-fx-border-width: 1; -fx-border-color: black");
    windowPane.setTop(titleBar);
    // set contnet
    windowPane.setCenter(imageView);
    w.setRoot(windowPane);
    w.makeDragable(titleBar, true);
    w.makeFocusable(windowPane, true);
    w.setResizable(true, 10, true);
    w.setMultitouch(false, true);
    w.setDestroyable(() -> {
        System.out.println("destroy resourses on close");
    });
    w.setXY(50, 50);
    pane.getChildren().add(w);
}
Example 44
Project: JRebirth-Tour-master  File: PlaceView.java View source code
/**
     * {@inheritDoc}
     */
@Override
protected void initView() {
    final ImageView placeImage = new ImageView();
    placeImage.setImage(JpImages.PLACE_BG.get());
    // .fitHeight(Double.MAX_VALUE)
    // .fitWidth(Double.MAX_VALUE)
    final HBox softshake = buildGroup();
    softshake.setLayoutX(50);
    softshake.setLayoutY(50);
    eventTime = new Text();
    eventTime.setFont(JpFonts.CONF_SUBTITLE.get());
    eventTime.setFill(JpColors.SOFT_WHITE.get());
    eventTime.setLayoutX(600);
    eventTime.setLayoutY(700);
    speaker = new Text();
    speaker.setFont(JpFonts.CONF_SUBTITLE.get());
    speaker.setFill(JpColors.SOFT_WHITE.get());
    speaker.setLayoutX(50);
    speaker.setLayoutY(700);
    node().getChildren().addAll(placeImage, softshake, eventTime, speaker);
    node().getStyleClass().add(model().getSlide().getStyle());
}
Example 45
Project: Lily-master  File: ProjectView.java View source code
private void findFiles(File directory, TreeItem<String> parent) {
    TreeItem<String> root = new TreeItem<>(directory.getName());
    if (directory.isFile()) {
        addFile(root, directory);
        return;
    }
    File[] files = directory.listFiles();
    if (files != null) {
        sort(files);
        for (File file : files) {
            if (file.isDirectory()) {
                findFiles(file, root);
                continue;
            }
            addFile(root, file);
        }
    }
    root.setExpanded(false);
    root.setGraphic(new ImageView(defaultFolderIcon));
    if (parent == null) {
        root.setExpanded(true);
        tree.setRoot(root);
        return;
    }
    parent.getChildren().add(root);
}
Example 46
Project: Screen-Master-master  File: ScreenMaster.java View source code
private Parent createDisplayWindow() {
    AnchorPane p = new AnchorPane();
    p.setPrefSize(1024, 768);
    BorderPane imgParent = new BorderPane();
    p.getChildren().add(imgParent);
    AnchorPane.setBottomAnchor(imgParent, 0d);
    AnchorPane.setTopAnchor(imgParent, 0d);
    AnchorPane.setLeftAnchor(imgParent, 0d);
    AnchorPane.setRightAnchor(imgParent, 0d);
    ImageView imgView = new ImageView();
    imgView.setPickOnBounds(true);
    imgView.setPreserveRatio(true);
    imgParent.setCenter(imgView);
    this.imgView = imgView;
    this.imgParent = imgParent;
    return p;
}
Example 47
Project: simplejavayoutubeuploader-master  File: ViewController.java View source code
private void loadMenuGraphics() {
    try (InputStream addPlaylistStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/table_add.png");
        InputStream addTemplateStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/page_add.png");
        InputStream closeStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/cancel.png");
        InputStream openStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/folder_explore.png");
        InputStream documentationStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/book.png");
        InputStream faqStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/help.png");
        InputStream logsStream = getClass().getResourceAsStream("/de/chaosfisch/uploader/resources/images/report.png")) {
        menuAddPlaylist.setGraphic(new ImageView(new Image(addPlaylistStream)));
        menuAddTemplate.setGraphic(new ImageView(new Image(addTemplateStream)));
        menuClose.setGraphic(new ImageView(new Image(closeStream)));
        menuOpen.setGraphic(new ImageView(new Image(openStream)));
        openDocumentation.setGraphic(new ImageView(new Image(documentationStream)));
        openFAQ.setGraphic(new ImageView(new Image(faqStream)));
        openLogs.setGraphic(new ImageView(new Image(logsStream)));
    } catch (final IOException e) {
        logger.warn("Icons not loaded", e);
    }
}
Example 48
Project: SmallMind-master  File: ImageViewPane.java View source code
@Override
protected void layoutChildren() {
    ImageView imageView = imageViewProperty.get();
    if (imageView != null) {
        imageView.setFitWidth(getWidth());
        imageView.setFitHeight(getHeight());
        layoutInArea(imageView, 0, 0, getWidth(), getHeight(), 0, HPos.CENTER, VPos.CENTER);
    }
    super.layoutChildren();
}
Example 49
Project: CoinJoin-master  File: ClickableBitcoinAddress.java View source code
@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( event1 -> overlay.done());
}
Example 50
Project: DesktopWidget-master  File: Pidget.java View source code
@Override
public void start() {
    ImageView imgView = new ImageView();
    getChildren().add(imgView);
    System.out.println("Opening directory...");
    String picDir = loadDirectory();
    File dir = new File(picDir);
    File[] files = dir.listFiles((File dir1, String name) -> name.endsWith(".jpg"));
    if (files.length == 0) {
        // Notify user of extreme lack of photographic material. :-)
        Label noFilesLabel = new Label("No files in directory " + picDir + ", please add 'picdir=<path>' entry to Pidget.properties file.");
        noFilesLabel.setPrefSize(widgetBounds.getWidth(), widgetBounds.getHeight());
        noFilesLabel.setMaxSize(widgetBounds.getWidth(), widgetBounds.getHeight());
        noFilesLabel.setAlignment(Pos.CENTER);
        getChildren().add(noFilesLabel);
    } else {
        ArrayList<Image> images = new ArrayList<>();
        for (File picFile : files) {
            System.out.println(picFile);
            try {
                images.add(new Image(new FileInputStream(picFile)));
                System.out.println("Adding picture " + picFile.toString() + " to the picture carousel...");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        // Start the clock & counter for picture rotation
        startTime = System.currentTimeMillis() - 10000;
        curPic = 0;
        timer = new AnimationTimer() {

            @Override
            public void handle(long now) {
                if ((curTime = System.currentTimeMillis()) - startTime > 9999) {
                    System.out.println("Now displaying " + images.get(curPic).toString() + " in Pidget...");
                    imgView.setImage(images.get(curPic));
                    imgView.setFitHeight(widgetBounds.getHeight());
                    imgView.setPreserveRatio(true);
                    curPic = curPic == images.size() - 1 ? 0 : curPic + 1;
                    startTime = curTime;
                }
            }
        };
        timer.start();
    }
}
Example 51
Project: drive-uploader-master  File: DriveDirectoryChooserViewController.java View source code
@Override
protected void updateItem(File file, boolean empty) {
    super.updateItem(file, empty);
    if (empty) {
        setText(null);
        setGraphic(null);
    } else {
        Node graphic = new ImageView(new Image(getClass().getResourceAsStream("/icons/folder.png")));
        setText(getItem() == null ? "" : getItem().getTitle());
        setGraphic(graphic);
        setContentDisplay(ContentDisplay.LEFT);
    }
}
Example 52
Project: ewidgetfx-master  File: Pidget.java View source code
@Override
public void start() {
    ImageView imgView = new ImageView();
    getChildren().add(imgView);
    System.out.println("Opening directory...");
    String picDir = loadDirectory();
    File dir = new File(picDir);
    File[] files = dir.listFiles((File dir1, String name) -> name.endsWith(".jpg"));
    if (files.length == 0) {
        // Notify user of extreme lack of photographic material. :-)
        Label noFilesLabel = new Label("No files in directory " + picDir + ", please add 'picdir=<path>' entry to Pidget.properties file.");
        noFilesLabel.setPrefSize(widgetBounds.getWidth(), widgetBounds.getHeight());
        noFilesLabel.setMaxSize(widgetBounds.getWidth(), widgetBounds.getHeight());
        noFilesLabel.setAlignment(Pos.CENTER);
        getChildren().add(noFilesLabel);
    } else {
        ArrayList<Image> images = new ArrayList<>();
        for (File picFile : files) {
            System.out.println(picFile);
            try {
                images.add(new Image(new FileInputStream(picFile)));
                System.out.println("Adding picture " + picFile.toString() + " to the picture carousel...");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        // Start the clock & counter for picture rotation
        startTime = System.currentTimeMillis() - 10000;
        curPic = 0;
        timer = new AnimationTimer() {

            @Override
            public void handle(long now) {
                if ((curTime = System.currentTimeMillis()) - startTime > 9999) {
                    System.out.println("Now displaying " + images.get(curPic).toString() + " in Pidget...");
                    imgView.setImage(images.get(curPic));
                    imgView.setFitHeight(widgetBounds.getHeight());
                    imgView.setPreserveRatio(true);
                    curPic = curPic == images.size() - 1 ? 0 : curPic + 1;
                    startTime = curTime;
                }
            }
        };
        timer.start();
    }
}
Example 53
Project: FrostBite3Editor-master  File: Game.java View source code
public void buildExplorerTree() {
    currentToc = null;
    currentSB = null;
    TreeItem<TreeViewEntry> explorerTree = new TreeItem<TreeViewEntry>(new TreeViewEntry(Core.gamePath, null, null, EntryType.LIST));
    for (File file : FileHandler.listf(Core.gamePath + "/Data/", ".sb")) {
        File patched = new File(file.getAbsolutePath().replace("\\", "/").replace(Core.gamePath, Core.gamePath + "/Update/Patch"));
        if (!patched.exists()) {
            String relPath = file.getAbsolutePath().replace("\\", "/").replace(".sb", "").replace(Core.gamePath + "/", "");
            //System.out.println("NOPATCH "+relPath);
            String[] fileName = relPath.split("/");
            TreeItem<TreeViewEntry> convTocTree = new TreeItem<TreeViewEntry>(new TreeViewEntry(fileName[fileName.length - 1], new ImageView(JavaFXHandler.documentIcon), file, EntryType.LIST));
            TreeViewConverter.pathToTree(explorerTree, relPath, convTocTree);
        } else {
            String relPath = patched.getAbsolutePath().replace("\\", "/").replace(".sb", "").replace(Core.gamePath + "/", "");
            //System.out.println("PATCH "+relPath);
            String[] fileName = relPath.split("/");
            TreeItem<TreeViewEntry> convTocTree = new TreeItem<TreeViewEntry>(new TreeViewEntry(fileName[fileName.length - 1], new ImageView(JavaFXHandler.documentIcon), patched, EntryType.LIST));
            TreeViewConverter.pathToTree(explorerTree, relPath, convTocTree);
        }
    }
    explorerTree.getValue();
    for (TreeItem<TreeViewEntry> child : explorerTree.getChildren()) {
        if (child.getChildren().size() > 0) {
            child.setExpanded(true);
        }
    }
    //Core.getJavaFXHandler().setTreeViewStructureLeft(explorerTree);
    Core.getJavaFXHandler().getMainWindow().setPackageExplorer(explorerTree);
    //Core.getJavaFXHandler().setTreeViewStructureLeft1(null);
    Core.getJavaFXHandler().getMainWindow().setPackageExplorer1(null, null);
/*
		Core.getJavaFXHandler().setTreeViewStructureRight(null);
		Core.getJavaFXHandler().getMainWindow().updateRightRoot();
		
		*/
}
Example 54
Project: FXGL-master  File: Entities.java View source code
private Node tilesToView(TiledMap map, String layerName) {
    Layer layer = map.getLayerByName(layerName);
    WritableImage buffer = new WritableImage(layer.getWidth() * map.getTilewidth(), layer.getHeight() * map.getTileheight());
    for (int i = 0; i < layer.getData().size(); i++) {
        int gid = layer.getData().get(i);
        // empty tile
        if (gid == 0)
            continue;
        Tileset tileset = findTileset(gid, map.getTilesets());
        // we offset because data is encoded as continuous
        gid -= tileset.getFirstgid();
        // image source
        int tilex = gid % tileset.getColumns();
        int tiley = gid / tileset.getColumns();
        // image destination
        int x = i % layer.getWidth();
        int y = i / layer.getWidth();
        int w = tileset.getTilewidth();
        int h = tileset.getTileheight();
        String imageName = tileset.getImage();
        imageName = imageName.substring(imageName.lastIndexOf("/") + 1);
        Image sourceImage = FXGL.getAssetLoader().loadTexture(imageName).getImage();
        buffer.getPixelWriter().setPixels(x * w, y * h, w, h, sourceImage.getPixelReader(), tilex * w, tiley * h);
    }
    return new ImageView(buffer);
}
Example 55
Project: GeoFroggerFX-v1-master  File: CacheDetailsController.java View source code
@Override
public void initialize(URL url, ResourceBundle rb) {
    setSessionListener();
    cacheNameHeader.textProperty().bind(cacheName.textProperty());
    detailsIconHeader.getStyleClass().add("cache-list-icon");
    icon = new ImageView();
    detailsIconHeader.setGraphic(icon);
    cacheDetailPane.setOpacity(0.3);
    shortDescriptionWebView = new WebView();
    longDescriptionWebView = new WebView();
    shortDescriptionField = new TextArea();
    longDescriptionField = new TextArea();
    editableForm(false);
    initFading();
}
Example 56
Project: javac-master  File: JavaFxPlayVideoAndAudio.java View source code
@Override
public void start(Stage primaryStage) throws Exception {
    StackPane root = new StackPane();
    ImageView imageView = new ImageView();
    root.getChildren().add(imageView);
    imageView.fitWidthProperty().bind(primaryStage.widthProperty());
    imageView.fitHeightProperty().bind(primaryStage.heightProperty());
    Scene scene = new Scene(root, 640, 480);
    primaryStage.setTitle("Video + audio");
    primaryStage.setScene(scene);
    primaryStage.show();
    playThread = new Thread(() -> {
        try {
            FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("C:\\Users\\gda\\Desktop\\bunny_move\\1486430724718.mp4");
            grabber.start();
            AudioFormat audioFormat = new AudioFormat(44100, 16, 1, true, true);
            DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
            SourceDataLine soundLine = (SourceDataLine) AudioSystem.getLine(info);
            soundLine.open(audioFormat);
            soundLine.start();
            OpenCVFrameConverter converter = new OpenCVFrameConverter.ToIplImage();
            Java2DFrameConverter paintConverter = new Java2DFrameConverter();
            ExecutorService executor = Executors.newSingleThreadExecutor();
            while (!Thread.interrupted()) {
                Frame frame = grabber.grab();
                if (frame == null) {
                    break;
                }
                if (frame.image != null) {
                    Image image = SwingFXUtils.toFXImage(paintConverter.convert(frame), null);
                    Platform.runLater(() -> {
                        imageView.setImage(image);
                    });
                } else if (frame.samples != null) {
                    FloatBuffer channelSamplesFloatBuffer = (FloatBuffer) frame.samples[0];
                    channelSamplesFloatBuffer.rewind();
                    ByteBuffer outBuffer = ByteBuffer.allocate(channelSamplesFloatBuffer.capacity() * 2);
                    for (int i = 0; i < channelSamplesFloatBuffer.capacity(); i++) {
                        /**
                             * FloatBuffer is converted to ByteBuffer with some
                             * magic constant SC16 (~Short.MAX_VALUE). I found
                             * it on some forum with this explanation:
                             *
                             * For 16 bit signed to float, divide by 32768. For
                             * float to 16 bit, multiply by 32768.
                             *
                             * Going from float to integer, do the initial
                             * conversion into a container bigger than the
                             * destination container so that it doesn't
                             * accidentally wrap on overs. For instance, on 16
                             * or 24 bit, you can use signed int 32.
                             *
                             * Or alternately, do the clipping on the scaled
                             * float value, before casting into integer. That
                             * way you can save the clipped float direct to a 16
                             * bit container and not have to fool with an
                             * intermediate 32 bit container.
                             *
                             * Clip the float to int results to stay in bounds.
                             * Anything lower than 0x8000 clipped to 0x8000, and
                             * anything higher than 0x7FFFF clipped to 0x7FFFF.
                             *
                             * The advantage of using a factor of 32768 is that
                             * bit patterns will stay the same after conversion.
                             * If you use 32767, the bit patterns will change.
                             * Not much change, but it just doesn't seem elegant
                             * to have them change if it can be avoided.
                             *
                             * If you want to do it as fast as possible it is
                             * just a matter of optimizing the code in whatever
                             * way seems sensible.
                             */
                        // Could be replaced with: short val = (short) (channelSamplesFloatBuffer.get(i) * Short.MAX_VALUE);
                        short val = (short) ((double) channelSamplesFloatBuffer.get(i) * SC16);
                        outBuffer.putShort(val);
                    }
                    /**
                         * We need this because soundLine.write ignores
                         * interruptions during writing.
                         */
                    try {
                        executor.submit(() -> {
                            soundLine.write(outBuffer.array(), 0, outBuffer.capacity());
                            outBuffer.clear();
                        }).get();
                    } catch (InterruptedException interruptedException) {
                        Thread.currentThread().interrupt();
                    }
                }
            }
            executor.shutdownNow();
            executor.awaitTermination(10, TimeUnit.SECONDS);
            soundLine.stop();
            grabber.stop();
            grabber.release();
            Platform.exit();
        } catch (Exception exception) {
            LOG.log(Level.SEVERE, null, exception);
            System.exit(1);
        }
    });
    playThread.start();
}
Example 57
Project: javacv-master  File: JavaFxPlayVideoAndAudio.java View source code
@Override
public void start(Stage primaryStage) throws Exception {
    StackPane root = new StackPane();
    ImageView imageView = new ImageView();
    root.getChildren().add(imageView);
    imageView.fitWidthProperty().bind(primaryStage.widthProperty());
    imageView.fitHeightProperty().bind(primaryStage.heightProperty());
    Scene scene = new Scene(root, 640, 480);
    primaryStage.setTitle("Video + audio");
    primaryStage.setScene(scene);
    primaryStage.show();
    playThread = new Thread(() -> {
        try {
            FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("C:\\Users\\gda\\Desktop\\bunny_move\\1486430724718.mp4");
            grabber.start();
            AudioFormat audioFormat = new AudioFormat(44100, 16, 1, true, true);
            DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
            SourceDataLine soundLine = (SourceDataLine) AudioSystem.getLine(info);
            soundLine.open(audioFormat);
            soundLine.start();
            OpenCVFrameConverter converter = new OpenCVFrameConverter.ToIplImage();
            Java2DFrameConverter paintConverter = new Java2DFrameConverter();
            ExecutorService executor = Executors.newSingleThreadExecutor();
            while (!Thread.interrupted()) {
                Frame frame = grabber.grab();
                if (frame == null) {
                    break;
                }
                if (frame.image != null) {
                    Image image = SwingFXUtils.toFXImage(paintConverter.convert(frame), null);
                    Platform.runLater(() -> {
                        imageView.setImage(image);
                    });
                } else if (frame.samples != null) {
                    FloatBuffer channelSamplesFloatBuffer = (FloatBuffer) frame.samples[0];
                    channelSamplesFloatBuffer.rewind();
                    ByteBuffer outBuffer = ByteBuffer.allocate(channelSamplesFloatBuffer.capacity() * 2);
                    for (int i = 0; i < channelSamplesFloatBuffer.capacity(); i++) {
                        /**
                             * FloatBuffer is converted to ByteBuffer with some
                             * magic constant SC16 (~Short.MAX_VALUE). I found
                             * it on some forum with this explanation:
                             *
                             * For 16 bit signed to float, divide by 32768. For
                             * float to 16 bit, multiply by 32768.
                             *
                             * Going from float to integer, do the initial
                             * conversion into a container bigger than the
                             * destination container so that it doesn't
                             * accidentally wrap on overs. For instance, on 16
                             * or 24 bit, you can use signed int 32.
                             *
                             * Or alternately, do the clipping on the scaled
                             * float value, before casting into integer. That
                             * way you can save the clipped float direct to a 16
                             * bit container and not have to fool with an
                             * intermediate 32 bit container.
                             *
                             * Clip the float to int results to stay in bounds.
                             * Anything lower than 0x8000 clipped to 0x8000, and
                             * anything higher than 0x7FFFF clipped to 0x7FFFF.
                             *
                             * The advantage of using a factor of 32768 is that
                             * bit patterns will stay the same after conversion.
                             * If you use 32767, the bit patterns will change.
                             * Not much change, but it just doesn't seem elegant
                             * to have them change if it can be avoided.
                             *
                             * If you want to do it as fast as possible it is
                             * just a matter of optimizing the code in whatever
                             * way seems sensible.
                             */
                        // Could be replaced with: short val = (short) (channelSamplesFloatBuffer.get(i) * Short.MAX_VALUE);
                        short val = (short) ((double) channelSamplesFloatBuffer.get(i) * SC16);
                        outBuffer.putShort(val);
                    }
                    /**
                         * We need this because soundLine.write ignores
                         * interruptions during writing.
                         */
                    try {
                        executor.submit(() -> {
                            soundLine.write(outBuffer.array(), 0, outBuffer.capacity());
                            outBuffer.clear();
                        }).get();
                    } catch (InterruptedException interruptedException) {
                        Thread.currentThread().interrupt();
                    }
                }
            }
            executor.shutdownNow();
            executor.awaitTermination(10, TimeUnit.SECONDS);
            soundLine.stop();
            grabber.stop();
            grabber.release();
            Platform.exit();
        } catch (Exception exception) {
            LOG.log(Level.SEVERE, null, exception);
            System.exit(1);
        }
    });
    playThread.start();
}
Example 58
Project: JRebirth-master  File: NodeSlicerCommand.java View source code
/**
     * Do it.
     */
public void sliceNode(final List<Node> nodes, final WaveBase wave) {
    final Node node = nodes.get(0);
    final long start = System.currentTimeMillis();
    if (node != null) {
        if (node instanceof ImageView) {
            this.imageProperty.set(((ImageView) node).getImage());
        } else {
            final WritableImage wi = node.snapshot(new SnapshotParameters(), null);
            this.imageProperty.set(wi);
        }
    }
    final double width = getImage().getWidth();
    final double height = getImage().getHeight();
    //
    for (double x = 0; x < width; x += getTileWidth()) {
        for (double y = 0; y < height; y += getTileHeight()) {
            // TODO OPTIMIZE
            final ImageView iv = ImageViewBuilder.create().image(getImage()).clip(RectangleBuilder.create().x(x).y(y).width(getTileWidth()).height(getTileHeight()).build()).opacity(1.0).scaleX(// TODO
            0.9).layoutX(x).layoutY(y).build();
            this.slices.add(iv);
        }
    }
    final long sliced = System.currentTimeMillis() - start;
    System.out.println("Sliced in " + sliced + " ms");
    LOGGER.debug("Sliced in {} ms", sliced);
}
Example 59
Project: jubula.core-master  File: JavaFXAdapterFactory.java View source code
/**
     * @param objectToAdapt the object to adapt
     * @return the component adapter
     */
private IComponent getComponentAdapter(Object objectToAdapt) {
    if (objectToAdapt instanceof MenuButton) {
        return new MenuButtonAdapter((MenuButton) objectToAdapt);
    } else if (objectToAdapt instanceof ButtonBase) {
        return new ButtonBaseAdapter((ButtonBase) objectToAdapt);
    } else if (objectToAdapt instanceof Label) {
        return new LabeledAdapter<Label>((Label) objectToAdapt);
    } else if (objectToAdapt instanceof Text) {
        return new TextAdapter((Text) objectToAdapt);
    } else if (objectToAdapt instanceof TextInputControl) {
        return new TextComponentAdapter((TextInputControl) objectToAdapt);
    } else if (objectToAdapt instanceof DatePicker) {
        return new DatePickerAdapter((DatePicker) objectToAdapt);
    } else if (objectToAdapt instanceof TreeView) {
        return new TreeViewAdapter((TreeView<?>) objectToAdapt);
    } else if (objectToAdapt instanceof TableView) {
        return new TableAdapter((TableView<?>) objectToAdapt);
    } else if (objectToAdapt instanceof ContextMenu) {
        return new ContextMenuAdapter((ContextMenu) objectToAdapt);
    } else if (objectToAdapt instanceof MenuBar) {
        return new MenuBarAdapter((MenuBar) objectToAdapt);
    } else if (objectToAdapt instanceof ImageView) {
        return new JavaFXComponentAdapter<ImageView>((ImageView) objectToAdapt);
    } else if (objectToAdapt instanceof TabPane) {
        return new TabPaneAdapter((TabPane) objectToAdapt);
    } else if (objectToAdapt instanceof TitledPane) {
        return new LabeledAdapter<TitledPane>((TitledPane) objectToAdapt);
    } else if (objectToAdapt instanceof ListView) {
        return new ListViewAdapter<ListView<?>>((ListView<?>) objectToAdapt);
    } else if (objectToAdapt instanceof ComboBox) {
        return new ComboBoxAdapter<ComboBox<?>>((ComboBox<?>) objectToAdapt);
    } else if (objectToAdapt instanceof ChoiceBox) {
        return new ChoiceBoxAdapter((ChoiceBox<?>) objectToAdapt);
    } else if (objectToAdapt instanceof Accordion) {
        return new AccordionAdapter((Accordion) objectToAdapt);
    } else if (objectToAdapt instanceof TreeTableView) {
        return new TreeTableViewAdapter((TreeTableView<?>) objectToAdapt);
    } else if (objectToAdapt instanceof Cell) {
        return new CellAdapter((Cell<?>) objectToAdapt);
    } else if (objectToAdapt instanceof SplitPane) {
        return new SplitPaneAdapter((SplitPane) objectToAdapt);
    } else if (objectToAdapt instanceof Slider) {
        return new SliderAdapter((Slider) objectToAdapt);
    } else if (objectToAdapt instanceof ToolBar) {
        return new ToolBarAdapter((ToolBar) objectToAdapt);
    } else if (objectToAdapt instanceof Shape) {
        return new JavaFXComponentAdapter<Shape>((Shape) objectToAdapt);
    }
    return null;
}
Example 60
Project: Manga-Library-master  File: MangaViewCtrl.java View source code
private ImageView getImage(Path img) {
    Log.debug("loading " + img);
    Image image;
    try (InputStream is = Files.newInputStream(img)) {
        image = new Image(is);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    ImageView imageView = new ImageView(image);
    imageView.setSmooth(true);
    imageView.setPreserveRatio(true);
    return imageView;
}
Example 61
Project: mytime-master  File: VolunteerMainViewController.java View source code
/**
     * Method for giving the controls on the volunteer view icons.
     */
private void setStyleForButtons() {
    btnHourDown.getStyleClass().add("btnVolunteerView");
    btnExecuteHourInput.getStyleClass().add("btnVolunteerView");
    btnHourUp.getStyleClass().add("btnVolunteerView");
    Image imgExecute = new Image("mytime/gui/view/css/checked.png");
    Image imgUp = new Image("mytime/gui/view/css/up-arrow.png");
    Image imgDown = new Image("mytime/gui/view/css/down-arrow.png");
    // simple displays ImageView the image as is
    ImageView iv1 = new ImageView(imgExecute);
    ImageView iv2 = new ImageView(imgUp);
    ImageView iv3 = new ImageView(imgDown);
    iv3.rotateProperty().setValue(180);
    //
    iv1.setFitWidth(30);
    iv2.setFitWidth(30);
    iv3.setFitWidth(30);
    iv1.setFitHeight(50);
    iv2.setFitHeight(50);
    iv3.setFitHeight(50);
    //        Circle clip = new Circle(iv1.getFitHeight() / 2, iv1.getFitWidth() / 3, 26);
    //
    //        iv1.setClip(clip);
    //
    iv1.setPreserveRatio(true);
    iv2.setPreserveRatio(true);
    iv3.setPreserveRatio(true);
    iv1.setSmooth(true);
    iv2.setSmooth(true);
    iv3.setSmooth(true);
    iv1.setCache(true);
    iv2.setCache(true);
    iv3.setCache(true);
    btnHourDown.setGraphic(iv3);
    btnExecuteHourInput.setGraphic(iv1);
    btnHourUp.setGraphic(iv2);
}
Example 62
Project: NeuroSky-master  File: MainGUI.java View source code
private void init(Stage primaryStage) {
    Group root = new Group();
    GridPane pane = new GridPane();
    pane.setPrefSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    primaryStage.setScene(new Scene(pane));
    // create File menu item
    final MenuBar menuBar = new MenuBar();
    final MenuItem exitMenuItem = MenuItemBuilder.create().text("Exit").build();
    exitMenuItem.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent t) {
            System.exit(0);
        }
    });
    // create File menu and add it to Pane
    Menu menu1 = MenuBuilder.create().text("File").items(exitMenuItem).graphic(new ImageView(new Image(MainGUI.class.getResourceAsStream("menuInfo.png")))).build();
    menuBar.getMenus().addAll(menu1);
    //pane.add(menuBar, 0, 0);
    double rate = 0.75;
    double scale = 1.0;
    Double[] idealVals = new Double[defaultNumOutNodes];
    Random idealSeeder = new Random();
    for (int i = 0; i < idealVals.length; i++) {
        idealVals[i] = idealSeeder.nextDouble();
    }
    network = new Network(1, new ChiSquaredDistribution(defaultNumInNodes * defaultNumOutNodes), defaultNumInNodes, defaultNumLayerNodes, defaultNumOutNodes, defaultNumEdges, defaultNumLevels, rate, scale, idealVals, pane);
    Random rng = network.getRNG();
    double nodeRadius = (pane.getHeight() * pane.getWidth()) / (network.getNodes().size() * 2);
    nodeRadius = 25;
    System.out.println("Node radius: " + nodeRadius);
    nodeCircleMap = new ConcurrentHashMap<Node, Circle>();
    for (Node n : network.getNodes()) {
        int x = rng.nextInt(MainGUI.getDefaultWidth());
        int y = rng.nextInt(MainGUI.getDefaultHeight());
        Circle circle = new Circle(x, y, nodeRadius, Color.GREY);
        pane.add(circle, 0, 0);
        nodeCircleMap.put(n, circle);
    }
    edgeLineMap = new ConcurrentHashMap<Edge, Line>();
    for (Edge e : network.getEdges()) {
        Node input = e.getInput();
        Node output = e.getOutput();
        double x1 = nodeCircleMap.get(input).getCenterX();
        double y1 = nodeCircleMap.get(input).getCenterY();
        double x2 = nodeCircleMap.get(output).getCenterX();
        double y2 = nodeCircleMap.get(output).getCenterY();
        Line line = new Line(x1, y1, x2, y2);
        line.setStroke(Color.BLACK);
        pane.add(line, 0, 0);
        edgeLineMap.put(e, line);
    }
    pane.setOnKeyTyped(new EventHandler<KeyEvent>() {

        public void handle(KeyEvent e) {
            System.out.println(e.getCharacter());
            network.run();
        }
    });
    HBox hBox = new HBox();
    Button simButton = new Button("Run next simulation step");
    simButton.setText("Run next simulation step");
    simButton.setOnMouseClicked(new EventHandler<MouseEvent>() {

        public void handle(MouseEvent e) {
            network.run();
        }
    });
    simButton.setVisible(true);
    hBox.getChildren().add(simButton);
    pane.add(hBox, 1, 1);
    root.getChildren().add(pane);
    network.run();
}
Example 63
Project: NuBitsj-master  File: ClickableNuBitsAddress.java View source code
@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<ClickableNuBitsAddress> overlay = Main.instance.overlayUI(pane, this);
    view.setOnMouseClicked( event1 -> overlay.done());
}
Example 64
Project: ShootOFF-master  File: SessionViewerController.java View source code
public void init(Configuration config) {
    this.config = config;
    sessionEntries.addAll(findSessions());
    sessionListView.setItems(sessionEntries);
    togglePlaybackButton.setGraphic(new ImageView(new Image(VideoPlayerController.class.getResourceAsStream("/images/gnome_media_playback_start.png"))));
    sessionListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<File>() {

        @Override
        public void changed(ObservableValue<? extends File> ov, File oldFile, File newFile) {
            if (isPlaying)
                togglePlaybackButton.fire();
            final Optional<SessionRecorder> session = SessionIO.loadSession(new File(System.getProperty("shootoff.home") + File.separator + "sessions" + File.separator + newFile.getName()));
            if (session.isPresent()) {
                refreshFromSlider = false;
                timeSlider.setValue(0);
                refreshFromSlider = true;
                currentSession = session.get();
                updateCameraTabs();
                final Tab selectedTab = cameraTabPane.getSelectionModel().getSelectedItem();
                if (selectedTab != null) {
                    final String cameraName = selectedTab.getText();
                    listCameraEvents(cameraName);
                } else {
                    eventEntries.clear();
                }
            }
        }
    });
    cameraTabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {

        @Override
        public void changed(ObservableValue<? extends Tab> ot, Tab oldTab, Tab newTab) {
            if (newTab == null)
                return;
            if (isPlaying)
                togglePlaybackButton.fire();
            eventSelectionsPerTab.put(oldTab, eventsListView.getSelectionModel().getSelectedIndex());
            listCameraEvents(newTab.getText());
            final List<Event> cameraEvents = currentSession.getCameraEvents(newTab.getText());
            refreshFromSlider = false;
            timeSlider.setValue(0);
            timeSlider.setMax(cameraEvents.get(cameraEvents.size() - 1).getTimestamp());
            refreshFromSlider = true;
            if (eventSelectionsPerTab.containsKey(newTab)) {
                refreshFromSelection = false;
                eventsListView.getSelectionModel().select(eventSelectionsPerTab.get(newTab));
                refreshFromSelection = true;
            }
        }
    });
    eventsListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Event>() {

        @Override
        public void changed(ObservableValue<? extends Event> oe, Event oldEvent, Event newEvent) {
            if (newEvent == null)
                return;
            refreshFromSlider = false;
            if (!isPlaying)
                timeSlider.setValue(newEvent.getTimestamp());
            refreshFromSlider = true;
            if (!refreshFromSelection)
                return;
            final int oldIndex = eventEntries.indexOf(oldEvent);
            final int newIndex = eventEntries.indexOf(newEvent);
            if (oldIndex <= newIndex) {
                updateEvents(oldIndex, newIndex, EventsUpdate.DO);
            } else {
                updateEvents(oldIndex, newIndex, EventsUpdate.UNDO);
            }
        }
    });
    eventsListView.setOnMouseClicked(( event) -> {
        if (event.getClickCount() < 2)
            return;
        final Event selectedEvent = eventEntries.get(eventsListView.getSelectionModel().getSelectedIndex());
        if (selectedEvent instanceof ShotEvent) {
            final ShotEvent se = (ShotEvent) selectedEvent;
            if (!se.getVideoString().isPresent())
                return;
            final FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("com/shootoff/gui/VideoPlayer.fxml"));
            try {
                loader.load();
            } catch (final IOException ioe) {
                ioe.printStackTrace();
            }
            final Stage videoPlayerStage = new Stage();
            final VideoPlayerController controller = (VideoPlayerController) loader.getController();
            controller.init(se.getVideos());
            videoPlayerStage.setTitle("Video Player");
            videoPlayerStage.setScene(new Scene(loader.getRoot()));
            videoPlayerStage.show();
            config.registerVideoPlayer(controller);
            controller.getStage().setOnCloseRequest(( closeEvent) -> {
                config.unregisterVideoPlayer(controller);
            });
        }
    });
    eventsListView.setItems(eventEntries);
    timeSlider.setOnMouseClicked(( event) -> {
        if (isPlaying)
            togglePlaybackButton.fire();
    });
    timeSlider.valueProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observableValue, Number oldValue, Number newValue) {
            if (newValue == null) {
                timeLabel.setText("");
                return;
            }
            setTime(newValue.longValue());
            if (!refreshFromSlider)
                return;
            final List<Event> reversedEntries = new ArrayList<>(eventEntries);
            Collections.reverse(reversedEntries);
            for (final Event e : reversedEntries) {
                if (e.getTimestamp() <= newValue.longValue()) {
                    eventsListView.getSelectionModel().select(e);
                    break;
                }
            }
        }
    });
}
Example 65
Project: SIFResourceExplorer-master  File: MainStage.java View source code
public void run() {
    final Label namelb = (Label) root.lookup("#imgNameLabel");
    namelb.setText(klbFile.getName());
    final ImageView imageView = (ImageView) root.lookup("#imageView");
    imageView.setImage(curImg);
    final Label infolb = (Label) root.lookup("#imgInfoLabel");
    infolb.setText(ApplicationContext.getCurrentTexb().getTexbInfo());
}
Example 66
Project: SlideshowFX-master  File: Tour.java View source code
/**
     * Create the node that contains the instructions to use the tour.
     * @return The Node containing all the instructions necessary to use the tour.
     */
private Node getInstructionsNode() {
    final ImageView escKey = new ImageView(ResourceHelper.getExternalForm("/com/twasyl/slideshowfx/images/esc_key.png"));
    final ImageView leftKey = new ImageView(ResourceHelper.getExternalForm("/com/twasyl/slideshowfx/images/left_key.png"));
    final ImageView rightKey = new ImageView(ResourceHelper.getExternalForm("/com/twasyl/slideshowfx/images/right_key.png"));
    final Label escLabel = new Label("Exit the tour");
    escLabel.setLabelFor(escKey);
    escLabel.setStyle("-fx-text-fill: white;");
    final Label leftLabel = new Label("Previous step of the tour");
    leftLabel.setLabelFor(leftKey);
    leftLabel.setStyle("-fx-text-fill: white;");
    final Label rightLabel = new Label("Next step of the tour");
    rightLabel.setLabelFor(rightKey);
    rightLabel.setStyle("-fx-text-fill: white;");
    final GridPane instructionsPane = new GridPane();
    instructionsPane.addColumn(0, escKey, leftKey, rightKey);
    instructionsPane.addColumn(1, escLabel, leftLabel, rightLabel);
    return instructionsPane;
}
Example 67
Project: sportstracker-master  File: ViewPrinter.java View source code
/**
     * Prints the specified view node completely to one single page.
     *
     * @param printerJob printer job which defines the printer, page layout, ...
     * @param view view node to print
     * @return true when the view was printed successfully
     */
private boolean printViewPage(final PrinterJob printerJob, final Node view) {
    // the view needs to be scaled to fit the selected page layout of the PrinterJob
    // => the passed view node can't be scaled, this would scale the displayed UI
    // => solution: create a snapshot image for printing and scale this image
    final WritableImage snapshot = view.snapshot(null, null);
    final ImageView ivSnapshot = new ImageView(snapshot);
    // compute the needed scaling (aspect ratio must be kept)
    final PageLayout pageLayout = printerJob.getJobSettings().getPageLayout();
    final double scaleX = pageLayout.getPrintableWidth() / ivSnapshot.getImage().getWidth();
    final double scaleY = pageLayout.getPrintableHeight() / ivSnapshot.getImage().getHeight();
    final double scale = Math.min(scaleX, scaleY);
    // scale the calendar image only when it's too big for the selected page
    if (scale < 1.0) {
        ivSnapshot.getTransforms().add(new Scale(scale, scale));
    }
    return printerJob.printPage(ivSnapshot);
}
Example 68
Project: stupidwarriors-master  File: MapGenerator.java View source code
/**
     * add grass to the ground of map
     * @param gameStack StackPane of the game
     */
public static void createMapGrass(StackPane gameStack) {
    Image grass = new Image(Url.GRASS);
    double x = grass.getWidth();
    double y = grass.getHeight();
    for (int i = 0; i < (int) GameController.GAME_WIDTH / x; i++) {
        for (int j = 0; j < (int) GameController.GAME_HEIGHT / y; j++) {
            ImageView grassTemp = new ImageView(grass);
            gameStack.getChildren().add(grassTemp);
            grassTemp.setTranslateX(-GameController.GAME_WIDTH / 2 + (x) * i);
            grassTemp.setTranslateY(-GameController.GAME_HEIGHT / 2 + (y) * j);
            //Optimizer
            grassTemp.setCache(true);
            grassTemp.setCacheHint(CacheHint.SPEED);
        }
    }
}
Example 69
Project: XR3Player-master  File: MultipleLibraries.java View source code
/**
     * Add a new Tab.
     *
     * @param library
     *            the library
     */
public void insertTab(Library library) {
    emptyLabel.setVisible(false);
    // where is "" it must be
    // InfoTool.getMinString(library.getLibraryName(), 15)
    Tab tab = new Tab("", library.getSmartController());
    tab.setTooltip(new Tooltip(library.getLibraryName()));
    // Graphic
    StackPane stack = new StackPane();
    // indicator
    ProgressBar indicator = new ProgressBar();
    indicator.progressProperty().bind(library.getSmartController().getIndicator().progressProperty());
    indicator.setMaxSize(35, 15);
    // text
    Text text = new Text();
    text.setStyle("-fx-font-size:70%; -fx-fill:black;");
    text.textProperty().bind(Bindings.max(0, indicator.progressProperty()).multiply(100.00).asString("%.02f %%"));
    // text.visibleProperty().bind(library.getSmartController().inputService.runningProperty())
    Marquee marquee = new Marquee();
    marquee.textProperty().bind(tab.getTooltip().textProperty());
    //marquee.setStyle("-fx-background-radius:0 0 0 0; -fx-background-color:rgb(255,255,255,0.5); -fx-border-color:transparent;")
    //tab.textProperty().bind(marquee.textProperty())
    stack.getChildren().addAll(indicator, text);
    stack.setManaged(false);
    stack.setVisible(false);
    //ImageView
    ImageView imageView = new ImageView(noItemsImage);
    imageView.visibleProperty().bind(library.getSmartController().totalInDataBaseProperty().isEqualTo(0));
    imageView.managedProperty().bind(imageView.visibleProperty());
    // HBOX
    HBox hBox = new HBox();
    hBox.getChildren().addAll(imageView, stack, marquee);
    // --Drag Over
    hBox.setOnDragOver( dragOver -> {
        if (dragOver.getDragboard().hasFiles()) {
            dragOver.acceptTransferModes(TransferMode.LINK);
            tabPane.getSelectionModel().select(tab);
        }
    });
    // --Drag Dropped
    hBox.setOnDragDropped( drop -> {
        if (drop.getDragboard().hasFiles() && getSelectedLibrary().getSmartController().isFree(true) && drop.getGestureSource() != library.getSmartController().getTableViewer())
            getSelectedLibrary().getSmartController().inputService.start(drop.getDragboard().getFiles());
        drop.setDropCompleted(true);
    });
    // stack
    library.getSmartController().getIndicatorVBox().visibleProperty().addListener(( observable,  oldValue,  newValue) -> {
        if (//if it is visible
        newValue) {
            stack.setManaged(true);
            stack.setVisible(true);
        // tab.setGraphic(hBox)
        } else {
            stack.setManaged(false);
            stack.setVisible(false);
        // tab.setGraphic(null)
        }
    });
    //library.getLibraryProgressIndicator().progressProperty().bind(indicator.progressProperty());
    //library.getLibraryProgressIndicator().visibleProperty().bind(stack.visibleProperty());
    tab.setOnCloseRequest( c -> {
        if (library.getSmartController().isFree(true))
            library.libraryOpenClose(false, false);
        else
            c.consume();
    });
    tab.setGraphic(hBox);
    tabPane.getTabs().add(tab);
    //ContextMenu
    ContextMenu contextMenu = new ContextMenu();
    //--findLibrary
    MenuItem findLibrary = new MenuItem("Go to Library");
    findLibrary.setOnAction( a -> Main.libraryMode.teamViewer.getViewer().setCenterIndex(library.getPosition()));
    contextMenu.getItems().add(findLibrary);
    tab.setContextMenu(contextMenu);
}
Example 70
Project: bitcoinj-master  File: ClickableBitcoinAddress.java View source code
@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( event1 -> overlay.done());
}
Example 71
Project: bitcoinj-watcher-service-master  File: ClickableBitcoinAddress.java View source code
@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();
        }
    });
}
Example 72
Project: context-master  File: NextStepsViewController.java View source code
/**
     *
     * @param text
     * @param event
     */
public void addNextStepItem(String text, EventHandler<? super MouseEvent> event) {
    Label label = new Label(text);
    label.setOnMouseClicked(event);
    final ImageView imageView = new ImageView("resources/Actions-go-next-view-icon48.png");
    imageView.setFitHeight(22);
    imageView.setFitWidth(22);
    label.setGraphic(imageView);
    label.getStyleClass().add("nextstepsLabel");
    vbox.getChildren().add(label);
}
Example 73
Project: Corendon-master  File: EmployeeController.java View source code
private void showLoadingIcon() {
    // Show a spinning icon to indicate to the user that we are getting the tableData
    Image image = new Image("img/loader.gif", 64, 65, true, false);
    spinningIcon = new ImageView(image);
    spinningIcon = new ImageView("img/loader.gif");
    iconPane = new StackPane(spinningIcon);
    iconPane.setPrefWidth(luggageInfo.getPrefWidth());
    iconPane.setPrefHeight(luggageInfo.getPrefHeight());
    LuggageTable.getChildren().add(iconPane);
}
Example 74
Project: darkcoinj-master  File: ClickableBitcoinAddress.java View source code
@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();
        }
    });
}
Example 75
Project: DockFX-master  File: DockFX.java View source code
@SuppressWarnings("unchecked")
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("DockFX");
    // create a dock pane that will manage our dock nodes and handle the layout
    DockPane dockPane = new DockPane();
    // create a default test node for the center of the dock area
    TabPane tabs = new TabPane();
    HTMLEditor htmlEditor = new HTMLEditor();
    try {
        htmlEditor.setHtmlText(new String(Files.readAllBytes(Paths.get("readme.html"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    // empty tabs ensure that dock node has its own background color when floating
    tabs.getTabs().addAll(new Tab("Tab 1", htmlEditor), new Tab("Tab 2"), new Tab("Tab 3"));
    TableView<String> tableView = new TableView<String>();
    // this is why @SupressWarnings is used above
    // we don't care about the warnings because this is just a demonstration
    // for docks not the table view
    tableView.getColumns().addAll(new TableColumn<String, String>("A"), new TableColumn<String, String>("B"), new TableColumn<String, String>("C"));
    // load an image to caption the dock nodes
    Image dockImage = new Image(DockFX.class.getResource("docknode.png").toExternalForm());
    // create and dock some prototype dock nodes to the middle of the dock pane
    // the preferred sizes are used to specify the relative size of the node
    // to the other nodes
    // we can use this to give our central content a larger area where
    // the top and bottom nodes have a preferred width of 300 which means that
    // when a node is docked relative to them such as the left or right dock below
    // they will have 300 / 100 + 300 (400) or 75% of their previous width
    // after both the left and right node's are docked the center docks end up with 50% of the width
    DockNode tabsDock = new DockNode(tabs, "Tabs Dock", new ImageView(dockImage));
    tabsDock.setPrefSize(300, 100);
    tabsDock.dock(dockPane, DockPos.TOP);
    DockNode tableDock = new DockNode(tableView);
    // let's disable our table from being undocked
    tableDock.setDockTitleBar(null);
    tableDock.setPrefSize(300, 100);
    tableDock.dock(dockPane, DockPos.BOTTOM);
    primaryStage.setScene(new Scene(dockPane, 800, 500));
    primaryStage.sizeToScene();
    primaryStage.show();
    // can be created and docked before or after the scene is created
    // and the stage is shown
    DockNode treeDock = new DockNode(generateRandomTree(), "Tree Dock", new ImageView(dockImage));
    treeDock.setPrefSize(100, 100);
    treeDock.dock(dockPane, DockPos.LEFT);
    treeDock = new DockNode(generateRandomTree(), "Tree Dock", new ImageView(dockImage));
    treeDock.setPrefSize(100, 100);
    treeDock.dock(dockPane, DockPos.RIGHT);
    // test the look and feel with both Caspian and Modena
    Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
    // initialize the default styles for the dock pane and undocked nodes using the DockFX
    // library's internal Default.css stylesheet
    // unlike other custom control libraries this allows the user to override them globally
    // using the style manager just as they can with internal JavaFX controls
    // this must be called after the primary stage is shown
    // https://bugs.openjdk.java.net/browse/JDK-8132900
    DockPane.initializeDefaultUserAgentStylesheet();
// TODO: after this feel free to apply your own global stylesheet using the StyleManager class
}
Example 76
Project: ElggConnect-master  File: Notification.java View source code
/**
         * Creates and shows a popup with the data from the given Notification object
         *
         * @param NOTIFICATION
         */
private void showPopup(final Notification NOTIFICATION) {
    ImageView icon = new ImageView(NOTIFICATION.IMAGE);
    icon.setFitWidth(ICON_WIDTH);
    icon.setFitHeight(ICON_HEIGHT);
    Hyperlink link = new Hyperlink(NOTIFICATION.MESSAGE, icon);
    link.getStyleClass().add("message");
    Label title = new Label(NOTIFICATION.TITLE);
    title.getStyleClass().add("title");
    VBox popupLayout = new VBox();
    popupLayout.setSpacing(10);
    popupLayout.setPadding(new Insets(10, 10, 10, 10));
    popupLayout.getChildren().addAll(title, link);
    StackPane popupContent = new StackPane();
    popupContent.setPrefSize(width, height);
    popupContent.getStyleClass().add("notification");
    popupContent.getChildren().addAll(popupLayout);
    final Popup POPUP = new Popup();
    POPUP.setX(getX());
    POPUP.setY(getY());
    POPUP.getContent().add(popupContent);
    popups.add(POPUP);
    // Add a timeline for popup fade out
    KeyValue fadeOutBegin = new KeyValue(POPUP.opacityProperty(), 1.0);
    KeyValue fadeOutEnd = new KeyValue(POPUP.opacityProperty(), 0.0);
    KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
    KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd);
    //timeline
    Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(popupLifetime);
    //Timeline for clicking notification
    Timeline timelineClose = new Timeline(kfBegin, kfEnd);
    timelineClose.setDelay(Duration.millis(500));
    //Close Notification on click
    popupContent.setOnMouseClicked( evt -> timelineClose.play());
    // Handle Hyperlink event.
    link.setOnAction(( event) -> {
        URLHandler.openURL(Main.BASE_URL + NOTIFICATION.URL);
        timelineClose.play();
    });
    timelineClose.setOnFinished( actionEvent -> Platform.runLater(() -> {
        POPUP.hide();
        popups.remove(POPUP);
    }));
    timeline.setOnFinished( actionEvent -> Platform.runLater(() -> {
        POPUP.hide();
        popups.remove(POPUP);
    }));
    if (stage.isShowing()) {
        stage.toFront();
    } else {
        stage.show();
    }
    POPUP.show(stage);
    timeline.play();
}
Example 77
Project: FXyzLib-master  File: Skybox.java View source code
private void layoutViews() {
    for (ImageView v : views) {
        v.setFitWidth(getSize());
        v.setFitHeight(getSize());
    }
    back.setTranslateX(-0.5 * getSize());
    back.setTranslateY(-0.5 * getSize());
    back.setTranslateZ(-0.5 * getSize());
    front.setTranslateX(-0.5 * getSize());
    front.setTranslateY(-0.5 * getSize());
    front.setTranslateZ(0.5 * getSize());
    front.setRotationAxis(Rotate.Z_AXIS);
    front.setRotate(-180);
    front.getTransforms().add(new Rotate(180, front.getFitHeight() / 2, 0, 0, Rotate.X_AXIS));
    front.setTranslateY(front.getTranslateY() - getSize());
    top.setTranslateX(-0.5 * getSize());
    top.setTranslateY(-1 * getSize());
    top.setRotationAxis(Rotate.X_AXIS);
    top.setRotate(-90);
    bottom.setTranslateX(-0.5 * getSize());
    bottom.setTranslateY(0);
    bottom.setRotationAxis(Rotate.X_AXIS);
    bottom.setRotate(90);
    left.setTranslateX(-1 * getSize());
    left.setTranslateY(-0.5 * getSize());
    left.setRotationAxis(Rotate.Y_AXIS);
    left.setRotate(90);
    right.setTranslateX(0);
    right.setTranslateY(-0.5 * getSize());
    right.setRotationAxis(Rotate.Y_AXIS);
    right.setRotate(-90);
}
Example 78
Project: GreenBits-master  File: ClickableBitcoinAddress.java View source code
@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( event1 -> overlay.done());
}
Example 79
Project: JFTClient-master  File: NodeTreeCell.java View source code
@Override
protected void updateItem(Node item, boolean empty) {
    super.updateItem(item, empty);
    if (!empty && item != null) {
        if (getTreeItem().getValue().isFile()) {
            setContextMenu(contextFileMenu);
        } else {
            setContextMenu(contextFolderMenu);
        }
        setText(item.getName());
        if (item.isFile()) {
            currentImage = FILE_IMAGE;
        } else {
            if (getTreeItem().isExpanded()) {
                currentImage = FOLDER_EXPAND_IMAGE;
            } else {
                currentImage = FOLDER_COLLAPSE_IMAGE;
            }
        }
        setGraphic(new ImageView(currentImage));
        if (item.getLinkDest() != null) {
            setTextFill(Color.BLUE);
        } else {
            setTextFill(Color.BLACK);
        }
    } else {
        setText(null);
        setGraphic(null);
    }
}
Example 80
Project: jidefx-oss-master  File: ValidationDemo.java View source code
private Region installValidatorsForSignUpForm(final Region pane) {
    String prefix = DemoData.PREFIX_SIGNUP_FORM;
    TextField emailField = (TextField) pane.lookup("#" + prefix + "emailField");
    TextField confirmEmailField = (TextField) pane.lookup("#" + prefix + "confirmEmailField");
    SimpleValidator emailValidator = new SimpleValidator(EmailValidator.getInstance()) {

        @Override
        public ValidationEvent call(ValidationObject param) {
            ValidationEvent event = super.call(param);
            if (!ValidationEvent.VALIDATION_OK.equals(event.getEventType()) || emailField.getText().equals(confirmEmailField.getText())) {
                return event;
            } else {
                return new ValidationEvent(ValidationEvent.VALIDATION_ERROR, 0, "Two emails are not the same!");
            }
        }
    };
    ValidationUtils.install(emailField, new SimpleValidator(EmailValidator.getInstance()));
    ValidationUtils.install(emailField, new Validator() {

        @Override
        public ValidationEvent call(ValidationObject param) {
            if (emailField.getText().trim().length() == 0) {
                return new ValidationEvent(ValidationEvent.VALIDATION_ERROR, 0, "The email cannot be empty!");
            } else
                return new SimpleValidator(EmailValidator.getInstance()).call(param);
        }
    }, ValidationMode.ON_DEMAND);
    ValidationUtils.install(confirmEmailField, emailValidator);
    Validator countryValidator = new Validator() {

        @Override
        public ValidationEvent call(ValidationObject param) {
            if ("United States".equals(param.getNewValue())) {
                return ValidationEvent.OK;
            } else if (param.getNewValue() == null) {
                return new ValidationEvent(ValidationEvent.VALIDATION_ERROR, 0, "Please select a country!");
            } else {
                return new ValidationEvent(ValidationEvent.VALIDATION_WARNING, 0, "We only support signing up in United States at the moment!");
            }
        }
    };
    ChoiceBox countryChoiceBox = (ChoiceBox) pane.lookup("#" + prefix + "countryChoiceBox");
    ValidationUtils.install(countryChoiceBox, countryValidator, ValidationMode.ON_DEMAND);
    ValidationUtils.install(countryChoiceBox, countryValidator, ValidationMode.ON_FLY);
    TextField passwordField = (TextField) pane.lookup("#" + prefix + "passwordField");
    TextField confirmPasswordField = (TextField) pane.lookup("#" + prefix + "confirmPasswordField");
    Validator passwordEmptyValidator = new Validator() {

        @Override
        public ValidationEvent call(ValidationObject param) {
            if (passwordField.getText().trim().length() == 0) {
                return new ValidationEvent(ValidationEvent.VALIDATION_ERROR, 0, "The password cannot be empty!");
            } else
                return ValidationEvent.OK;
        }
    };
    ValidationUtils.install(passwordField, passwordEmptyValidator, ValidationMode.ON_DEMAND);
    ValidationUtils.install(passwordField, passwordEmptyValidator, ValidationMode.ON_FLY);
    ValidationUtils.install(confirmPasswordField, new Validator() {

        @Override
        public ValidationEvent call(ValidationObject param) {
            if (!passwordField.getText().equals(confirmPasswordField.getText())) {
                return new ValidationEvent(ValidationEvent.VALIDATION_ERROR, 0, "The two password are different!");
            } else
                return ValidationEvent.OK;
        }
    }, ValidationMode.ON_FOCUS_LOST);
    Button signUpButton = (Button) pane.lookup("#" + prefix + "signUpButton");
    signUpButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            ValidationUtils.validateOnDemand(pane);
        }
    });
    ValidationGroup validationGroup = new ValidationGroup(emailField, passwordField);
    signUpButton.disableProperty().bind(validationGroup.invalidProperty());
    validationGroup.invalidProperty().addListener(( observable,  oldValue,  newValue) -> {
        System.out.println(newValue);
    });
    ValidationUtils.forceValidate(emailField, ValidationMode.ON_FLY);
    ValidationUtils.forceValidate(passwordField, ValidationMode.ON_FLY);
    // add a large help icon to the sign-up button
    Label helpLabel = new Label("", new ImageView(new Image("/jidefx/examples/decoration/help.png")));
    DecorationUtils.install(signUpButton, new Decorator<>(helpLabel, Pos.CENTER_RIGHT, new Point2D(100, 0)));
    helpLabel.setTooltip(new Tooltip("This is a demo to show you how to do validation involving two fields. Both email and password fields" + "\ninvolves validation to ensure both value are the same. In addition to that, it also shows you how to use" + "\nEmailValidator to check for a valid email address. The country choice box will show a validation warning" + "\nif the selected country is not United States."));
    return new DecorationPane(pane);
}
Example 81
Project: jitwatch-master  File: ClassTree.java View source code
private TreeItem<Object> findOrCreateTreeItem(final TreeItem<Object> parent, final Object value) {
    ObservableList<TreeItem<Object>> children = parent.getChildren();
    TreeItem<Object> found = null;
    int placeToInsert = 0;
    boolean foundInsertPos = false;
    for (TreeItem<Object> child : children) {
        int stringCompare = child.getValue().toString().compareTo(value.toString());
        if (stringCompare == 0) {
            found = child;
            break;
        } else if (!foundInsertPos && stringCompare < 0) {
            if (not(child.getValue() instanceof MetaPackage && value instanceof MetaClass)) {
                placeToInsert++;
            }
        } else {
            if (child.getValue() instanceof MetaPackage && value instanceof MetaClass) {
                placeToInsert++;
            } else {
                foundInsertPos = true;
            }
        }
    }
    if (found == null) {
        found = new TreeItem<Object>(value);
        children.add(placeToInsert, found);
        if (value instanceof MetaPackage) {
            final String packageName = value.toString();
            found.expandedProperty().addListener(new ChangeListener<Boolean>() {

                @Override
                public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
                    if (newValue != null) {
                        if (newValue == true) {
                            openPackageNodes.add(packageName);
                        } else {
                            openPackageNodes.remove(packageName);
                        }
                    }
                }
            });
            if (sameVmCommand && openPackageNodes.contains(packageName)) {
                found.setExpanded(true);
            }
        }
    }
    boolean hasCompiledChildren = false;
    if (value instanceof MetaPackage && ((MetaPackage) value).hasCompiledClasses()) {
        hasCompiledChildren = true;
    } else if (value instanceof MetaClass && ((MetaClass) value).hasCompiledMethods()) {
        hasCompiledChildren = true;
    }
    if (UserInterfaceUtil.IMAGE_TICK != null && hasCompiledChildren) {
        found.setGraphic(new ImageView(UserInterfaceUtil.IMAGE_TICK));
    }
    return found;
}
Example 82
Project: jskat-multimodule-master  File: JSkatFX.java View source code
@Override
public void init() {
    ImageView splashScreenImage = new ImageView(new Image(JSkatFX.class.getResource("/org/jskat/gui/img/gui/splash.png").toExternalForm()));
    splashScreenProgressBar = new ProgressBar();
    splashScreenProgressBar.setPrefWidth(SPLASH_WIDTH);
    splashScreenProgressText = new Label("Loading JSkat...");
    splashScreenProgressText.setAlignment(Pos.CENTER);
    splashScreenLayout = new VBox();
    splashScreenLayout.getChildren().addAll(splashScreenImage, splashScreenProgressBar, splashScreenProgressText);
    splashScreenLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: #e2d9ca; " + "-fx-border-width:2; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "chocolate, " + "derive(chocolate, 50%)" + ");");
    splashScreenLayout.setEffect(new DropShadow());
}
Example 83
Project: latexdraw-master  File: LaTeXDraw.java View source code
@Override
public void init() {
    Image img = new Image("res/LaTeXDrawSmall.png");
    ImageView splash = new ImageView(img);
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(img.getWidth());
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress);
    splashLayout.setEffect(new DropShadow());
}
Example 84
Project: livestreamer-twitch-gui-master  File: MainController.java View source code
private void showNotifications(List<Stream> oldStreamList) {
    if (settings.isNotifications()) {
        streamList.getItems().stream().filter(Objects::nonNull).filter( s -> !oldStreamList.contains(s)).forEach( s -> {
            ImageView img = new ImageView(s.getLogo());
            img.setFitHeight(40.0);
            img.setFitWidth(40.0);
            Notifications.create().title(s.getName() + " just went live!").text(s.getStatus()).graphic(img).onAction( e -> launchLivestreamer(s.getUrl())).hideAfter(Duration.seconds(NOTIFICATION_DURATION)).darkStyle().show();
        });
    }
}
Example 85
Project: MasteringTables-master  File: ResultView.java View source code
/**
     * {@inheritDoc}
     */
@Override
protected void initView() {
    node().setFocusTraversable(true);
    final String beanPath = "M264.489,353.896h0.152c-10.026-28-15.393-58.608-15.192-90.053c0.21-33.038,6.578-64.879,17.979-93.896" + "c-0.077,0.192-0.156,0.299-0.229,0.491c3.331-11.38,5.158-23.444,5.236-35.892C272.895,62.568,214.922,3.827,142.943,3.364" + "c-71.979-0.46-130.7,57.504-131.16,129.482c-0.081,12.446,1.591,24.485,4.778,35.907c-0.073-0.192-0.15-0.387-0.224-0.578" + "c11.027,29.158,16.985,61.041,16.776,94.078c-0.203,31.442-5.963,61.643-16.347,89.643h0.15c-4.319,13-6.706,26.28-6.799,40.542" + "C9.66,464.417,67.636,523.015,139.613,523.474c71.979,0.459,130.693-57.118,131.155-129.096" + "C270.861,380.109,268.652,365.896,264.489,353.896z";
    this.timeBean = SVGPathBuilder.create().content(beanPath).scaleX(1.0).scaleY(1.0).layoutX(80).layoutY(14).rotate(-34.0).fill(Color.LIGHTGREY).effect(getDropShadow()).build();
    this.successBean = SVGPathBuilder.create().content(beanPath).scaleX(0.84).scaleY(0.84).layoutX(270).layoutY(80).rotate(62.0).fill(Color.LIGHTGREY).effect(getDropShadow()).build();
    this.failureBean = SVGPathBuilder.create().content(beanPath).scaleX(0.73).scaleY(0.73).layoutX(460).layoutY(85).rotate(-58).fill(Color.LIGHTGREY).effect(getDropShadow()).build();
    this.ratioCircle = CircleBuilder.create().fill(Color.LIGHTGREY).radius(150).layoutX(154).layoutY(154).effect(getDropShadow()).build();
    // Image
    this.successIcon = new ImageView(MTImages.RESULT_SUCCESS_ICON.get());
    this.successIcon.setLayoutX(495);
    this.successIcon.setLayoutY(195);
    this.successIcon.setOpacity(0);
    this.failureIcon = new ImageView(MTImages.RESULT_FAILURE_ICON.get());
    this.failureIcon.setLayoutX(666);
    this.failureIcon.setLayoutY(320);
    this.failureIcon.setOpacity(0);
    this.monsterImage = ImageViewBuilder.create().image(MTImages.RESULT_MONSTER.get()).scaleX(0.9).scaleY(0.9).layoutX(410).layoutY(1200).build();
    this.ratioLabel = LabelBuilder.create().id("ResultRatioLabel").layoutX(28).layoutY(80).scaleX(0).scaleY(0).build();
    this.timeLabel = LabelBuilder.create().id("ResultTimeLabel").layoutX(170).layoutY(330).scaleX(0).scaleY(0).build();
    this.successLabel = LabelBuilder.create().id("ResultSuccessLabel").layoutX(444).layoutY(255).scaleX(0).scaleY(0).build();
    this.failureLabel = LabelBuilder.create().id("ResultFailureLabel").layoutX(645).layoutY(390).scaleX(0).scaleY(0).build();
    printResult = new Button("Print Results");
    printResult.setLayoutX(40);
    printResult.setLayoutY(540);
    final Pane p = PaneBuilder.create().prefHeight(600).prefWidth(800).minHeight(600).minWidth(800).children(this.failureBean, this.successBean, this.timeBean, this.ratioCircle, this.monsterImage, this.successIcon, this.failureIcon, this.timeLabel, this.successLabel, this.failureLabel, this.ratioLabel, this.printResult).build();
    node().setCenter(p);
}
Example 86
Project: megacoinj-master  File: ClickableBitcoinAddress.java View source code
@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();
        }
    });
}
Example 87
Project: mqtt-spy-master  File: DragAndDropTreeViewCell.java View source code
@Override
protected void updateItem(final ConnectionTreeItemProperties item, final boolean empty) {
    super.updateItem(item, empty);
    this.item = item;
    if (item == null) {
        setText(null);
        setGraphic(null);
    } else {
        ImageView image;
        if (!item.isGroup()) {
            image = ImageUtils.createIcon("mqtt-icon", 18);
        } else {
            if (item.getGroup().getID().equals(BaseConfigurationUtils.DEFAULT_GROUP)) {
                setDisclosureNode(null);
            }
            if (item.getChildren().isEmpty()) {
                image = ImageUtils.createIcon("folder-grey", 18);
            } else {
                image = ImageUtils.createIcon("folder-yellow", 18);
            }
        }
        setText(item.getName());
        setGraphic(image);
    }
}
Example 88
Project: speedment-master  File: SpeedmentIcon.java View source code
public static ImageView forNode(Document node) {
    requireNonNull(node);
    final Optional<String> path = Optional.of(node).filter(HasIconPath.class::isInstance).map(HasIconPath.class::cast).map(HasIconPath::getIconPath);
    if (path.isPresent()) {
        final InputStream stream = SpeedmentIcon.class.getResourceAsStream(path.get());
        if (stream != null) {
            return new ImageView(new Image(stream));
        } else {
            LOGGER.error("Config node '" + node.getClass().getSimpleName() + "' specified a custom icon '" + path.get() + "' that could not be loaded.");
        }
    }
    final SpeedmentIcon icon = NODE_ICONS.get(Optional.of(node).filter(HasMainInterface.class::isInstance).map(HasMainInterface.class::cast).map(HasMainInterface::mainInterface).orElse(node.getClass()));
    if (icon != null) {
        return icon.view();
    } else {
        LOGGER.error("Found no predefined icon for node type '" + node.getClass().getSimpleName() + "'.");
        return SpeedmentIcon.HELP.view();
    }
}
Example 89
Project: TerasologyLauncher-master  File: TerasologyLauncher.java View source code
@Override
public void init() throws Exception {
    ImageView splash = new ImageView(BundleUtils.getFxImage("splash"));
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label();
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    progressText.setAlignment(Pos.CENTER);
    splashLayout.getStylesheets().add(BundleUtils.getStylesheet("css_splash"));
    splashLayout.setEffect(new DropShadow());
    hostServices = getHostServices();
}
Example 90
Project: tokanagrammar-dev-master  File: DifficultyScreen.java View source code
public void populateFeatures() {
    imgDisplay = DifficultyScreenController.getImgDisplay();
    textPane = DifficultyScreenController.getTextPane();
    slider = DifficultyScreenController.getSlider();
    //Display the text about how the difficulty works.
    textPane.setPadding(new Insets(5, 5, 5, 5));
    textPane.setMaxWidth(textPane.getWidth());
    String message = "Increasing the difficulty will remove more " + "tokens from the original source file.";
    //Remind the user will have to restart the game if difficulty sel here.
    if (GUI.getInstance().getCurGameState().equals(GameState.START_GAME))
        message += " You will have to reset the board to do this now.";
    //Write the message to the textPane portion of the window.
    Label label = new Label(message);
    label.setStyle("-fx-font-size: 20;" + "-fx-text-fill: rgb(255, 255, 85);");
    label.setLayoutX(10);
    label.setLayoutY(20);
    label.setWrapText(true);
    label.setMaxWidth(textPane.getMaxWidth());
    textPane.getChildren().add(label);
    //When the slider moves on a certain increment, switch the image.
    slider.setBlockIncrement(10);
    slider.setMajorTickUnit(10);
    //The icons used to display the difficulty are created with the MAIN
    //CONTROLLER, since it's responsible for displaying the difficultyLevel.
    final HashMap<Integer, ImageView> imgViewTable = Controller.getImgViewTable();
    //If it's the first run, we know that the needle should be at about 50%.
    if (firstRun) {
        curImgInDisplay = imgViewTable.get(GUI.getInstance().getCurDifficulty() / DIVISOR);
        slider.setValue(50);
        firstRun = false;
    } else {
        //Automatic reposition the img and the slider at the correct val.
        curImgInDisplay = imgViewTable.get(curDifficultyLevel / DIVISOR);
        slider.setValue(curDifficultyLevel);
    }
    imgDisplay.getChildren().add(curImgInDisplay);
    slider.valueProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            curDifficultyLevel = (int) slider.getValue();
            if (curDifficultyLevel % DIVISOR == 0) {
                imgDisplay.getChildren().remove(curImgInDisplay);
                curImgInDisplay = imgViewTable.get(curDifficultyLevel / DIVISOR);
                imgDisplay.getChildren().add(curImgInDisplay);
            }
        }
    });
}
Example 91
Project: TwoFactorBtcWallet-master  File: ClickableBitcoinAddress.java View source code
@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();
        }
    });
}
Example 92
Project: VisibleTesla-master  File: BaseController.java View source code
protected <K> void updateImages(K key, Map<K, ImageView[]> imageMap, Map<K, K> equivs) {
    // Turn off all images
    for (ImageView[] images : imageMap.values()) {
        for (ImageView image : images) {
            image.setVisible(false);
        }
    }
    // Turn appropriate images on
    K mapped = equivs.get(key);
    if (mapped != null)
        key = mapped;
    ImageView[] images = imageMap.get(key);
    for (ImageView image : images) {
        image.setVisible(true);
    }
}
Example 93
Project: webcam-capture-master  File: WebCamAppLauncher.java View source code
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Connecting Camera Device Using Webcam Capture API");
    root = new BorderPane();
    topPane = new FlowPane();
    topPane.setAlignment(Pos.CENTER);
    topPane.setHgap(20);
    topPane.setOrientation(Orientation.HORIZONTAL);
    topPane.setPrefHeight(40);
    root.setTop(topPane);
    webCamPane = new BorderPane();
    webCamPane.setStyle("-fx-background-color: #ccc;");
    imgWebCamCapturedImage = new ImageView();
    webCamPane.setCenter(imgWebCamCapturedImage);
    root.setCenter(webCamPane);
    createTopPanel();
    bottomCameraControlPane = new FlowPane();
    bottomCameraControlPane.setOrientation(Orientation.HORIZONTAL);
    bottomCameraControlPane.setAlignment(Pos.CENTER);
    bottomCameraControlPane.setHgap(20);
    bottomCameraControlPane.setVgap(10);
    bottomCameraControlPane.setPrefHeight(40);
    bottomCameraControlPane.setDisable(true);
    createCameraControls();
    root.setBottom(bottomCameraControlPane);
    primaryStage.setScene(new Scene(root));
    primaryStage.setHeight(700);
    primaryStage.setWidth(600);
    primaryStage.centerOnScreen();
    primaryStage.show();
    Platform.runLater(new Runnable() {

        @Override
        public void run() {
            setImageViewSize();
        }
    });
}
Example 94
Project: chunky-master  File: UpdateDialogController.java View source code
@Override
protected void updateItem(VersionInfo.LibraryStatus status, boolean empty) {
    if (status != null) {
        InputStream imageStream = null;
        switch(status) {
            case PASSED:
            case DOWNLOADED_OK:
                imageStream = getClass().getResourceAsStream("cached.png");
                break;
            case MD5_MISMATCH:
            case MISSING:
                imageStream = getClass().getResourceAsStream("refresh.png");
                break;
            case INCOMPLETE_INFO:
            case MALFORMED_URL:
            case FILE_NOT_FOUND:
            case DOWNLOAD_FAILED:
                imageStream = getClass().getResourceAsStream("failed.png");
                break;
        }
        if (imageStream != null) {
            ImageView image = new ImageView(new Image(imageStream));
            setGraphic(image);
        }
        setText(status.downloadStatus());
    }
}
Example 95
Project: iliasDownloaderTool-master  File: CoursesTreeView.java View source code
private void update() {
    if (node instanceof IliasFolder) {
        IliasFolder folder = (IliasFolder) node;
        box.setGraphic(folder.getGraphic());
    } else if (node instanceof IliasFile) {
        IliasFile file = (IliasFile) node;
        box.setGraphic(file.getGraphic());
    } else if (node instanceof IliasForum) {
        box.setGraphic(new ImageView("img/forum.png"));
    }
    box.setText(node.toString());
    actions.getChildren().clear();
    if (!(node instanceof IliasForum)) {
        actions.getChildren().add(downloadButton);
    }
    if (node instanceof IliasFile) {
        if (((IliasFile) node).isIgnored()) {
            ignoreButton.setGraphic(new ImageView("img/check.png"));
        } else {
            ignoreButton.setGraphic(new ImageView("img/ignore.png"));
        }
        actions.getChildren().add(ignoreButton);
        actions.getChildren().add(openerButton);
        actions.getChildren().add(printerButton);
    }
    downloadButton.visibleProperty().bind(hoverProperty());
    downloadButton.mouseTransparentProperty().bind(hoverProperty().not());
    ignoreButton.visibleProperty().bind(hoverProperty());
    ignoreButton.mouseTransparentProperty().bind(hoverProperty().not());
    openerButton.visibleProperty().bind(hoverProperty());
    openerButton.mouseTransparentProperty().bind(hoverProperty().not());
    printerButton.visibleProperty().bind(hoverProperty());
    printerButton.mouseTransparentProperty().bind(hoverProperty().not());
}
Example 96
Project: JavaFX-AlienRallye-master  File: JavaFXAlienRallye.java View source code
@Override
public void start(Stage primaryStage) {
    Pane root = new Pane();
    // Parse the SVG Path with Apache Batik and create a Path
    PathParser parser = new PathParser();
    JavaFXPathElementHandler handler = new JavaFXPathElementHandler("track");
    parser.setPathHandler(handler);
    // parser.parse("M 150 50 L 550,50 A 50 50 0 0 1 600,100 L 600,350 A 50 50 0 0 1 550,400 L 400,400 A 50 50 0 0 1 350,350 L 350,300 A 50 50 0 0 0 300,250 L 250,250 A 50 50 0 0 0 200,300 L 200,450 A 50,50 0 0 1 150,500 A 50 50 0 0 1 100,450 L 100,100 A 50 50 0 0 1 150,50 z");
    parser.parse("M102,135c0,-1 0.693436,-2.458801 2,-3c0.923882,-0.38269 2,-1 3,-2c1,-1 2,-2 3,-3c1,-1 1.292892,-1.292892 2,-2c0.707108,-0.707108 1.693436,-0.458801 3,-1c0.923882,-0.382683 2.693436,-1.458801 4,-2c2.771637,-1.148048 5.026749,-0.770248 6,-1c2.176254,-0.513741 2.85273,-3.173096 4,-4c1.813995,-1.307449 3.298691,-0.94854 5,-2c1.902115,-1.175568 3.07843,-1.789848 6,-3c2.065857,-0.855705 5,-2 9,-4c2,-1 4.186005,-1.692551 6,-3c1.147263,-0.826904 1.693436,-2.458801 3,-3c1.847763,-0.765366 2.852737,-1.173096 4,-2c1.813995,-1.307449 2.693436,-1.458801 4,-2c1.847763,-0.765366 3.152237,-0.234634 5,-1c1.306564,-0.541199 2.693436,-1.458801 4,-2c0.923874,-0.382683 3.053497,-0.540497 5,-1c2.176254,-0.513741 4.412079,-0.968552 8,-3c2.461304,-1.393562 3,-3 5,-3c0,0 1.076126,0.382683 2,0c1.306564,-0.541199 3,-3 5,-3c1,0 1.173096,-0.85273 2,-2c1.307449,-1.813995 5,-5 10,-8c5,-3 8.769928,-4.54863 13,-6c4.823029,-1.654816 8,-1 11,-1c4,0 7,0 10,0c5,0 9.029205,0.591225 15,0c5.074219,-0.502449 9.920349,-2.167961 14,-4c4.912567,-2.206066 9.076904,-2.731445 13,-4c5.123962,-1.656849 8.927673,-3.231731 15,-5c3.958679,-1.152771 9.016907,-1.903393 15,-3c5.015472,-0.919258 9.878571,-1.493458 13,-2c3.948364,-0.640728 9.038727,0.480545 12,0c3.121429,-0.506542 6.01947,-0.60585 10,-1c5.074219,-0.502445 8,-1 12,-1c5,0 10.012573,-0.645554 15,-1c7.053284,-0.501263 14.009064,-1.929871 22,-3c7.008514,-0.938564 17,-1 25,-2c8,-1 16.946716,-1.498737 24,-2c4.987427,-0.354446 12.023865,-0.422638 19,-1c6.062042,-0.501709 11.029205,-0.408775 17,-1c5.074219,-0.502445 7.925781,-1.497555 13,-2c4.975677,-0.492687 9.925781,-0.497555 15,-1c4.975647,-0.492687 9,0 14,0c4,0 8,0 11,0c4,0 6.076111,-0.382683 7,0c1.30658,0.541195 1,2 1,3c0,1 0,2 0,4c0,1 0,4 0,5c0,2 0,4 0,5c0,1 0,3 0,3c0,1 0.707092,3.292892 0,4c-0.707092,0.707108 -2,1 -3,2c-1,1 -2.292908,1.292892 -3,2c-0.707092,0.707108 -1.705444,1.346191 -4,3c-1.813965,1.307449 -4.042908,1.710213 -5,2c-3.450867,1.04483 -5,3 -7,3c-1,0 -2.152222,0.234634 -4,1c-1.30658,0.541199 -4.015015,0.75563 -6,1c-4.092224,0.503777 -7.022491,1.633453 -10,2c-4.092224,0.503777 -6.647491,1.972511 -11,3c-2.919739,0.689262 -5.878571,1.493462 -9,2c-1.974182,0.320366 -5.038727,0.519455 -8,1c-3.121429,0.506538 -5.038727,0.519455 -8,1c-3.121429,0.506538 -5.925781,1.497551 -11,2c-2.985413,0.295616 -7,1 -11,1c-5,0 -9,0 -13,0c-5,0 -9,0 -14,0c-4,0 -9,0 -14,0c-4,0 -8,0 -12,0c-4,0 -9,0 -12,0c-3,0 -7,0 -10,0c-2,0 -5,0 -7,0c-3,0 -6,0 -9,0c-2,0 -4,0 -7,0c-2,0 -4,0 -6,0c-2,0 -5,1 -8,1c-2,0 -4.934143,1.144295 -7,2c-2.92157,1.210152 -4.852722,1.173096 -6,2c-1.813995,1.307449 -4,3 -6,4c-2,1 -3.486267,1.823746 -4,4c-0.229767,0.973251 -0.540497,2.053505 -1,4c-0.513733,2.176254 -3,4 -3,6c0,2 0,3 0,5c0,2 -1.414215,4.585785 0,6c0.707092,0.707108 2,1 3,1c1,0 2,1 4,1c2,0 4,0 7,0c3,0 6,0 9,0c4,0 8.064575,0.800911 13,0c3.121429,-0.506538 7,-1 11,-1c3,0 8,0 11,0c3,0 6.053497,0.459503 8,0c2.176239,-0.513741 3.823761,-1.486259 6,-2c1.946503,-0.459503 4.963837,-0.115868 8,-1c3.958679,-1.152771 8.041321,-0.847229 12,-2c3.036163,-0.884132 7.022491,-1.633453 10,-2c4.092224,-0.503777 7.037476,-1.389084 12,-2c4.092224,-0.503777 8.064575,-1.199089 13,-2c3.121429,-0.506538 6.925781,-1.497551 12,-2c3.98053,-0.39415 8.037476,-0.389084 13,-1c4.092224,-0.503777 8,-1 13,-1c4,0 7,0 10,0c2,0 5,0 8,0c4,0 7,0 11,0c4,0 7,0 12,0c4,0 9,0 12,0c4,0 8,0 11,0c3,0 6,0 8,0c2,0 4.053528,-0.459503 6,0c2.17627,0.513741 3.186035,0.692551 5,2c1.147278,0.826904 2.418884,0.418861 4,2c1.581116,1.581139 2.692566,3.186005 4,5c1.653809,2.29454 3,3 4,5c1,2 1.292908,2.292892 2,3c0.707092,0.707108 0.458801,0.693436 1,2c0.38269,0.923882 0,2 0,4c0,2 0,3 0,5c0,3 0,5 0,7c0,2 0,2 0,3c0,3 0,5 0,7c0,2 0.765381,5.152237 0,7c-1.082397,2.613129 -4,4 -6,6c-2,2 -4,3 -6,4c-2,1 -4.053528,1.540497 -6,2c-2.17627,0.513748 -3.87854,3.493454 -7,4c-2.961243,0.480545 -7.037476,0.389084 -12,1c-4.092224,0.503769 -8,1 -11,1c-4,0 -9,0 -13,0c-4,0 -9,0 -14,0c-3,0 -7,0 -12,0c-5,0 -9,0 -14,0c-5,0 -9,0 -14,0c-5,0 -11,0 -15,0c-4,0 -9,0 -13,0c-3,0 -6.693451,-0.458801 -8,-1c-1.847748,-0.765366 -4.014984,0.24437 -6,0c-4.092224,-0.503769 -10.980865,-4.122574 -17,-5c-7.977936,-1.162949 -15.044952,-2.266907 -21,-3c-4.092224,-0.503769 -11.176971,-0.345184 -16,-2c-4.230072,-1.45137 -8.925781,-3.497559 -14,-4c-5.970795,-0.591232 -11.037476,-0.389084 -16,-1c-4.092224,-0.503769 -8,-2 -11,-2c-4,0 -8,-1 -13,-1c-3,0 -6.907776,-0.496231 -11,-1c-3.970032,-0.488739 -7.925781,-0.497559 -13,-1c-2.985413,-0.295609 -4.907776,-0.496231 -9,-1c-2.977509,-0.366547 -7,0 -10,0c-3,0 -5,-1 -7,-1c-2,0 -7,0 -10,0c-3,0 -6.702667,1.541367 -10,3c-3.770645,1.668015 -6,2 -9,4c-3,2 -4.186005,3.692551 -6,5c-2.29454,1.653809 -4.877655,4.06601 -6,6c-1.809723,3.118484 -3.486252,4.823746 -4,7c-0.459503,1.946503 -1.346191,3.70546 -3,6c-1.307449,1.813995 -1,4 -1,6c0,0 0,1 0,2c0,1 0,2 0,3c0,2 -0.307449,5.186005 1,7c1.653809,2.29454 3,4 4,6c1,2 2,4 3,5c1,1 1,1 2,1c1,0 1.549149,0.95517 5,2c2.871277,0.869354 6.228363,-0.148056 9,1c1.306564,0.541199 3,1 3,1c1,0 2,0 4,0c1,0 3.06456,0.800919 8,0c3.121445,-0.506546 7,-2 11,-2c4,0 8,-2 13,-2c3,0 6,0 9,0c3,0 7,0 10,0c4,0 7,0 11,0c5,0 11,0 17,0c5,0 10,0 17,0c7,0 13,0 19,0c5,0 12,0 16,0c5,0 8,0 12,0c4,0 8,0 12,0c5,0 11,0 16,0c4,0 8.171631,-1.159134 12,0c3.450836,1.04483 9,3 12,3c3,0 6.071808,0.691238 11,2c3.056335,0.811661 6,2 9,2c3,0 5,0 7,0c2,0 4,0 6,0c3,0 5,0 7,0c2,0 5,0 6,0c2,0 3,0 5,0c2,0 3,0 6,0c2,0 4,0 7,0c2,0 4,0 6,0c1,0 2,0 3,0c2,0 3,0 4,0c1,0 2,0 3,0c2,0 3,0 4,0c1,0 2,0 3,0c3,0 8,0 13,0c4,0 7,0 10,0c2,0 3,1 5,1c1,0 2,0 3,0c1,0 2.076111,0.38269 3,0c1.30658,-0.541199 2,-2 3,-3c1,-1 2.458801,-1.693436 3,-3c0.38269,-0.923874 0.69342,-2.458801 2,-3c0.923889,-0.38269 2.076111,-0.61731 3,-1c1.30658,-0.541199 2.076111,-0.61731 3,-1c1.30658,-0.541199 2,-1 2,-1c1,0 2.486267,0.176254 3,-2c0.229736,-0.973251 1,-1 2,-2c1,-1 2.173096,-1.852737 3,-3c1.307434,-1.813995 0.69342,-3.458801 2,-4c0.923889,-0.38269 1.585815,0.414215 3,-1c0.707092,-0.707108 2.076111,-0.61731 3,-1c1.30658,-0.541199 4,-1 5,-1c1,0 3,0 5,0c1,0 3,0 4,0c2,0 3,0 4,0c1,0 1,1 2,1c1,0 1,1 1,2c0,1 1,3 2,4c1,1 1.458801,2.693436 2,4c0.38269,0.923874 1,1 1,3c0,1 0.292908,1.292892 1,2c0.707092,0.707108 0,1 0,2c0,1 2,1 2,3c0,0 0,1 0,2c0,0 0,1 0,3c0,1 0.707092,2.292892 0,3c-1.414185,1.414215 -1.292908,2.292892 -2,3c-0.707092,0.707108 -1,1 -1,2c0,0 -0.458801,1.693436 -1,3c-0.765381,1.847763 -1,3 -1,5c0,0 0,1 0,4c0,2 0,5 0,8c0,3 0,7 0,11c0,3 0,7 0,9c0,3 0,6 0,8c0,1 0,2 0,3c0,1 0,3 0,5c0,1 0.229736,2.026764 0,3c-0.513733,2.176239 -1.493469,3.878571 -2,7c-0.320374,1.974182 0,5 0,8c0,2 0.148071,4.228363 -1,7c-0.541199,1.306549 -0.61731,3.076111 -1,4c-1.082397,2.613129 -3,3 -3,5c0,1 0.488708,3.029968 0,7c-0.503784,4.092224 -2.1604,6.963287 -3,11c-1.238647,5.955322 -1,8 -1,10c0,2 0,4 0,7c0,2 0.459534,5.053497 0,7c-0.513733,2.176239 -2.144287,5.934143 -3,8c-1.210144,2.92157 -2.486267,6.823761 -3,9c-0.919006,3.893005 0,6 0,8c0,2 0,5 0,7c0,2 0.459534,3.053497 0,5c-0.513733,2.176239 -0.839844,4.012909 -1,5c-0.506531,3.121429 -1,4 -1,6c0,3 -1,4 -1,5c0,2 0.765381,3.152252 0,5c-0.541199,1.306549 -1,3 -1,5c0,1 -0.839844,2.012909 -1,3c-0.506531,3.121429 -0.540466,4.053497 -1,6c-0.513733,2.176239 -2,4 -3,6c-1,2 -2.292908,3.292908 -3,4c-0.707092,0.707092 -1.292908,1.292908 -2,2c-0.707092,0.707092 -2.026733,-0.229767 -3,0c-2.17627,0.513733 -5.228333,1.851959 -8,3c-2.613098,1.082397 -5.07843,2.789856 -8,4c-2.065857,0.855713 -2.69342,1.458801 -4,2c-1.847778,0.765381 -3,0 -4,0c0,0 -1,0 -2,0c-1,0 -1.852722,-1.173096 -3,-2c-1.813965,-1.307465 -2.61731,-2.076111 -3,-3c-0.541199,-1.306549 -2.149353,-1.474274 -3,-2c-1.9021,-1.175568 -2.61731,-4.076111 -3,-5c-0.541199,-1.306549 -2.458801,-1.693451 -3,-3c-0.38269,-0.923889 0,-2 0,-3c0,0 -1,0 -1,-2c0,-1 0,-3 0,-5c0,-2 0,-5 0,-8c0,-3 -0.68927,-7.080261 0,-10c0.513733,-2.176239 1,-5 1,-6c0,-2 0.458801,-3.693451 1,-5c0.765381,-1.847748 0,-3 0,-4c0,-2 -0.48053,-4.038727 0,-7c0.506531,-3.121429 0.679626,-6.025818 1,-8c0.506531,-3.121429 0.540466,-5.053497 1,-7c0.513733,-2.176239 0.234619,-3.152252 1,-5c0.541199,-1.306549 1.917603,-3.386871 3,-6c0.765381,-1.847748 1,-4 1,-7c0,-2 1,-5 1,-7c0,-3 0,-6 0,-8c0,-3 0,-4 0,-5c0,-2 0,-5 0,-9c0,-3 0,-7 0,-10c0,-2 0,-8 0,-11c0,-2 0,-4 0,-7c0,-2 -1,-4 -1,-6c0,-2 -0.61731,-6.076111 -1,-7c-1.082397,-2.613129 -2,-3 -2,-4c0,-1 0,-3 0,-4c0,0 0,-1 0,-2c0,-1 -1,-2 -1,-4c0,-1 -0.458801,-1.693451 -1,-3c-0.38269,-0.923889 -0.839844,-3.012909 -1,-4c-0.506531,-3.121429 -1,-4 -2,-5c-1,-1 -1.61731,-2.076111 -2,-3c-0.541199,-1.306564 -2,-2 -3,-3c-1,-1 -2.386902,-2.917603 -5,-4c-0.923889,-0.38269 -2,0 -4,0c-1,0 -3,0 -5,0c-2,0 -4.053528,-0.459503 -6,0c-2.176239,0.513748 -6.026764,1.770248 -7,2c-2.176239,0.513748 -5,3 -7,5c-2,2 -4.173096,3.852722 -5,5c-1.307465,1.813995 -2.486267,3.823761 -3,6c-0.459503,1.946503 -1,4 -2,6c-1,2 -2.493469,3.878571 -3,7c-0.320374,1.974182 -1.458801,4.693451 -2,6c-0.38269,0.923889 0.765381,3.152252 0,5c-0.541199,1.306549 -1,3 -1,7c0,4 -1.95517,7.549164 -3,11c-1.159149,3.828369 -0.497559,6.925781 -1,12c-0.197083,1.990265 0,4 0,6c0,2 0,4 0,7c0,2 0,5 0,8c0,2 0,5 0,8c0,3 1,5 1,7c0,2 2.458801,3.693451 3,5c0.765381,1.847748 -0.765381,3.152252 0,5c0.541199,1.306549 1,3 1,4c0,2 0,4 0,7c0,1 0,3 0,5c0,2 0,5 0,7c0,2 0,4 0,5c0,2 -0.234619,4.152252 -1,6c-0.541199,1.306549 -0.770233,3.026764 -1,4c-0.513733,2.176239 -1.144287,3.934143 -2,6c-1.210144,2.92157 -1.493469,4.878571 -2,8c-0.320374,1.974182 -1,3 -1,5c0,2 -1.372009,2.385101 -5,5c-2.294525,1.653809 -2.934143,3.144287 -5,4c-2.92157,1.210144 -5.025818,1.679626 -7,2c-3.121429,0.506531 -5.930969,2.237732 -9,3c-5.903381,1.466248 -9.041321,1.847229 -13,3c-3.036163,0.884125 -6.080261,0.31073 -9,1c-2.176239,0.513733 -4,1 -7,1c-2,0 -4,0 -6,0c-3,0 -7,0 -11,0c-4,0 -8,0 -11,0c-3,0 -6,0 -10,0c-4,0 -7,0 -11,0c-3,0 -6,0 -8,0c-2,0 -5,0 -6,0c-2,0 -7,0 -14,0c-9,0 -18,0 -25,0c-10,0 -18,0 -23,0c-7,0 -12,0 -17,0c-5,0 -9,0 -13,0c-5,0 -11,0 -18,0c-6,0 -13,0 -19,0c-5,0 -10,0 -15,0c-6,0 -10,0 -13,0c-3,0 -6,0 -10,0c-3,0 -6,0 -9,0c-3,0 -5,0 -8,0c-4,0 -7,0 -11,0c-5,0 -10,0 -16,0c-5,0 -10.024338,-0.492676 -15,0c-5.074203,0.502441 -10,1 -13,1c-5,0 -8,0 -12,0c-3,0 -6,0 -9,0c-2,0 -4,0 -6,0c-2,0 -6,0 -10,0c-3,0 -8,0 -14,0c-6,0 -10,0 -14,0c-2,0 -4.82375,-1.486267 -7,-2c-1.946499,-0.459503 -3.878555,-1.493469 -7,-2c-1.974174,-0.320374 -4,-1 -5,-1c-1,0 -1,-1 -1,-2c0,-1 -1.103405,-1.906342 -2,-3c-2.285879,-2.78833 -4.418861,-3.418854 -6,-5c-1.581139,-1.581146 -1.418861,-3.418854 -3,-5c-1.581139,-1.581146 -2.458803,-1.693451 -3,-3c-0.382683,-0.923889 0,-2 0,-3c0,-1 0,-3 0,-5c0,-1 0,-2 0,-3c0,0 0,-2 0,-3c0,-1 2,-2 3,-3c1,-1 2.292892,-2.292908 3,-3c0.707108,-0.707092 1.292892,-0.292908 2,-1c1.414213,-1.414215 5.310005,-0.337494 8,-2c1.203003,-0.7435 3,-1 3,-1c1,0 1,-1 3,-1c1,0 3,-1 4,-1c1,0 2,0 3,0c1,0 2,0 4,0c1,0 3,0 7,0c2,0 6,0 9,0c3,0 6,0 9,0c2,0 4,0 8,0c3,0 6.01947,-0.394165 10,0c5.074203,0.502441 10.907784,1.496216 15,2c4.96254,0.610931 11,1 18,1c4,0 9.03746,0.610931 14,0c4.092209,-0.503784 8,-1 10,-1c3,0 5,0 7,0c2,0 4,0 5,0c4,0 6.041321,-0.152771 10,1c3.036163,0.884125 7,1 12,1c3,0 8,0 11,0c1,0 3,0 5,0c1,0 2,0 3,0c1,0 2,0 4,0c2,0 5,0 10,0c5,0 13,0 18,0c7,0 11.051651,-0.640717 15,0c3.121445,0.506531 3.823746,2.486267 6,3c1.946503,0.459503 4,1 7,1c2,0 5.106995,0.919006 9,0c2.176239,-0.513733 3.878571,-1.493469 7,-2c2.961273,-0.48056 5.053497,-0.540497 7,-1c2.176239,-0.513733 6.041321,-1.847229 10,-3c3.036163,-0.884125 5.878571,-2.493469 9,-3c2.961273,-0.48056 6,-1 8,-1c3,0 4,0 5,0c2,0 3,0 4,0c3,0 5,0 8,0c2,0 4,0 7,0c3,0 6,0 8,0c4,0 8.022491,0.366547 11,0c4.092224,-0.503784 8.071808,-0.691254 13,-2c3.056335,-0.811646 5.907776,-1.496216 10,-2c1.985016,-0.244354 5,0 9,0c2,0 5,0 8,0c3,0 5,0 8,0c2,0 5,0 7,0c2,0 4.025818,-0.679626 6,-1c3.121429,-0.506531 5,-2 7,-3c2,-1 3.076111,-1.61731 4,-2c1.306549,-0.541199 2,-2 3,-4c1,-2 3.144287,-3.934143 4,-6c1.210144,-2.92157 3.144287,-5.934143 4,-8c1.210144,-2.92157 2,-6 3,-7c1,-1 1,-2 2,-3c1,-1 1,-2 1,-4c0,-1 -0.320374,-4.025818 0,-6c0.506531,-3.121429 1,-8 1,-12c0,-3 -0.366547,-8.022491 0,-11c0.503784,-4.092224 1.493469,-7.878571 2,-11c0.320374,-1.974182 0,-5 0,-7c0,-3 0,-5 0,-8c0,-3 0,-8 0,-11c0,-3 0.48056,-7.038727 0,-10c-0.506531,-3.121429 -1,-5 -1,-7c0,-3 -0.458801,-3.693451 -1,-5c-0.38269,-0.923889 0.306549,-2.458801 -1,-3c-0.923889,-0.38269 -0.292908,-0.292908 -1,-1c-0.707092,-0.707092 -2,0 -4,0c-1,0 -2,-1 -4,-1c-1,0 -2.149353,-0.474274 -3,-1c-1.9021,-1.175568 -2,-2 -2,-2c-1,0 -1.823761,-0.486252 -4,-1c-0.973236,-0.229752 -3,0 -5,0c-2,0 -3,0 -7,0c-3,0 -7,1 -10,3c-3,2 -7.4505,4.4505 -10,7c-2.5495,2.5495 -3.346191,4.705475 -5,7c-1.307465,1.813995 -0.692535,4.186005 -2,6c-0.826904,1.147278 -0.789856,3.07843 -2,6c-0.855713,2.065857 -1.337494,4.309998 -3,7c-0.7435,1.203003 -1,3 -2,4c-1,1 -1.540497,2.053497 -2,4c-0.513733,2.176239 -1.234619,3.152252 -2,5c-0.541199,1.306549 -0.234619,2.152252 -1,4c-0.541199,1.306549 -2.458801,2.693451 -3,4c-0.38269,0.923889 -0.852722,2.173096 -2,3c-1.813995,1.307465 -3,2 -5,4c-1,1 -2.309998,2.337494 -5,4c-1.203003,0.7435 -1.0979,1.824432 -3,3c-0.850647,0.525726 -2.852722,1.173096 -4,2c-1.813995,1.307465 -4,2 -5,3c-1,1 -2.173096,2.852722 -3,4c-1.307465,1.813995 -2.458801,3.693451 -3,5c-0.38269,0.923889 -0.693451,2.458801 -2,3c-0.923889,0.38269 -2.173096,0.852722 -3,2c-1.307465,1.813995 -2.186005,2.692535 -4,4c-2.294525,1.653809 -3.881531,3.190277 -7,5c-1.93399,1.122345 -3.878571,2.493469 -7,3c-1.974182,0.320374 -5,0 -8,0c-2,0 -5,0 -8,0c-4,0 -7,1 -10,1c-3,0 -5,1 -8,1c-3,0 -5,0 -8,0c-2,0 -4,0 -6,0c-2,0 -5,0 -7,0c-5,0 -8.076904,-0.731445 -12,-2c-5.123947,-1.65686 -9,-3 -12,-4c-3,-1 -4.823746,-2.486267 -7,-3c-1.946503,-0.459503 -5.038742,-0.51944 -8,-1c-3.121445,-0.506531 -6.878555,-1.493469 -10,-2c-3.948349,-0.640717 -8,0 -13,0c-4,0 -7,0 -10,0c-3,0 -5,0 -8,0c-2,0 -5.053497,0.459503 -7,0c-2.176254,-0.513733 -4,-1 -7,-1c-2,0 -4,0 -7,0c-2,0 -5,0 -9,0c-3,0 -6,0 -10,0c-3,0 -8,0 -12,0c-3,0 -5.907791,1.496216 -10,2c-2.977524,0.366547 -5,1 -7,1c-3,0 -5.053505,0.540497 -7,1c-2.176254,0.513733 -3.026749,0.770233 -4,1c-2.176254,0.513733 -4.025826,0.679626 -6,1c-3.121445,0.506531 -5,2 -7,2c-2,0 -4.693436,0.458801 -6,1c-0.923882,0.38269 -3,0 -4,0c-3,0 -5,0 -7,0c-2,0 -3,1 -4,1c-2,0 -3,0 -4,0c-2,0 -3,1 -5,1c-3,0 -4,0 -6,0c-1,0 -3,0 -5,0c-1,0 -2,0 -4,0c-2,0 -5,0 -6,0c-2,0 -3,0 -4,0c-1,0 -2.585785,0.414215 -4,-1c-0.707108,-0.707092 -0.693436,-1.458801 -2,-2c-0.923878,-0.38269 -1,0 -1,-2c0,-2 -1.496225,-4.907776 -2,-9c-0.244366,-1.985016 -0.679636,-5.025818 -1,-7c-0.50654,-3.121429 -0.540495,-5.053497 -1,-7c-0.513742,-2.176239 -1,-4 -1,-6c0,-3 0,-5 0,-8c0,-3 0,-8 0,-11c0,-3 -1.917608,-5.386871 -3,-8c-0.765368,-1.847748 0,-4 0,-5c0,-2 0,-3 0,-5c0,-2 0,-3 0,-4c0,-1 0,-3 0,-5c0,-2 0,-5 0,-7c0,-2 0,-4 0,-5c0,-1 0,-3 0,-4c0,-4 0.733099,-8.044952 0,-14c-0.503775,-4.092209 -1.486258,-8.823746 -2,-11c-0.689259,-2.919754 0.320364,-5.025818 0,-7c-0.50654,-3.121445 -1,-4 -1,-5c0,-2 0,-3 0,-6c0,-1 0,-3 0,-5c0,-2 0,-4 0,-7c0,-1 0,-3 0,-3c0,-1 0,-2 0,-3c0,-2 0.160183,-4.012909 0,-5c-0.50654,-3.121445 -1,-5 -1,-7c0,-5 -0.49346,-7.878555 -1,-11c-0.480547,-2.961258 -0.519453,-6.038742 -1,-9c-0.50654,-3.121445 -0.310741,-6.080246 -1,-9c-0.513742,-2.176254 -1.486257,-5.823746 -2,-8c-0.689259,-2.919754 -0.486257,-4.823746 -1,-7c-0.459506,-1.946503 0,-4 0,-5c0,-2 0,-4 0,-6c0,-1 0,-2 0,-4c0,-1 0,-1 0,-2c0,-1 0.458804,-2.693436 1,-4c0.382684,-0.923882 0.486257,-2.823746 1,-5c0.459505,-1.946495 0,-5 0,-8c0,-2 0,-4 0,-5c0,-1 0,-3 0,-6c0,-3 0.49346,-6.878555 1,-10c0.320364,-1.974174 0,-5 0,-6c0,-2 0,-3 0,-5c0,-2 0,-4 0,-6c0,-2 -1,-4 -1,-5c0,-1 0,-3 0,-4c0,0 0,-1 0,-2c0,-1 0,-2 0,-3c0,-2 1.486258,-3.82375 2,-6c0.689259,-2.919746 1.486258,-5.82375 2,-8c0.459505,-1.946499 0,-5 0,-7c0,-1 0,-3 0,-3c0,-1 0.292892,-1.292892 1,-2c0.707108,-0.707108 0.692549,-1.186007 2,-3c1.653811,-2.294538 3.07612,-2.617317 4,-3c1.306562,-0.541197 2,-1 3,-2c1,-1 1.292892,-1.292892 2,-2c0.707108,-0.707108 1.693436,-0.458803 3,-1c1.847759,-0.765368 3.292892,-0.292892 4,-1c0.707108,-0.707108 1.693436,-1.458803 3,-2c1.847759,-0.765368 2.82375,-0.486258 5,-1c0.973248,-0.229753 4,-1 6,-1c2,0 3.386875,-1.917608 6,-3c1.847759,-0.765367 4.025826,0.320365 6,0c3.121445,-0.50654 5,-1 7,-1c3,0 5,-1 7,-1c2,0 2.693436,-0.458804 4,-1c1.847755,-0.765367 3,0 4,0c1,0 2,0 3,0c2,0 2.85273,0.173095 4,1c1.813995,1.307452 3,1 4,1c1,0 1.152245,0.234633 3,1c1.306564,0.541196 2.026749,0.770247 3,1c2.176254,0.513743 3,3 3,3c1,0 2,1 2,2c0,1 0,1 0,2c0,1 0,2 0,4c0,1 0.458801,2.693438 1,4c0.765366,1.847759 0,3 0,5c0,1 0,3 0,4c0,2 0,4 0,5c0,2 -0.95517,3.549156 -2,7c-0.289787,0.957092 -0.234634,2.152241 -1,4c-0.541199,1.306564 -1.693436,2.458805 -3,3c-0.923882,0.382683 -1.85273,2.173096 -3,3c-1.813995,1.307453 -4.186005,0.692547 -6,2c-1.14727,0.826904 -3.076118,1.617317 -4,2c-1.306564,0.541199 -1.292892,1.292892 -2,2c-1.414215,1.414215 -1.693436,1.458801 -3,2c-0.923882,0.382683 -2.076118,0.617317 -3,1c-1.306564,0.541199 -1.693436,1.458801 -3,2c-0.923882,0.382683 -3,1 -4,2c-1,1 -2,2 -3,3c-1,1 -2,2 -3,3c-2,2 -4.85273,3.173096 -6,4c-1.813992,1.307449 -3,2 -4,2c-1,0 -2.458805,0.693436 -3,2c-0.382683,0.923882 -1.617317,2.076118 -2,3c-0.541195,1.306564 -2.458805,1.693436 -3,3c-0.382683,0.923882 -0.585785,0.585785 -2,2c-0.707108,0.707108 0,2 0,3c0,1 -1,1 -1,2c0,1 0,1 0,2c0,1 0,2 0,3c0,0 0,1 0,2c0,4 -1,6 -1,8c0,2 0,4 0,5c0,2 0,5 0,8c0,1 0,2 0,3c0,2 0,2 0,3c0,2 -0.480545,4.038742 0,7c0.506542,3.121445 2.540493,5.053497 3,7c0.513744,2.176254 1,3 1,4c0,1 0,3 0,4c0,2 0,4 0,6c0,1 0,3 0,4c0,1 1,3 1,5c0,1 0,3 0,5c0,3 0.486256,5.823746 1,8c0.459507,1.946503 1,4 1,6c0,2 1,3 1,5c0,2 -0.765366,3.152237 0,5c0.541195,1.306564 1,2 1,3c0,1 0,4 0,5c0,3 0,5 0,8c0,2 0,5 0,8c0,2 0,4 0,6c0,4 0,6 0,7c0,1 -1.414215,2.585785 0,4c0.707108,0.707108 0.617317,1.076126 1,2c0.541195,1.306564 1.486256,1.823746 2,4c0.459507,1.946503 -0.459507,3.053497 0,5c0.513744,2.176254 1,4 1,6c0,2 0,4 0,5c0,1 0,2 0,4c0,1 0,3 0,4c0,0 0,1 0,2c0,2 0,4 0,7c0,3 0.493458,6.878571 1,10c0.320366,1.974182 0,4 0,5c0,0 1,2 1,3c0,1 1,1 1,2c0,1 1.292892,1.292908 2,2c0.707108,0.707092 0.617317,1.076111 1,2c0.541199,1.306549 3,2 4,2c1,0 2,1 4,1c1,0 2.152245,-0.765381 4,0c1.306564,0.541199 2.025826,0.679626 4,1c3.121445,0.506531 4.934143,1.144287 7,2c2.921562,1.210144 6.078438,0.789856 9,2c2.065857,0.855713 4,2 6,2c2,0 4,0 6,0c2,0 4.053505,0.540497 6,1c2.176254,0.513733 5.934143,1.144287 8,2c2.921562,1.210144 4.878555,1.493469 8,2c1.974182,0.320374 5,0 8,0c2,0 3,0 6,0c1,0 2,0 3,0c1,0 3,0 5,0c2,0 4.038742,0.48056 7,0c3.121445,-0.506531 5.823746,-1.486267 8,-2c1.946503,-0.459503 4,0 6,0c1,0 3,0 4,0c2,0 3,0 5,0c2,0 3,0 6,0c2,0 4,0 7,0c2,0 5,0 8,0c2,0 4,0 7,0c2,0 4,0 8,0c2,0 4,0 6,0c1,0 3,0 4,0c1,0 2,0 3,0c1,0 2,0 4,0c3,0 7,0 11,0c6,0 8,0 11,0c1,0 3,0 4,0c2,0 4,0 7,0c2,0 3,-1 5,-1c1,0 1.823761,-0.486267 4,-1c1.946503,-0.459503 3.053497,-0.540497 5,-1c2.176239,-0.513733 5,-2 7,-2c2,0 3.878571,-1.493469 7,-2c0.987091,-0.160187 2.823761,-0.486267 5,-1c0.973236,-0.229767 2.152252,-0.234619 4,-1c2.613129,-1.082397 3.346191,-2.705475 5,-5c1.307465,-1.813995 3,-3 5,-5c2,-2 3.812653,-4.206818 6,-6c2.78833,-2.285889 6.132019,-3.75531 10,-6c3.118469,-1.809723 4.186005,-3.692535 6,-5c1.147278,-0.826904 1.292908,-1.292908 2,-2c0.707092,-0.707092 2,-1 2,-2c0,-1 0,-2 0,-3c0,-2 0,-4 0,-6c0,-1 0,-2 0,-3c0,-1 0.229767,-2.026764 0,-3c-0.513733,-2.176239 -2.458801,-3.693451 -3,-5c-0.38269,-0.923889 -0.61731,-2.076126 -1,-3c-0.541199,-1.306564 -1.458801,-1.693436 -2,-3c-0.38269,-0.923874 -0.61731,-2.076126 -1,-3c-0.541199,-1.306564 -2,-2 -2,-3c0,-1 -0.585785,-3.585785 -2,-5c-0.707092,-0.707108 -2,-1 -3,-1c-1,0 -2,0 -4,0c-2,0 -5.205261,-1.264908 -9,0c-4.743408,1.581146 -7.21167,3.714127 -10,6c-2.187347,1.793198 -3.878571,3.493454 -7,4c-0.987091,0.160187 -2.292908,0.292892 -3,1c-0.707092,0.707108 -2.186005,0.692551 -4,2c-2.294525,1.653809 -3.852722,4.173096 -5,5c-1.813995,1.307465 -3.418854,2.418854 -5,4c-1.581146,1.581146 -1.852722,3.173096 -3,4c-1.813995,1.307465 -2.796997,2.2565 -4,3c-2.690002,1.662506 -5.309998,1.337494 -8,3c-2.406006,1.487 -4.705475,3.346191 -7,5c-1.813995,1.307465 -3.0979,1.824432 -5,3c-1.701309,1.051453 -2.878555,1.493469 -6,2c-0.987091,0.160187 -1.878555,0.493469 -5,1c-0.987091,0.160187 -2,0 -3,0c-1,0 -1.823746,0.486267 -4,1c-1.946503,0.459503 -4.152237,0.234619 -6,1c-2.613129,1.082397 -5.076126,1.61731 -6,2c-1.306564,0.541199 -3,1 -4,1c-1,0 -2,0 -4,0c-1,0 -2,0 -4,0c-1,0 -3,0 -5,0c-2,0 -3,0 -5,-1c-2,-1 -2.292892,-1.292908 -3,-2c-0.707108,-0.707092 -2.076126,-0.61731 -3,-1c-1.306564,-0.541199 -1.852737,-1.173096 -3,-2c-3.627991,-2.614899 -6.190277,-3.881531 -8,-7c-1.122345,-1.93399 -1.692551,-4.186005 -3,-6c-1.653809,-2.294525 -3,-3 -4,-4c-1,-1 -2,-3 -3,-4c-1,-1 -2,-2 -3,-4c-1,-2 -2.173096,-3.852737 -3,-5c-1.307449,-1.813995 -2.458801,-3.693436 -3,-5c-0.765366,-1.847763 -1.486252,-4.823746 -2,-7c-0.229752,-0.973251 -1,-2 -1,-3c0,-2 -0.61731,-3.076126 -1,-4c-0.541199,-1.306564 -0.292892,-2.292892 -1,-3c-0.707108,-0.707108 -1,-1 -1,-2c0,-2 0,-3 0,-4c0,-1 0,-2 0,-3c0,-1 0,-3 0,-5c0,-3 0.486252,-5.823746 1,-8c0.459503,-1.946503 0.486252,-2.823746 1,-5c0.229752,-0.973251 0,-3 0,-4c0,-1 -0.389359,-3.159271 1,-6c1.584106,-3.238922 3.346191,-5.70546 5,-8c1.307449,-1.813995 1.097885,-4.824432 3,-6c0.850647,-0.525726 1.458801,-0.693436 2,-2c0.38269,-0.923874 1,-1 1,-2c0,-1 0.149353,-0.474274 1,-1c1.902115,-1.175568 1.173096,-2.852737 2,-4c1.307449,-1.813995 2.486252,-2.823746 3,-5c0.229752,-0.973251 0.292892,-1.292892 1,-2c0.707108,-0.707108 -0.229752,-1.026749 0,-2c0.513748,-2.176254 1.458801,-2.693436 2,-4c0.38269,-0.923874 0.234634,-1.152237 1,-3c0.541199,-1.306564 2,-3 3,-3c1,0 1.292892,-0.292892 2,-1c0.707108,-0.707108 0,-2 1,-3c1,-1 3,-2 4,-3c1,-1 1,-2 2,-2c1,0 1,-1 2,-1c1,0 2.458801,0.306564 3,-1c0.38269,-0.923874 2.076126,-1.61731 3,-2c1.306564,-0.541199 2.076126,-1.61731 3,-2c1.306564,-0.541199 1.418854,-2.418854 3,-4c1.581146,-1.581146 3.852737,-1.173096 5,-2c1.813995,-1.307449 3,-1 4,-2c1,-1 1.693436,-1.458801 3,-2c0.923874,-0.382683 2.076126,-0.617317 3,-1c1.306564,-0.541199 1.076126,-0.617317 2,-1c1.306564,-0.541199 2.292892,-1.292892 3,-2c0.707108,-0.707108 1.292892,-1.292892 2,-2c1.414215,-1.414215 2,-2 2,-4c0,-1 0,-1 0,-2c0,-1 0.38269,-1.076118 0,-2c-0.541199,-1.306564 -1.474274,-1.149345 -2,-2c-1.175568,-1.902115 -3,-2 -4,-2c0,0 -1,-1 -2,-1c-1,0 -2,0 -2,0c0,-2 -1,-2 -2,-2c-2,0 -3,0 -4,0c-1,0 -2,0 -3,0c-1,0 -2,0 -2,0c-1,0 -2,0 -3,0c-1,0 -2,0 -3,0c-1,0 -2,0 -3,0c-1,0 -2,2 -3,2c-1,0 -1.693436,1.458801 -3,2c-0.923874,0.382683 -2,1 -3,1c-1,0 -2.026749,-0.229752 -3,0c-2.176254,0.513741 -2,2 -3,2c-2,0 -4.053497,0.540497 -6,1c-2.176254,0.513741 -3.585785,0.585785 -5,2c-0.707108,0.707108 -0.693436,1.458801 -2,2c-0.923874,0.382683 -2.693436,1.458801 -4,2c-1.847763,0.765366 -2.292892,1.292892 -3,2c-0.707108,0.707108 -1.076126,0.617317 -2,1c-1.306564,0.541199 -2,2 -3,3c0,0 0.414215,0.585785 -1,2c-0.707108,0.707108 -1.076126,0.617317 -2,1c-1.306564,0.541199 -1.292892,1.292892 -2,2c-0.707108,0.707108 -1.474274,0.149353 -2,1c-1.175568,1.902115 -2.852737,2.173096 -4,3c-1.813995,1.307449 -2.61731,1.076126 -3,2c-0.541199,1.306564 -1.852737,2.173096 -3,3c-1.813995,1.307449 -2.692551,2.186005 -4,4c-0.826904,1.147263 -2.474274,2.149353 -3,3c-1.175568,1.902115 -3.173096,2.852737 -4,4c-1.307449,1.813995 -1.234634,3.152237 -2,5c-0.541199,1.306564 -1.61731,2.076126 -2,3c-0.541199,1.306564 -1.692551,2.186005 -3,4c-0.826904,1.147263 -2.458801,1.693436 -3,3c-0.382683,0.923874 -1,2 -1,3c0,0 -1,1 -1,2c0,2 0.459503,4.053497 0,6c-0.513741,2.176254 -1,4 -1,6c0,3 0,5 0,7c0,2 0,4 0,6c0,2 0.707108,3.292892 0,4c-0.707108,0.707108 -1,2 -1,3c0,2 0,3 0,4c0,1 0,3 0,4c0,1 0,3 0,4c0,3 0,5 0,8c0,2 0,5 0,7c0,3 0,6 1,8c1,2 2.458801,3.693436 3,5c0.765366,1.847763 0.458801,2.693436 1,4c0.38269,0.923874 0.770248,1.026749 1,2c0.513748,2.176254 1.234634,3.152237 2,5c0.541199,1.306564 2,2 2,3c0,1 0,2 0,3c0,2 0,3 0,4c0,1 0,2 0,3c0,1 0,2 0,3c0,1 -0.234634,1.152252 -1,3c-0.541199,1.306549 -1.292892,1.292908 -2,2c-0.707108,0.707092 -0.097885,1.824432 -2,3c-0.850647,0.525726 -2.292892,-0.707092 -3,0c-0.707108,0.707092 -2.458801,0.693451 -3,2c-0.382683,0.923889 -1,2 -2,2c-1,0 -2,0 -4,0c-2,0 -3,0 -4,0c-2,0 -3.292892,0.707092 -4,0c-0.707108,-0.707092 -1.693436,-2.458801 -3,-3c-0.923882,-0.38269 -2.824432,-0.0979 -4,-2c-0.525734,-0.850647 -0.292892,-1.292908 -1,-2c-1.414215,-1.414215 -2.292892,-0.292908 -3,-1c-0.707108,-0.707092 -1,-1 -1,-2c0,-1 -0.617317,-3.076111 -1,-4c-0.541199,-1.306549 -1.486259,-2.823761 -2,-5c-0.689262,-2.919739 -2.173096,-5.852737 -3,-7c-1.307449,-1.813995 -1.458801,-3.693436 -2,-5c-0.382683,-0.923874 -0.458801,-2.693436 -1,-4c-0.382683,-0.923874 0.707108,-3.292892 0,-4c-0.707108,-0.707108 -1,-1 -1,-2c0,-1 -1.486259,-2.823746 -2,-5c-0.459503,-1.946503 -1.458801,-2.693436 -2,-4c-0.765366,-1.847763 -0.292892,-2.292892 -1,-3c-0.707108,-0.707108 0,-2 0,-2c0,-1 0,-3 0,-4c0,-1 0,-2 0,-2c0,-1 0,-2 0,-4c0,-1 0.707108,-2.292892 0,-3c-0.707108,-0.707108 -0.617317,-1.076126 -1,-2c-0.541199,-1.306564 -0.292892,-3.292892 -1,-4c-0.707108,-0.707108 -0.617317,-1.076126 -1,-2c-0.541199,-1.306564 -0.770248,-2.026749 -1,-3c-0.513741,-2.176254 -2.458801,-2.693436 -3,-4c-0.382683,-0.923874 -0.617317,-2.076126 -1,-3c-0.541199,-1.306564 -1.292892,-1.292892 -2,-2c-0.707108,-0.707108 0,-2 0,-3c0,-1 0,-2 0,-3c0,-1 0,-2 0,-3c0,-2 0,-3 0,-5c0,-2 0,-4 0,-5c0,-3 0,-4 0,-5c0,-1 0,-2 0,-3c0,-1 0,-2 0,-3c0,0 0,-1 0,-2c0,0 0,-1 0,-2c0,-2 0,-3 0,-3c0,-1 0.824432,-1.097885 2,-3c0.525734,-0.850647 0,-3 0,-4c0,-1 1,-1 1,-2c0,-1 1,-2 1,-2c1,-1 1.292892,-1.292892 2,-2c0.707108,-0.707108 1.292892,-1.292892 2,-2c1.414215,-1.414215 2.292892,-1.292892 3,-2c0.707108,-0.707108 0.693436,-1.458801 2,-2c1.847755,-0.765366 2.292892,-0.292892 3,-1c0.707108,-0.707108 1.292892,-1.292892 2,-2c0.707108,-0.707108 2,0 2,0c1,0 2,0 2,0c1,0 2,0 2,0c1,0 2,0 3,1c0,0 1,1 2,1c1,0 1.292892,-0.292892 2,-1c0.707108,-0.707108 1,-1 2,-2l0,0 Z");
    Path path = handler.getPath();
    root.getChildren().add(path);
    // Moving image
    ImageView alien = new ImageView(new Image("green_alien.png"));
    alien.setScaleX(0.3);
    alien.setScaleY(0.3);
    root.getChildren().add(alien);
    // Path Transition
    PathTransition pathTransition = new PathTransition();
    pathTransition.setDuration(Duration.seconds(30));
    pathTransition.setPath(path);
    pathTransition.setNode(alien);
    pathTransition.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
    pathTransition.setCycleCount(Timeline.INDEFINITE);
    pathTransition.play();
    primaryStage.setTitle("JavaFX Alien Rallye");
    primaryStage.setScene(new Scene(root, WIDTH, HEIGHT));
    primaryStage.getScene().getStylesheets().add("alien");
    primaryStage.show();
}
Example 97
Project: javafx-ws-client-master  File: TabWsMessagesController.java View source code
@FXML
private void changeFilterStatus() {
    Platform.runLater(() -> {
        if (filtered) {
            filterBar.setVisible(false);
            filterBar.setManaged(false);
            filterStatusLabel.setGraphic(new ImageView("/images/turn-off.png"));
            filterAddBtn.setDisable(true);
            filterTextField.setDisable(true);
            filterListBtn.setDisable(true);
            filtered = false;
            outputSetList(false);
            lbHeadersCounter.requestFocus();
        } else {
            filterBar.setVisible(true);
            filterBar.setManaged(true);
            filterStatusLabel.setGraphic(new ImageView("/images/turn-on.png"));
            filterAddBtn.setDisable(false);
            filterTextField.setDisable(false);
            filterTextField.requestFocus();
            if (filterList.size() > 0) {
                filterListBtn.setDisable(false);
                outputSetList(true);
            }
            filtered = true;
        }
    });
}
Example 98
Project: mavenize-master  File: MavenizeFXController.java View source code
/**
	 * Initialise controller.
	 * 
	 */
@Override
public void initialize(URL url, ResourceBundle rsrcs) {
    assert sourceInput != null : AssertHelper.fxmlInsertionError("sourceInput");
    assert targetInput != null : AssertHelper.fxmlInsertionError("targetInput");
    assert sourceButton != null : AssertHelper.fxmlInsertionError("sourceButton");
    assert targetButton != null : AssertHelper.fxmlInsertionError("targetButton");
    assert dataTable != null : AssertHelper.fxmlInsertionError("dataTable");
    assert versionInput != null : AssertHelper.fxmlInsertionError("versionInput");
    assert packageCombo != null : AssertHelper.fxmlInsertionError("packageCombo");
    assert versionLabel != null : AssertHelper.fxmlInsertionError("versionLabel");
    assert weblinkLabel != null : AssertHelper.fxmlInsertionError("weblinkLabel");
    logger.debug("initialize");
    InputStream stream = getClass().getResourceAsStream("/control_play_blue.png");
    // Go button graphic.
    Image goImage = new Image(stream);
    activateButton.setGraphic(new ImageView(goImage));
    // Assemble data table.
    buildDataTable(dataTable);
    // Assemble package types.
    buildPackageTypes(packageCombo);
    versionInput.setText(PomGenerator.DEFAULT_VERSION);
    versionLabel.setText(ApplicationMessages.APP_TITLE_TEXT + " - " + ApplicationMessages.APP_VERSION_TEXT);
    weblinkLabel.setText(ApplicationMessages.URL_TEXT);
/**
		 * TEST
		 */
//		sourceInput.setText(TEST_SOURCE);
//		targetInput.setText(TEST_TARGET);
}
Example 99
Project: mybatis-generator-gui-master  File: MainUIController.java View source code
@Override
public void initialize(URL location, ResourceBundle resources) {
    ImageView dbImage = new ImageView("icons/computer.png");
    dbImage.setFitHeight(40);
    dbImage.setFitWidth(40);
    connectionLabel.setGraphic(dbImage);
    connectionLabel.setOnMouseClicked( event -> {
        NewConnectionController controller = (NewConnectionController) loadFXMLPage("新建数�库连接", FXMLPage.NEW_CONNECTION, false);
        controller.setMainUIController(this);
        controller.showDialogStage();
    });
    ImageView configImage = new ImageView("icons/config-list.png");
    configImage.setFitHeight(40);
    configImage.setFitWidth(40);
    configsLabel.setGraphic(configImage);
    configsLabel.setOnMouseClicked( event -> {
        GeneratorConfigController controller = (GeneratorConfigController) loadFXMLPage("é…?ç½®", FXMLPage.GENERATOR_CONFIG, false);
        controller.setMainUIController(this);
        controller.showDialogStage();
    });
    leftDBTree.setShowRoot(false);
    leftDBTree.setRoot(new TreeItem<>());
    Callback<TreeView<String>, TreeCell<String>> defaultCellFactory = TextFieldTreeCell.forTreeView();
    leftDBTree.setCellFactory((TreeView<String> tv) -> {
        TreeCell<String> cell = defaultCellFactory.call(tv);
        cell.addEventHandler(MouseEvent.MOUSE_CLICKED,  event -> {
            int level = leftDBTree.getTreeItemLevel(cell.getTreeItem());
            TreeCell<String> treeCell = (TreeCell<String>) event.getSource();
            TreeItem<String> treeItem = treeCell.getTreeItem();
            if (level == 1) {
                final ContextMenu contextMenu = new ContextMenu();
                MenuItem item1 = new MenuItem("关闭连接");
                item1.setOnAction( event1 -> {
                    treeItem.getChildren().clear();
                });
                MenuItem item2 = new MenuItem("删除连接");
                item2.setOnAction( event1 -> {
                    DatabaseConfig selectedConfig = (DatabaseConfig) treeItem.getGraphic().getUserData();
                    try {
                        ConfigHelper.deleteDatabaseConfig(selectedConfig.getName());
                        this.loadLeftDBTree();
                    } catch (Exception e) {
                        AlertUtil.showErrorAlert("Delete connection failed! Reason: " + e.getMessage());
                    }
                });
                contextMenu.getItems().addAll(item1, item2);
                cell.setContextMenu(contextMenu);
            }
            if (event.getClickCount() == 2) {
                treeItem.setExpanded(true);
                if (level == 1) {
                    System.out.println("index: " + leftDBTree.getSelectionModel().getSelectedIndex());
                    DatabaseConfig selectedConfig = (DatabaseConfig) treeItem.getGraphic().getUserData();
                    try {
                        List<String> tables = DbUtil.getTableNames(selectedConfig);
                        if (tables != null && tables.size() > 0) {
                            ObservableList<TreeItem<String>> children = cell.getTreeItem().getChildren();
                            children.clear();
                            for (String tableName : tables) {
                                TreeItem<String> newTreeItem = new TreeItem<>();
                                ImageView imageView = new ImageView("icons/table.png");
                                imageView.setFitHeight(16);
                                imageView.setFitWidth(16);
                                newTreeItem.setGraphic(imageView);
                                newTreeItem.setValue(tableName);
                                children.add(newTreeItem);
                            }
                        }
                    } catch (CommunicationsException e) {
                        _LOG.error(e.getMessage(), e);
                        AlertUtil.showErrorAlert("连接超时");
                    } catch (Exception e) {
                        _LOG.error(e.getMessage(), e);
                        AlertUtil.showErrorAlert(e.getMessage());
                    }
                } else if (level == 2) {
                    String tableName = treeCell.getTreeItem().getValue();
                    selectedDatabaseConfig = (DatabaseConfig) treeItem.getParent().getGraphic().getUserData();
                    this.tableName = tableName;
                    tableNameField.setText(tableName);
                    domainObjectNameField.setText(MyStringUtils.dbStringToCamelStyle(tableName));
                }
            }
        });
        return cell;
    });
    loadLeftDBTree();
}
Example 100
Project: Projectiler-master  File: Notification.java View source code
/**
         * Creates and shows a popup with the data from the given Notification object
         * 
         * @param NOTIFICATION
         */
private void showPopup(final Notification NOTIFICATION) {
    final Label title = new Label(NOTIFICATION.TITLE);
    title.getStyleClass().add("title");
    final ImageView icon = new ImageView(NOTIFICATION.IMAGE);
    icon.setFitWidth(ICON_WIDTH);
    icon.setFitHeight(ICON_HEIGHT);
    final Label message = new Label(NOTIFICATION.MESSAGE, icon);
    message.getStyleClass().add("message");
    final VBox popupLayout = new VBox();
    popupLayout.setSpacing(10);
    popupLayout.setPadding(new Insets(10, 10, 10, 10));
    popupLayout.getChildren().addAll(title, message);
    final StackPane popupContent = new StackPane();
    popupContent.setPrefSize(width, height);
    popupContent.getStyleClass().add("notification");
    popupContent.getChildren().addAll(popupLayout);
    final Popup POPUP = new Popup();
    POPUP.setX(getX());
    POPUP.setY(getY());
    POPUP.getContent().add(popupContent);
    popups.add(POPUP);
    // Add a timeline for popup fade out
    final KeyValue fadeOutBegin = new KeyValue(POPUP.opacityProperty(), 1.0);
    final KeyValue fadeOutEnd = new KeyValue(POPUP.opacityProperty(), 0.0);
    final KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
    final KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd);
    final Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(popupLifetime);
    timeline.setOnFinished(new EventHandler<ActionEvent>() {

        @Override
        public void handle(final ActionEvent arg0) {
            Platform.runLater(new Runnable() {

                @Override
                public void run() {
                    POPUP.hide();
                    popups.remove(POPUP);
                }
            });
        }
    });
    if (stage.isShowing()) {
        stage.toFront();
    } else {
        stage.show();
    }
    POPUP.show(stage);
    timeline.play();
}
Example 101
Project: Turnierserver-master  File: ControllerRanking.java View source code
@Override
public TableCell<AiOnline, Image> call(TableColumn<AiOnline, Image> param) {
    final ImageView imageview = new ImageView();
    imageview.setFitHeight(50);
    imageview.setFitWidth(50);
    TableCell<AiOnline, Image> cell = new TableCell<AiOnline, Image>() {

        public void updateItem(Image item, boolean empty) {
            if (item != null)
                imageview.imageProperty().set(item);
        }
    };
    cell.setGraphic(imageview);
    return cell;
}