哪些 Swing 组件方法是线程安全的? [英] Which Swing component methods are thread safe?

查看:29
本文介绍了哪些 Swing 组件方法是线程安全的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Swing教程:

某些 Swing 组件方法在 API 规范中被标记为线程安全";这些可以从任何线程安全地调用.所有其他 Swing 组件方法都必须从事件分派线程中调用.忽略此规则的程序在大多数情况下可能会正常运行,但会出现难以重现的不可预测的错误.

Some Swing component methods are labelled "thread safe" in the API specification; these can be safely invoked from any thread. All other Swing component methods must be invoked from the event dispatch thread. Programs that ignore this rule may function correctly most of the time, but are subject to unpredictable errors that are difficult to reproduce.

但是这些标记为线程安全"的 Swing 组件方法是什么?真的有吗?

But what are these Swing component methods that are labelled "thread safe"? Are there actually any?

是否有完整列表的线程安全摆动方法?(线程安全的 Swing 方法似乎很少见,所以这样的列表不能太长......)

Is there a complete list of thread-safe swing methods? (The thread-safe Swing methods seems to be quite rare, so such list can't be too long...)

推荐答案

Google 教会我至少 那些是线程安全的.以下是链接再次断开的情况的概述:

Google taught me that at least those are threadsafe. Here's an overview for the case that the link get broken again:

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