Which Swing component methods are thread safe?

前端 未结 5 859
情书的邮戳
情书的邮戳 2020-11-27 05:23

According to Swing tutorial:

Some Swing component methods are labelled \"thread safe\" in the API specification; these can be safely invoked from any

5条回答
  •  迷失自我
    2020-11-27 05:34

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


    • JTextPane
      • replaceSelection()
      • insertComponent()
      • insertIcon()
      • setLogicalStyle()
      • setCharacterAttributes()
      • setParagraphAttributes()

    • JTextArea
      • insert()
      • append()
      • replaceRange()

    • JTextComponent
      • replaceSelection()
      • setText()
      • print()
      • getPrintable()

    • UndoManager
      • All methods.

    • DefaultStyledDocument
      • insert()
      • setLogicalStyle()
      • setCharacterAttributes()
      • setParagraphAttributes()

    • StyleContext
      • addAttribute()
      • addAttributes()
      • removeAttribute()
      • removeAttributes()
      • reclaim()

    • AbstractDocument
      • render()
      • remove()
      • insertString()
      • createPosition()

    • PlainDocument
      • insertString()

    • HTMLDocument
      • setParagraphAttributes()

提交回复
热议问题