JavaFX UI组件和多媒体 UML图
1.Labeled 和 标签 Label
| javafx.scene.control.Labeled | |
|---|---|
| -alignment: ObjectProperty<Pos> | 指定labeled中文本和结点的对齐方式 |
| -contentDisplay: ObjectProperty<ContentDisplay> | 使用ContentDisplay中定义的常量TOP、BOTTOM、LEFT和RIGHT指定结点相对于文本的位置 |
| -graphic: ObjectProperty<Node> | 用于labeled的图形 |
| -graphicTextGap: DoubleProperty | 图形和文本之间的间隔 |
| -textFill: ObjectProperty<Paint> | 用于填充文本的图画 |
| -text: StringProperty | 用于标签的文本 |
| -underline: BooleanProperty | 文本是否要加下划线 |
| -wrapText: BooleanProperty | 如果文本超过了宽度,是否要换至下一行 |
| javafx.scene.control.Label | extends Labeled |
|---|---|
| +Label() | 创建一个空的Label |
| +Label(text: String) | 创建一个特定文本的标签 |
| +Label(text: String, graphic: Node) | 创建一个特定文本和图形的标签 |
2.按钮 Button
| javafx.scene.control.ButtonBase | extends Labeled |
|---|---|
| -onAction: ObjectProperty<EventHandler<ActionEvent>> | 定义一个处理按钮动作的处理器 |
| javafx.scene.control.Button | extends ButtonBase |
|---|---|
| +Button() | 创建一个空按钮 |
| +Button(text: String) | 创建一个具有给定文本的按钮 |
| +Button(text:String, graphic: Node) | 创建一个具有给定文本和图片的按钮 |
3.复选框 CheckBox
| javafx.scene.control.ButtonBase | extends Labeled |
|---|---|
| -onAction: ObjectProperty<EventHandler<ActionEvent>> | 定义一个处理按钮动作的处理器 |
| javafx.scene.control.CheckBox | extends ButtonBase |
|---|---|
| -selected: BooleanProperty | 标识一个复选框是否被选中 |
| ——————————————— | —————————— |
| +CheckBox() | 创建一个空的复选框 |
| +CheckBox(text: String) | 创建一个具有特定文本的复选框 |
4.单选按钮 RadioButton
| javafx.scene.control.ToggleButton | |
|---|---|
| -selected: BooleanProperty | 表明按钮是否被选中 |
| -toggleGroup: ObjectProperty<ToggleGroupe> | 表明按钮属于的按钮组 | <

本文详细介绍了JavaFX中的UI组件,包括Labeled、Button、CheckBox、RadioButton、TextField、TextArea、ComboBox、ListView、ScrollBar、Slider等,并探讨了相关内容如ContentDisplay、ObservableList和SelectionModel。此外,还讲解了如何处理多媒体,如MediaView和MediaPlayer的使用。文章以UML图的形式展示了组件的属性和方法,同时提供了相关题目和知识点作为补充。
最低0.47元/天 解锁文章
1933

被折叠的 条评论
为什么被折叠?



