简体   繁体   English

使用 javafx 在对话框窗格上设置左上角图像

[英]Set top left image on dialog pane with javafx

I need to set my image in the top left corner of my desktop.我需要在桌面的左上角设置我的图像。 I tried various options but I didn't find the satisfactory one.我尝试了各种选择,但没有找到令人满意的选择。 I put my code and the related screen:我把我的代码和相关的屏幕:

public void deleteUser() {
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    Toolkit.getDefaultToolkit().beep();
    alert.setTitle("Confirmation Removal");
    alert.setHeaderText("EC-18 removal user");
    alert.setContentText("Are you sure to delete " + user.getName() + " " + user.getSurname() + "?");
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK) {
        databaseConnection.delete("utenti/" + user.getUserId());
        ((Stage)label_name.getScene().getWindow()).close();
    } else {
        ((Stage)label_name.getScene().getWindow()).close();
    }
}

在此处输入图像描述

The Class that loads first when your application runs is the best place to set the little bmp image we keep it at a 32 by 32 size and we make our own with GreenFish Editor do a search it is FREE当您的应用程序运行时首先加载的 Class 是设置小 bmp 图像的最佳位置,我们将其保持为 32 x 32 大小,我们使用 GreenFish 编辑器制作我们自己的 搜索它是免费的
Welcome to Stack Overflow欢迎来到堆栈溢出

public class Start extends Application {

@Override
public void start(Stage stage) throws Exception {

    Parent root = FXMLLoader.load(getClass().getResource("start.fxml"));
    Scene scene = new Scene(root);
    scene.getStylesheets().add(getClass().getResource("checkbook.css").toExternalForm());
    stage.setScene(scene);
    stage.setResizable(false);
    stage.getIcons().add(new Image("Images/C.bmp"));// All Stages have this icon
    stage.setTitle("Check Book");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM