我有一张JavaFX应用程序的图片,它被加载到图表中30次。我使用此代码加载它并缩小大小。
ImageView livePerformIcon = new ImageView(MainApp.class.getResource("/images/Untitledwdwd.png").toExternalForm());
livePerformIcon.setFitHeight(100);
livePerformIcon.setFitWidth(100);
label.setGraphic(livePerformIcon);
您能告诉我们如何优化此代码以提高性能和内存是否有办法在工作期间节省资源。
也许livePerformIcon.setCache(true);可以解决这个问题吗?