为什么我需要Swing Utilities以及如何使用它? [英] Why do I need Swing Utilities and how do I use it?

查看:158
本文介绍了为什么我需要Swing Utilities以及如何使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这主要是关于我的问题这里,但我不明白为什么需要Swing Utilities 以及它的用途。我正在设计一个摇摆gui,我不想错过Swing Utilities可能提供的任何东西。也有人可以解释 invokeLater 方法的作用及其工作原理。

This is mainly in regards to my question here, but I don't understand why Swing Utilities is needed and what it is used for. I'm designing a swing gui and I don't wanna miss out on anything that Swing Utilities might offer. Also could someone could explain what the invokeLater method does and how it works.

推荐答案

API 中所述, SwingUtilities 是Swing实用程序方法的集合。在这种情况下,需要确保在Event Dispatch Thread中创建/修改Swing组件,或者 EDT 。另外,如 API invokeLater

As stated in the API, SwingUtilities is a collection of utility methods for Swing. In this case, it is needed to ensure that Swing components are created/modified in the Event Dispatch Thread, or EDT. Also, as stated in the API, invokeLater is used when an application thread needs to update the GUI.

您可能还想阅读 Swing中的并发。另外,对invokeLater进行更深入的解释

You might also want to read up on Concurrency in Swing. Also, a More In-Depth Explanation of invokeLater.

这篇关于为什么我需要Swing Utilities以及如何使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