ButtonView

ButtonView 是一个基本实现,提供了绘制按钮的功能。继承 BoxView

┌──────┐
│ text │
└──────┘

您可以为按钮设置一段文字,以及在按钮被选中时要执行的操作。

link:../../../../../src/test/java/org/springframework/shell/docs/ButtonViewSnippets.java[role=include]

Default Bindings

默认 key bindigs 为:

Table 1. Key
Command Description

Enter

Selects a button

默认 mouse bindigs 为:

Table 2. Mouse
Command Description

Released

Button1

Events

Table 3. ListView Events
Event Description

ButtonViewSelectEvent

Button is selected.