use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class FxControlsTreeItem method getImage.
/**
* resources패키지로부터 image를 가져오는 처리
*
* @param name
* @return
*/
ImageView getImage(String name) {
try {
String name2 = "images/nodeicons/" + name + ".png";
URL resource = this.getClass().getClassLoader().getResource(name2);
if (resource != null) {
File file = new File(resource.toURI());
if (file.exists())
return new ImageView(new Image(resource.openStream()));
}
} catch (Exception e) {
// not important...
}
return new ImageView();
}
use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class SpecExample method start.
@Override
public void start(Stage primaryStage) throws Exception {
String projectDir = System.getProperty("user.dir");
File file = new File(projectDir, "src/main/java/com/kyj/fx/voeditor/visual/example/SpecExample.java");
SpecResource specResource = new SpecResource(new File(projectDir), file);
SpecTabPane center = new SpecTabPane(specResource);
Button btnCapture = new Button("SnapShot");
ImageView ivOrigin = new ImageView();
btnCapture.setOnAction(ev -> {
FxUtil.snapShot(center, new File("example.png"));
FxUtil.printJob(primaryStage, center);
});
Text text1 = new Text("Big italic red text");
text1.setFill(Color.RED);
text1.setFont(Font.font("Helvetica", FontPosture.ITALIC, 40));
Text text2 = new Text(" little bold blue text");
text2.setFill(Color.BLUE);
text2.setFont(Font.font("Helvetica", FontWeight.BOLD, 10));
TextFlow textFlow = new TextFlow(text1, text2);
BorderPane root = new BorderPane(center);
root.setTop(new HBox(textFlow, btnCapture));
root.setBottom(ivOrigin);
root.setPrefSize(800, 600);
Scene value = new Scene(root, 800, 600);
primaryStage.setScene(value);
primaryStage.show();
}
use of javafx.scene.image.ImageView in project bitsquare by bitsquare.
the class ImageUtil method getImageViewById.
public static ImageView getImageViewById(String id) {
ImageView imageView = new ImageView();
imageView.setId(id);
return imageView;
}
use of javafx.scene.image.ImageView in project BoofCV by lessthanoptimal.
the class ExampleFxShowImage method start.
@Override
public void start(Stage stage) throws Exception {
Image image = new Image("file://" + UtilIO.pathExample("standard/lena512.jpg"));
ImageView imageView = new ImageView();
imageView.setImage(image);
StackPane root = new StackPane();
root.getChildren().add(imageView);
Scene scene = new Scene(root);
stage.setTitle("Show Image Example");
stage.setScene(scene);
stage.show();
}
use of javafx.scene.image.ImageView in project mybatis-generator-gui by zouzg.
the class MainUIController method loadLeftDBTree.
void loadLeftDBTree() {
TreeItem rootTreeItem = leftDBTree.getRoot();
rootTreeItem.getChildren().clear();
try {
List<DatabaseConfig> dbConfigs = ConfigHelper.loadDatabaseConfig();
for (DatabaseConfig dbConfig : dbConfigs) {
TreeItem<String> treeItem = new TreeItem<>();
treeItem.setValue(dbConfig.getName());
ImageView dbImage = new ImageView("icons/computer.png");
dbImage.setFitHeight(16);
dbImage.setFitWidth(16);
dbImage.setUserData(dbConfig);
treeItem.setGraphic(dbImage);
rootTreeItem.getChildren().add(treeItem);
}
} catch (Exception e) {
_LOG.error("connect db failed, reason: {}", e);
AlertUtil.showErrorAlert(e.getMessage() + "\n" + ExceptionUtils.getStackTrace(e));
}
}
Aggregations