遵义网站制作和推广,开发app外包公司,wordpress 如何显示摘要,成都最好的网站建设公司JavaFX默认使用jdk的程序图片显示#xff0c;可以通过以下代码进行修改设置 stage.getIcons().add(new Image(static/icon.png)); static/icon.png改为自己图片路径
这里可以使用相对路径和绝对路径#xff0c;看自己需求设置
例#xff1a;
import javafx.a…JavaFX默认使用jdk的程序图片显示可以通过以下代码进行修改设置 stage.getIcons().add(new Image(static/icon.png)); static/icon.png改为自己图片路径
这里可以使用相对路径和绝对路径看自己需求设置
例
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;import java.io.IOException;public class HelloApplication extends Application {Overridepublic void start(Stage stage) throws IOException {FXMLLoader fxmlLoader new FXMLLoader(HelloApplication.class.getResource(hello-view.fxml));Scene scene new Scene(fxmlLoader.load(), 320, 240);//设置软件图标stage.getIcons().add(new Image(static/icon.png));stage.setTitle(Hello!);stage.setScene(scene);stage.show();}public static void main(String[] args) {launch();}
}