因为在程序中抛出的所有异常都是对象,所以异常的分组或分类是类层次结构的自然结果。 Java 平台中一组相关异常类的示例是`java.io` - `IOException`及其后代中定义的那些。 `IOException`是最常用的,表示执行 I / O 时可能发生的任何类型的错误。它的后代表示更具体的错误。例如,`FileNotFoundException`表示文件无法位于磁盘上。
我们做的一个改变 _ 而不是 _ make 正在从`progress`事件处理程序中删除对`progressBar.setValue`的调用。该调用不会造成任何伤害,因为不确定的进度条不使用其 value 属性,除非可能在状态字符串中显示它。事实上,尽可能保持进度条的数据是最新的,因为一些外观可能不支持不确定模式。
我们做的一个改变 _ 而不是 _ make 正在从`progress`事件处理器中删除对`progressBar.setValue`的调用。该调用不会造成任何伤害,因为不确定的进度条不使用其 value 属性,除非可能在状态字符串中显示它。事实上,尽可能保持进度条的数据是最新的,因为一些外观可能不支持不确定模式。
当我们开始实现自定义滑块模型时,我们首先查看[如何使用滑块](../components/slider.html)的 API 部分。它通知我们所有滑块数据模型必须实现`BoundedRangeModel`接口。 [`BoundedRangeModel` API 文档](https://docs.oracle.com/javase/8/docs/api/javax/swing/BoundedRangeModel.html)告诉我们该接口有一个名为`DefaultBoundedRangeModel`的实现类。 `DefaultBoundedRangeModel` 的 [API 文档显示它是`BoundedRangeModel`的通用实现。](https://docs.oracle.com/javase/8/docs/api/javax/swing/DefaultBoundedRangeModel.html)
只要用户执行了某个操作,就会发生操作事件。示例:当用户单击[按钮](../components/button.html)时,选择[菜单项](../components/menu.html),在[文本字段](../components/textfield.html)中按 Enter 键。结果是`actionPerformed`消息被发送到在相关组件上注册的所有动作侦听器。
When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. Note, however, that there can be a delay before the program exits automatically, and that under some circumstances the program might keep running. It is quicker and safer to explicitly exit the program using `System.exit(int)`. See [AWT Threading Issues](https://docs.oracle.com/javase/8/docs/api/java/awt/doc-files/AWTThreadIssues.html#Autoshutdown) for more information.