Search code examples
swingscalatextareacontextmenuundo-redo

How to add contextmenu and undo/redo functionality to a scala swing textarea


When creating a new TextArea with scala.swing, there is no right-click contextmenu nor an undo functionality with Ctrl + z. Ctrl + [acv] btw works well.

How can I add these essential text-editing features?

I'm on Scala 2.9.

Thanks in advance.


Solution

  • It seems that there is no support for undo on the Scala level and as such you'll have to do it using Swing and calling the Java API. For a tutorial on how to use UndoManager, see this link.

    For the popup menu, see this question on SO.