Java 类javafx.scene.image.ImageView 实例源码

项目:textmd    文件:ActionTextPane.java   
public ActionTextPane() {

        actionText = new Label("Test");
        graphic = new ImageView(new Image("assets/icons/editor_action_info_icon.png"));
        actionText.setGraphic(graphic);
        actionText.setTextFill(Utils.getDefaultTextColor());
        actionText.setAlignment(Pos.CENTER);
        actionText.setPadding(new Insets(0, 0, 0, 5));
        getChildren().add(actionText);
        setAlignment(Pos.CENTER);

        ft = new FadeTransition(Duration.millis(500), graphic);
        ft.setFromValue(1.0);
        ft.setToValue(0.0);
        ft.setAutoReverse(true);
        ft.setCycleCount(4);

    }
项目:LIRE-Lab    文件:CollectionGrid.java   
public void setImages(List<Image> images, ImageClickHandler handler) throws IOException {
        grid.clear();
        for (Image image : images) {
            ImageView imageView = grid.addImage(image.getThumbnailPath());

            if(imageView == null)
                continue;

//            toolTipProvider.setToolTip(imageView, image);
            toolTipProvider.setPopOver(imageView, image);

            imageView.setOnMouseClicked(eventHandlerFactory.createFrom(image, handler));

            imageView.setOnMouseEntered(event -> getScene().setCursor(Cursor.HAND));
            imageView.setOnMouseExited(event -> getScene().setCursor(Cursor.DEFAULT));

        }
    }
项目:voogasalad-ltub    文件:GameChooser.java   
private Button createGameFileChooserButton() {
        Button button = new Button();
        Image image = new Image(NEW_GAME);
        ImageView imageView = new ImageView(image);
        imageView.setFitWidth(App.WIDTH / 3);
        imageView.setPreserveRatio(true);
        button.setGraphic(imageView);
        //button.setWrapText(true);
        button.setOnMouseClicked((e) -> {
            FileLoader fileLoader = new FileLoader(primaryStage);
            File fileChosen = fileLoader.chooseFile();
            if (fileChosen != null) {
                startGame(fileChosen);
            }
        });
//      getRotation(button);
        return button;
    }
项目:uPMT    文件:TypeTreeViewControllerProperty.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    nomType.setText(type.getType().getName());

    File image = new File("./img/property.png");
    Image icon = new Image(image.toURI().toString());
    this.propertyIcon.setImage(icon);

    File imageRename = new File("./img/rename.png");
    Node iconRename = new ImageView(new Image(imageRename.toURI().toString()));
    this.rename.setGraphic(iconRename);

    File delete = new File("./img/delete.gif");
    Node iconDelete = new ImageView(new Image(delete.toURI().toString()));
    this.deleteProperty.setGraphic(iconDelete);

    Tooltip deletePropertyTip = new Tooltip("Suppression de la propriet�");
    deleteProperty.setTooltip(deletePropertyTip);
    Tooltip renameTip = new Tooltip("Renommer la propriet�");
    rename.setTooltip(renameTip);
    initNumber();
}
项目:Curriculum-design-of-data-structure    文件:Points2Controller.java   
private void startGame(){
        btStart.setText("刷新");
        answer.setText("");
        showCards.getChildren().clear();
        points1 = new Points1();
        answers = points1.getAnswers();
        imageView = new ImageView[points1.getCardNumber()];
        for (int i = 0; i < imageView.length; i++) {
            imageView[i] = new ImageView();
        }

        //关键
//                Image image = new Image(getClass().getResource("../cards/2.jpg").toExternalForm());//设置图片
//                card2.setImage(image);//设置图片

        for (int i = 0; i < points1.getCardRealNumber().length; i++) {
            Image image = new Image(getClass().getResource(PATH + points1.getCardRealNumber()[i] + SUFFIX).toExternalForm());//设置图片
            imageView[i] = new ImageView(image);
            showCards.getChildren().add(imageView[i]);
        }

    }
项目:ChatRoom-JavaFX    文件:EmojiDisplayer.java   
/**
 * 创建emoji图片节点
 *
 * @param emoji
 *            emoji
 * @param size
 *            图片显示大小
 * @param pad
 *            图片间距
 * @param isCursor
 *            是否需要图片光标及鼠标处理事件
 * @return
 */
public static Node createEmojiNode(Emoji emoji, int size, int pad) {
    // 将表情放到stackpane中
    StackPane stackPane = new StackPane();
    stackPane.setMaxSize(size, size);
    stackPane.setPrefSize(size, size);
    stackPane.setMinSize(size, size);
    stackPane.setPadding(new Insets(pad));
    ImageView imageView = new ImageView();
    imageView.setFitWidth(size);
    imageView.setFitHeight(size);
    imageView.setImage(ImageCache.getInstance().getImage(getEmojiImagePath(emoji.getHex())));
    stackPane.getChildren().add(imageView);

    return stackPane;
}
项目:incubator-netbeans    文件:DigitalClock.java   
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Digital Clock");
    Group root = new Group();
    Scene scene = new Scene(root, 480, 412);
    // add background image
    ImageView background = new ImageView(new Image(getClass().getResourceAsStream("DigitalClock-background.png")));
    // add digital clock
    clock = new Clock(Color.ORANGERED, Color.rgb(50,50,50));
    clock.setLayoutX(45);
    clock.setLayoutY(186);
    clock.getTransforms().add(new Scale(0.83f, 0.83f, 0, 0));
    // add background and clock to sample
    root.getChildren().addAll(background, clock);
    primaryStage.setScene(scene);
    primaryStage.show();
}
项目:javafx-dataviewer    文件:ImageToggleButton.java   
public ImageToggleButton(String imageurl) {
    setGraphic(new ImageView(new Image(getClass().getResourceAsStream(imageurl))));
    setStyle(STYLE_NORMAL);

    setOnMousePressed(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            if (toggle) {
                setStyle(STYLE_NORMAL);
                toggle = false;
            } else {
                setStyle(STYLE_PRESSED);
                toggle = true;
            }
        }
    });
}
项目:jmonkeybuilder    文件:Toneg0DParticleInfluencersTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {

    final Toneg0dParticleInfluencers element = getElement();
    final ParticleEmitterNode emitterNode = element.getEmitterNode();

    final Menu createMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
    final ObservableList<MenuItem> createItems = createMenu.getItems();

    CONSTRUCTORS.forEach((type, constructor) -> {
        if (emitterNode.getInfluencer(type) != null) return;
        createItems.add(newInstance(constructor, nodeTree, this));
    });

    items.add(createMenu);

    super.fillContextMenu(nodeTree, items);
}
项目:Curriculum-design-of-data-structure    文件:Points1Controller.java   
private void startGame(){
        btStart.setText("刷新");
        showCards.getChildren().clear();
        points1 = new Points1();
        imageView = new ImageView[points1.getCardNumber()];
        for (int i = 0; i < imageView.length; i++) {
            imageView[i] = new ImageView();
        }

        //关键
//                Image image = new Image(getClass().getResource("../cards/2.jpg").toExternalForm());//设置图片
//                card2.setImage(image);//设置图片

        for (int i = 0; i < points1.getCardRealNumber().length; i++) {
            Image image = new Image(getClass().getResource(PATH + points1.getCardRealNumber()[i] + SUFFIX).toExternalForm());//设置图片
            imageView[i] = new ImageView(image);
            showCards.getChildren().add(imageView[i]);
        }

    }
