本文整理汇总了Java中javafx.scene.image.ImageView.getImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getImage方法的具体用法?Java ImageView.getImage怎么用?Java ImageView.getImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.getImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sourceSetOnDragDetected
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
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();
}
示例2: show
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
@FXThread
protected void show() {
final ImageView imageView = getImageView();
if (imageView.getImage() == null) {
showImage(path);
}
super.show();
}
示例3: addSupport
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
* 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);
}
}
示例4: updateListener
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@FXThread
private static void updateListener(@NotNull final Node node, @NotNull final ImageView imageView,
@NotNull final ReadOnlyBooleanProperty condition,
@NotNull final Object listenerKey, @NotNull final Object notSelectedKey,
@NotNull final Object selectedKey) {
final EditorConfig editorConfig = EditorConfig.getInstance();
final CssColorTheme theme = editorConfig.getTheme();
if (!theme.needRepaintIcons()) {
return;
}
final ObservableMap<Object, Object> properties = node.getProperties();
final Image newImage = imageView.getImage();
if (newImage == null) {
properties.remove(listenerKey);
return;
}
final Image original = FILE_ICON_MANAGER.getOriginal(newImage);
properties.put(notSelectedKey, newImage);
properties.put(selectedKey, original);
final ChangeListener<Boolean> listener = (observable, oldValue, newValue) -> {
if (newValue) {
imageView.setImage((Image) properties.get(selectedKey));
} else {
imageView.setImage((Image) properties.get(notSelectedKey));
}
};
condition.addListener(listener);
properties.put(listenerKey, listener);
if (condition.get()) {
imageView.setImage(original);
} else {
imageView.setImage(newImage);
}
}
示例5: clickSelectCardHandle
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@FXML
public void clickSelectCardHandle(Event event){
ImageView tmp = (ImageView) event.getSource();
LocatedImage img = (LocatedImage) tmp.getImage();
this.carteClicked = img.getURL();
if(this.carteSelected.contains(img.getURL())){
tmp.setEffect(null);
this.carteSelected.remove( img.getURL());
}else{
DropShadow ds = new DropShadow(20,Color.AQUA);
tmp.setEffect(ds);
this.carteSelected.add( img.getURL());
}
}