use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.
the class CustomTreeItem method buildItemWithMenu.
/**
* build default tree item
*
* @param title
*/
private void buildItemWithMenu(String title) {
Image itemIcon = new Image("/icons/" + treeItemType.getIcon());
ImageView itemIconContainer = new ImageView(itemIcon);
itemTitle = new Label(title);
itemTitle.getStyleClass().add("treeItemTitle");
setValue(itemTitle);
setGraphic(itemIconContainer);
}
use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.
the class NotificationPanel method buildUI.
/**
* Build component UI
*/
private void buildUI() {
this.setSpacing(5);
// add notification message
notificationContainer = new Pane();
notificationContainer.setPrefSize(184, 64);
notificationContainer.getStyleClass().add("notificationContainer");
notificationLabel = new Label();
notificationLabel.setPrefSize(155, 60);
notificationLabel.setWrapText(true);
notificationLabel.getStyleClass().add("notificationMsg");
notificationContainer.getChildren().add(notificationLabel);
getChildren().add(notificationContainer);
// add notification icon
VBox iconHolder = new VBox();
iconHolder.setPrefHeight(68);
iconHolder.setAlignment(Pos.CENTER);
ImageView notificationIcon = new ImageView(new Image("/icons/info_icon.png"));
notificationIcon.getStyleClass().add("notificationIcon");
notificationIcon.setOnMouseClicked((MouseEvent event) -> {
notificationContainer.setVisible(!notificationContainer.isVisible());
});
iconHolder.getChildren().add(notificationIcon);
getChildren().add(iconHolder);
}
use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.
the class TrafficProfileDialogController method initializeProfileBtn.
/**
* Initialize profile buttons
*/
private void initializeProfileBtn() {
createProfileBtn.setGraphic(new ImageView(new Image("/icons/add.png")));
duplicateProfileBtn.setGraphic(new ImageView(new Image("/icons/clone.png")));
deleteProfileBtn.setGraphic(new ImageView(new Image("/icons/delete.png")));
exportProfileBtn.setGraphic(new ImageView(new Image("/icons/export_profile_icon.png")));
exportToYamlBtn.setGraphic(new ImageView(new Image("/icons/export_profile_icon.png")));
loadProfileBtn.setGraphic(new ImageView(new Image("/icons/load_profile.png")));
trafficProfile = new TrafficProfile();
}
use of javafx.scene.image.ImageView in project intellij-plugins by StepicOrg.
the class AuthDialog method createButtonWithImage.
@NotNull
private Button createButtonWithImage(@NotNull Icon icon) {
BufferedImage bImg = UIUtil.createImage(icon.getIconWidth(), icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = bImg.createGraphics();
icon.paintIcon(null, graphics, 0, 0);
graphics.dispose();
WritableImage image = SwingFXUtils.toFXImage(bImg, null);
return new Button(null, new ImageView(image));
}
use of javafx.scene.image.ImageView in project jgnash by ccavanaugh.
the class ReportViewerDialogController method refresh.
private void refresh() {
final List<Node> children = pagePane.getChildren();
children.clear();
pageCount.set(0);
reportExecutor.schedule(() -> {
if (reportExecutor.getQueue().size() < 1) {
// ignore if we already have one waiting in the queue
final Task<Void> task = new Task<>() {
@Override
protected Void call() {
updateMessage(resources.getString("Message.CompilingReport"));
updateProgress(-1, Long.MAX_VALUE);
if (report.get() != null) {
for (int i = 0; i < report.get().getPageCount(); i++) {
// report resolution is fixed and the ImageView width and height are adjusted to the zoom value
final BufferedImage bufferedImage = report.get().renderImage(i, REPORT_RESOLUTION * UP_SCALING);
JavaFXUtils.runLater(() -> {
final ImageView imageView = new ImageView(SwingFXUtils.toFXImage(bufferedImage, null));
imageView.setEffect(dropShadow);
// bind the width and height to the zoom level
imageView.fitWidthProperty().bind(zoomProperty.multiply(bufferedImage.getWidth() / UP_SCALING));
imageView.fitHeightProperty().bind(zoomProperty.multiply(bufferedImage.getHeight() / UP_SCALING));
children.add(imageView);
pageCount.set(pageCount.get() + 1);
});
}
}
JavaFXUtils.runLater(() -> setPageIndex(0));
return null;
}
};
JavaFXUtils.runLater(() -> {
busyPane.setTask(task);
new Thread(task).start();
});
}
}, UPDATE_PERIOD, TimeUnit.MILLISECONDS);
}
Aggregations