项目:drd    文件:CellUtils.java   
public static final <S> TableCell<S, Image> forImage() {
    final ImageView imageView = new ImageView();
    {
        imageView.setFitWidth(ItemSlot.SLOT_SIZE);
        imageView.setFitHeight(ItemSlot.SLOT_SIZE);
    }
    return new TableCell<S, Image>() {
        @Override
        protected void updateItem(Image item, boolean empty) {
            super.updateItem(item, empty);

            if (empty) {
                setText(null);
                setGraphic(null);
            } else {
                imageView.setImage(item);
                setGraphic(imageView);
            }
        }
    };
}
项目:voogasalad-ltub    文件:GameManager.java   
private HBox initSystemSettings() {
    HBox settingBox = new HBox();
    settingBox.setAlignment(Pos.TOP_RIGHT);
    settingBox.setSpacing(15);

    Button musicButton = new Button();
    ImageView musicImageView = new ImageView(
            new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("music"))));
    musicImageView.setFitWidth(20);
    musicImageView.setPreserveRatio(true);
    musicButton.setGraphic(musicImageView);
    musicButton.setOnMousePressed(e -> {
        // TODO show a menu of several choices of background music
        System.out.println("Here should be a menu of background music choices.");
    });
    settingBox.getChildren().add(musicButton);
    return settingBox;
}
项目:gatepass    文件:SysSettings.java   
public void rotateHer(Label labelHer, ImageView iv)
{
    RotateTransition rotation = new RotateTransition(Duration.seconds(2.3), iv);
    rotation.setCycleCount(Animation.INDEFINITE);
    rotation.setByAngle(360);

    iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
    iv.setRotationAxis(Rotate.Y_AXIS);

    labelHer.setOnMouseEntered(e ->
    { 
        rotation.play();
        iv.setRotate(180);
    });
    labelHer.setOnMouseExited(e ->
    { 
        rotation.pause();
        iv.setRotate(0);
    });
}
项目:marathonv5    文件:ReflectionSample.java   
public ReflectionSample() {
    super(100,200);
    ImageView sample = new ImageView(BOAT);
    sample.setPreserveRatio(true);
    sample.setFitHeight(100);
    final Reflection reflection = new Reflection();
    sample.setEffect(reflection);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d)
    );
    // END REMOVE ME
}
项目:voogasalad-ltub    文件:ScreenMap.java   
private void redrawGrid() {
    Map<SpriteMakerModel, Boolean> onScreenOrNot = myModel.getIfTileOnScreen();
    for (SpriteMakerModel sprite : onScreenOrNot.keySet()) {
        if (onScreenOrNot.get(sprite) == false) {
            onScreenOrNot.put(sprite, true);
            for (Component c : sprite.getDeprecatedComponents().values()) {
                if (c.getType().equals(Images.TYPE)) {
                    Images imageComponent = (Images) c;
                    ImageView imageView = new ImageView(imageComponent.image().getFXImage());
                    imageView.setFitHeight(myGrid.getHeight() / myModel.getNumRows());
                    imageView.setFitWidth(myGrid.getWidth() / myModel.getNumCols());
                    Component possiblePosition = sprite.getComponentByType(Position.TYPE);
                    if (possiblePosition != null) {
                        Position pos = (Position) possiblePosition;
                        GamePoint percentPoint = pos.pos();
                        GamePoint gridCoords = getCoordOfMouseHover(percentPoint.x()*getScreenWidth(), percentPoint.y()*getScreenHeight());
                        Integer xPos = (int) gridCoords.x();
                        Integer yPos = (int) gridCoords.y();
                        myGrid.add(imageView, xPos, yPos);
                    }
                }
            }
        }           
    }
}
项目:gatepass    文件:MainWindow.java   
public void rotateHer(Label labelHer, ImageView iv)
{
    RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
    rotation.setCycleCount(Animation.INDEFINITE);
    rotation.setByAngle(360);

    iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
    iv.setRotationAxis(Rotate.Y_AXIS);

    labelHer.setOnMouseEntered(e ->
    { 
        rotation.play();
        iv.setRotate(180);
    });
    labelHer.setOnMouseExited(e ->
    { 
        rotation.pause();
        iv.setRotate(0);
    });
}
项目:vertx-generator    文件:IndexController.java   
/**
 * 加载数据库到树集
 * 
 * @throws Exception
 */
public void loadTVDataBase() throws Exception {
    TreeItem<String> rootTreeItem = tvDataBase.getRoot();
    rootTreeItem.getChildren().clear();
    List<DatabaseConfig> item = null;
    item = ConfigUtil.getDatabaseConfig();
    for (DatabaseConfig dbConfig : item) {
        TreeItem<String> treeItem = new TreeItem<String>();
        treeItem.setValue(dbConfig.getConnName());
        ImageView dbImage = new ImageView("image/database.png");
        dbImage.setFitHeight(20);
        dbImage.setFitWidth(20);
        dbImage.setUserData(dbConfig);
        treeItem.setGraphic(dbImage);
        rootTreeItem.getChildren().add(treeItem);
    }
}
项目:jmonkeybuilder    文件:ResourcePropertyEditorControl.java   
@Override
@FXThread
protected void createComponents() {
    super.createComponents();

    resourceLabel = new Label(NOT_SELECTED);

    final Button changeButton = new Button();
    changeButton.setGraphic(new ImageView(Icons.ADD_16));
    changeButton.setOnAction(event -> processSelect());

    final HBox container = new HBox(resourceLabel, changeButton);
    container.prefWidthProperty().bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));

    resourceLabel.prefWidthProperty().bind(container.widthProperty());

    FXUtils.addToPane(container, this);

    FXUtils.addClassesTo(container, CSSClasses.DEF_HBOX, CSSClasses.TEXT_INPUT_CONTAINER);
    FXUtils.addClassesTo(changeButton, CSSClasses.FLAT_BUTTON, CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
    FXUtils.addClassTo(resourceLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL);

    DynamicIconSupport.addSupport(changeButton);
}
项目:Curriculum-design-of-data-structure    文件:TailGame2Controller.java   
@FXML
protected void selectAction(MouseEvent e){
    String source1 = e.getSource().toString(); //yields complete string
    String source2 = e.getPickResult().getIntersectedNode().getId(); //获取点击的节点id returns JUST the id of the object that was clicked

    imageView = (ImageView) (showCoins.getScene().lookup("#" + source2));
    if(inputFormCoins[Integer.valueOf(source2)] == 'H'){
        imageView.setImage(new Image(getClass().getResource(PATH + 'T' + SUFFIX).toExternalForm()));
        inputFormCoins[Integer.valueOf(source2)] = 'T';
    }else {
        imageView.setImage(new Image(getClass().getResource(PATH + 'H' + SUFFIX).toExternalForm()));
        inputFormCoins[Integer.valueOf(source2)] = 'H';
    }
    tailGame = new TailGame(this.rowNum, this.columnNum);

}
项目:OftenPorter    文件:ImageViewBinder.java   
public ImageViewBinder(ImageView view)
{
    super(view);
    actionHandler = new EventHandler<ActionEvent>()
    {
        @Override
        public void handle(ActionEvent event)
        {
            onOccur();
        }
    };
    view.addEventFilter(ActionEvent.ACTION, actionHandler);
    changeListener = new ChangeListener<Image>()
    {
        @Override
        public synchronized void changed(ObservableValue<? extends Image> observable, Image oldValue,
                Image newValue)
        {
            doOnchange(oldValue, newValue);
        }
    };
    view.imageProperty().addListener(changeListener);
}
项目:octoBubbles    文件:InsertIMG.java   
private void openFile(File file) {
    try {

        myImageView = new ImageView();
        BufferedImage bufferedImage = ImageIO.read(file);
        Image image = SwingFXUtils.toFXImage(bufferedImage, null);
        myImageView.setImage(image);
        controller.createPictureView(myImageView, image, point);


    } catch (Exception ex) {
        Logger.getLogger(InsertIMG.class.getName()).log(
                Level.SEVERE, null, ex
        );
    }
}
项目:ClassViewer    文件:ViewerToolBar.java   
public ViewerToolBar(Viewer viewer) {
    this.viewer = viewer;

    Button openFile = new Button(null, new ImageView(ImageUtils.openFileImage));
    openFile.setOnAction(event -> viewer.openFile());
    openFile.setTooltip(new Tooltip("Open file"));

    Button openFolder = new Button(null, new ImageView(ImageUtils.openFolderImage));
    openFile.setOnAction(event -> viewer.openFile());
    openFile.setTooltip(new Tooltip("Open folder"));

    this.getItems().addAll(openFile, openFolder);
}
项目:Coconut-IDE    文件:TreeUpdater.java   
private TreeItem<Path> setRootItem(Path path) {
    WatcherStructure rootInWatcher = new WatcherStructure(path, project, tabUpdater, this);

    TreeItem<Path> rootNode = new CustomTreeItem(path, rootInWatcher, project, tabUpdater, this);
    rootNode.setExpanded(true);
    CustomIcons customIcons = new CustomIcons();
    rootNode.setGraphic(new ImageView(customIcons.getFolderExpandImage()));
    rootNode.expandedProperty().addListener(expanderListener());

    return rootNode;
}
项目:jmonkeybuilder    文件:SettingsDialog.java   
/**
 * Create the additional envs control.
 */
@FXThread
private void createAdditionalEnvsControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_ENVS_FOLDER_LABEL + ":");
    final HBox fieldContainer = new HBox();

    additionalEnvsField = new TextField();
    additionalEnvsField.setEditable(false);
    additionalEnvsField.prefWidthProperty().bind(root.widthProperty());

    final Button addButton = new Button();
    addButton.setGraphic(new ImageView(Icons.ADD_12));
    addButton.setOnAction(event -> processAddEF());

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> processRemoveEF());
    removeButton.disableProperty().bind(additionalEnvsField.textProperty().isEmpty());

    FXUtils.addToPane(label, fieldContainer, container);
    FXUtils.addToPane(additionalEnvsField, addButton, removeButton, fieldContainer);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(additionalEnvsField, CSSClasses.TRANSPARENT_TEXT_FIELD);
    FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(additionalEnvsField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
    FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
            CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);

    DynamicIconSupport.addSupport(addButton, removeButton);
}
项目:PSE    文件:Toast.java   
/**
 * Toast constructor.
 * @param title Title.
 * @param msg Message.
 * @param iconName Icon name.
 */
public Toast(String title, String msg, String iconName){
    setTitle(new Label(title));
    setMsg(new Label(msg));
    setIcon(new ImageView( sample.Main.class.getResource(ICONS_PATH + iconName + ICONS_EXT).toString() ) );
    create();
}
项目:PSE    文件:WinPreviewImageController.java   
/**
 * Resize the image.
 * @return Resized image.
 */
public ImageView changeDimensionImage(){
    ImageView imageView = new ImageView( getImage() );
    imageView.setFitWidth(dimPreviewImage.getWidth());
    imageView.setFitHeight(dimPreviewImage.getHeight());
    return imageView;
}
项目:Java-9-Programming-Blueprints    文件:SocialMediaItemViewCell.java   
private Node buildItemCell(SocialMediaItem item) {
    HBox hbox = new HBox();
    InputStream resource = item.getClass().getResourceAsStream("icon.png");
    if (resource != null) {
        ImageView sourceImage = new ImageView();
        sourceImage.setFitHeight(18);
        sourceImage.setPreserveRatio(true);
        sourceImage.setSmooth(true);
        sourceImage.setCache(true);
        sourceImage.setImage(new Image(resource));
        hbox.getChildren().add(sourceImage);
    }

    if (item.getImage() != null) {
        HBox picture = new HBox();
        picture.setPadding(new Insets(0, 10, 0, 0));
        ImageView imageView = new ImageView(item.getImage());
        imageView.setPreserveRatio(true);
        imageView.setFitWidth(150);
        picture.getChildren().add(imageView);
        hbox.getChildren().add(picture);
    }

    Label text = new Label(item.getBody());
    text.setFont(Font.font(null, 20));
    text.setWrapText(true);
    hbox.getChildren().add(text);

    return hbox;
}
项目:GameAuthoringEnvironment    文件:BasicUIFactory.java   
public ImageView makeImageView (String imageURL, double width, double height) {
    ImageView image =
            makeImageView(imageURL, new SimpleDoubleProperty(width),
                          new SimpleDoubleProperty(height));
    return image;

}
项目:voogasalad-ltub    文件:ScreenObjectHolder.java   
private void sourceSetOnDragDetected(ImageView source, MouseEvent e) {
    Dragboard db = source.startDragAndDrop(TransferMode.COPY);
    ClipboardContent content = new ClipboardContent();
    Image sourceImage = source.getImage();
    String imageName = getImageName(sourceImage);
    content.putString(imageName);
    content.putImage(source.getImage());
    db.setContent(content);
    e.consume();
}
项目:GazePlay    文件:StatsDisplay.java   
private static EventHandler<Event> createZoomOutHeatMapEventHandler(ImageView heatMap, Scene scene,
        int originalIndexInParent) {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {
            heatMap.removeEventHandler(MouseEvent.MOUSE_CLICKED, this);

            zoomOutAndReset(heatMap);

            resetToOriginalIndexInParent(heatMap, originalIndexInParent);

            heatMap.addEventHandler(MouseEvent.MOUSE_CLICKED, createZoomInHeatMapEventHandler(heatMap, scene));
        }
    };
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
项目:marathonv5    文件:TitledPaneSample.java   
@Override public void start(Stage stage) {
    stage.setTitle("TitledPane");
    Scene scene = new Scene(new Group(), 450, 250);

    TitledPane gridTitlePane = new TitledPane();
    GridPane grid = new GridPane();
    grid.setVgap(4);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("First Name: "), 0, 0);
    grid.add(new TextField(), 1, 0);
    grid.add(new Label("Last Name: "), 0, 1);
    grid.add(new TextField(), 1, 1);
    grid.add(new Label("Email: "), 0, 2);
    grid.add(new TextField(), 1, 2);        
    grid.add(new Label("Attachment: "), 0, 3);
    grid.add(label,1, 3);
    gridTitlePane.setText("Grid");
    gridTitlePane.setContent(grid);

    final Accordion accordion = new Accordion ();      

    for (int i = 0; i < imageNames.length; i++) {
        images[i] = 
            new Image(getClass().getResourceAsStream(imageNames[i]+".jpg"));
        pics[i] = new ImageView(images[i]);
        tps[i] = new TitledPane(imageNames[i],pics[i]); 
    }   
    accordion.getPanes().addAll(tps);


    accordion.expandedPaneProperty().addListener(
        (ObservableValue<? extends TitledPane> ov, TitledPane old_val, 
        TitledPane new_val) -> {
            if (new_val != null) {
                label.setText(accordion.getExpandedPane().getText()
                        + ".jpg");
            }
    });

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(gridTitlePane, accordion);

    Group root = (Group)scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}
项目:octoBubbles    文件:StartController.java   
@FXML
public void initialize() {
    Image icon = new Image("com/kaanburaksener/octoUML/src/icons/classDiagram.PNG");
    classDiagramButton.setGraphic(new ImageView(icon));
    classDiagramButton.setContentDisplay(ContentDisplay.BOTTOM);

    titleLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 60));
    titleLabel.setTextFill(Color.web("#3F4144"));
}
项目:jmonkeybuilder    文件:DynamicIconSupport.java   
/**
 * Adds support changing icons by selection.
 *
 * @param button the button.
 */
@FXThread
public static void addSupport(@NotNull final ToggleButton button) {

    final EditorConfig editorConfig = EditorConfig.getInstance();
    final CssColorTheme theme = editorConfig.getTheme();

    if (!theme.needRepaintIcons()) {
        return;
    }

    final ImageView graphic = (ImageView) button.getGraphic();
    final Image image = graphic.getImage();
    final Image original = FILE_ICON_MANAGER.getOriginal(image);

    final ObservableMap<Object, Object> properties = button.getProperties();
    properties.put(NOT_SELECTED_IMAGE, image);
    properties.put(SELECTED_IMAGE, original);

    button.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            graphic.setImage((Image) properties.get(SELECTED_IMAGE));
        } else {
            graphic.setImage((Image) properties.get(NOT_SELECTED_IMAGE));
        }
    });

    if (button.isSelected()) {
        graphic.setImage(original);
    } else {
        graphic.setImage(image);
    }
}
项目:jmonkeybuilder    文件:EditorAreaComponent.java   
/**
 * Add and open the new file editor.
 *
 * @param editor   the editor
 * @param needShow the need show
 */
@FXThread
private void addEditor(@NotNull final FileEditor editor, final boolean needShow) {

    final Path editFile = editor.getEditFile();

    final Tab tab = new Tab(editor.getFileName());
    tab.setGraphic(new ImageView(ICON_MANAGER.getIcon(editFile, DEFAULT_FILE_ICON_SIZE)));
    tab.setContent(editor.getPage());
    tab.setOnCloseRequest(event -> handleRequestToCloseEditor(editor, tab, event));

    final ObservableMap<Object, Object> properties = tab.getProperties();
    properties.put(KEY_EDITOR, editor);

    editor.dirtyProperty().addListener((observable, oldValue, newValue) -> {
        tab.setText(newValue == Boolean.TRUE ? "*" + editor.getFileName() : editor.getFileName());
    });

    final ObservableList<Tab> tabs = getTabs();
    tabs.add(tab);

    if (needShow) {
        final SingleSelectionModel<Tab> selectionModel = getSelectionModel();
        selectionModel.select(tab);
    }

    DictionaryUtils.runInWriteLock(getOpenedEditors(), editFile, tab, ObjectDictionary::put);

    EditorUtil.decrementLoading();

    if (isIgnoreOpenedFiles()) {
        return;
    }

    final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();

    if (workspace != null) {
        workspace.addOpenedFile(editFile, editor);
    }
}
项目:lttng-scope    文件:ModelConfigButton.java   
/**
 * Constructor
 *
 * @param widget
 *            The time graph widget to which this toolbar button is
 *            associated.
 */
