CommandButton.java 文件源码

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

项目:449-central-repo 作者:
/**
 * Default constructor.
 *
 * @param button  The button that triggers the command.
 * @param command The command to run or cancel.
 * @param action  The action to do to the command.
 */
@JsonCreator
public CommandButton(@NotNull @JsonProperty(required = true) MappedButton button,
                     @NotNull @JsonProperty(required = true) Command command,
                     @NotNull @JsonProperty(required = true) Action action) {
    switch (action) {
        case WHILE_HELD:
            button.whileHeld(command);
            break;
        case WHEN_PRESSED:
            button.whenPressed(command);
            break;
        case WHEN_RELEASED:
            button.whenReleased(command);
            break;
        case CANCEL_WHEN_PRESSED:
            button.cancelWhenPressed(command);
            break;
        case TOGGLE_WHEN_PRESSED:
            button.toggleWhenPressed(command);
            break;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号