TrackManagerController.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:gseproject 作者:
private void dropOnSourcePallet(DragEvent event, int sourcePalletId) {
    event.setDropCompleted(true);
    TextInputDialog addBlocksDialog = new TextInputDialog();
    addBlocksDialog.setTitle("Add Blocks");
    addBlocksDialog.setHeaderText("Enter the amount of blocks you want to add");
    Optional<String> result = addBlocksDialog.showAndWait();
    result.ifPresent(count -> sourcePallets[sourcePalletId] += Integer.parseInt(count));

    String stateImagePath;
    if (sourcePallets[sourcePalletId] <= 5) {
        stateImagePath = "images/blocks-almost-empty.png";
    } else if (sourcePallets[sourcePalletId] > 5 && sourcePallets[sourcePalletId] <= 15) {
        stateImagePath = "images/blocks-normal.png";
    } else if (sourcePallets[sourcePalletId] > 15) {
        stateImagePath = "images/blocks-full.png";
    } else {
        stateImagePath = "";
    }
    Image stateImage = new Image(getClass().getResource(stateImagePath).toString());
    ((BorderPane) event.getSource()).setCenter(new ImageView(stateImage));

    System.out.println(Arrays.toString(sourcePallets));
    event.consume();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号