public ModelConfigButton(TimeGraphWidget widget) {
    Image icon = JfxImageFactory.instance().getImageFromResource(LEGEND_ICON_PATH);
    setGraphic(new ImageView(icon));
    setTooltip(new Tooltip(Messages.modelConfigButtonName));

    setOnAction(e -> {
        Dialog<?> dialog = new ModelConfigDialog(widget);
        dialog.show();
        JfxUtils.centerDialogOnScreen(dialog, ModelConfigButton.this);
    });
}
项目:jmonkeybuilder    文件:NewFileAction.java   
public NewFileAction(@NotNull final ResourceElement element) {
    setText(Messages.ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_NEW_FILE);
    setGraphic(new ImageView(Icons.NEW_FILE_16));

    final ObservableList<MenuItem> items = getItems();

    final Array<FileCreatorDescription> descriptions = CREATOR_REGISTRY.getDescriptions();
    descriptions.forEach(description -> items.add(new NewFileByCreatorAction(element, description)));
}
项目:HotaruFX    文件:ImageNode.java   
private ImageNode(String url, ImageView imageView) {
    super(imageView);
    this.imageView = imageView;
    imageView.imageProperty().setValue(new Image(url));
    x = PropertyTimelineHolder.empty();
    y = PropertyTimelineHolder.empty();
    fitWidth = PropertyTimelineHolder.empty();
    fitHeight = PropertyTimelineHolder.empty();
    preserveRatio = PropertyTimelineHolder.empty();
    smooth = PropertyTimelineHolder.empty();
}
项目:gatepass    文件:Office_Entry.java   
private VBox getActionPane(){
progress= new Text("Office\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");

Image iconf= new Image(Office_Entry.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);

Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);

txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);     
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");

txtsearch= new TextField();
initFilter();

Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");

Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
    setAddAttendance();
});

btnView.setOnAction(e -> {
    timelineDown.play();
});
btnCloseView.setOnAction(e -> {
    timelineUp.play();
});


VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);

HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);

VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));

HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
 }
项目:can4eve    文件:ClockPane.java   
/**
 * create the Clock Pane
 */
public ClockPane() {
  // add a normal running clock
  clock = ClockBuilder.create().skinType(ClockSkinType.LCD)
      .lcdDesign(LcdDesign.GRAY).title(I18n.get(I18n.WATCH_TIME))
      .titleVisible(true).secondsVisible(true).alarmsEnabled(false)
      .dateVisible(true).running(true).autoNightMode(true)
      .locale(Translator.getCurrentLocale()).build();

  String[] icons = { "car", "plug", "parking", "total" };
  String[] titles = { I18n.WATCH_MOVING,
      I18n.WATCH_CHARGING, I18n.WATCH_PARKING,
      I18n.WATCH_TOTAL};
  watches = new JFXStopWatch[Watch.values().length];
  this.msecsStart=new long[Watch.values().length];
  for (Watch watch : Watch.values()) {
    int index = watch.ordinal();
    JFXStopWatch stopWatch = new JFXStopWatch(titles[index]);
    stopWatch.halt();
    stopWatch.reset();
    watches[index] = stopWatch;
    msecsStart[index] =0;
    String icon = icons[index];
    URL iconUrl = this.getClass().getResource("/icons/" + icon + ".png");
    if (iconUrl != null) {
      stopWatch.setIcon(new ImageView(iconUrl.toString()));
    }
    stopWatch.setActive(false);
    if (index < Watch.Total.ordinal()) {
      BorderPane pane = wrapImageView(stopWatch.getIcon());
      this.add(pane, 0, index);
      this.add(stopWatch.get(), 1, index);
    }
    index++;
  }
  this.add(clock, 2, 0);
  this.add(getWatch(Watch.Total).get(), 2, 1);
  fixRowSizes(4, 33, 33, 33);
  fixColumnSizes(4, 20, 40, 40);
}