Use netbeans editor as a standalone component in a Jetpack compose desktop app #9458
-
|
I am building a desktop app in jetpack compose multiplatform and I need a code editor component. I really like the code editor in netbeans ide and was wondering if there was a way to use that editor in a kotlin jetpack compose app? I'm thinking using it in place of visual studio code with webview but unsure if this is possible. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Yes, technically, but it's not straightforward.... Compose Desktop can host Swing components via SwingPanel (you create the JComponent in its factory lambda). That part is easy and well-documented and people already embed Swing code editors like RSyntaxTextArea this way. The hard part is NetBeans's editor itself - it's built as NetBeans Platform modules that expect the module system around them (Lookup, MimeLookup for language settings, layer.xml registration). It's not a "add this jar, new up this class" component. People have pulled it out standalone before (just the editor module jars + bootstrapping minimal Lookup/MimeLookup to get an NbEditorKit-backed JEditorPane running outside the IDE), and it works... but you lose most of what makes it nice (code completion, hyperlinking, language plugins), since those are themselves NetBeans modules tied to the platform. If what you actually want is "a good code editor in a Kotlin desktop app" rather than "NetBeans's editor specifically," you'll get there much faster with RSyntaxTextArea (Swing, drop into SwingPanel directly) or a Monaco/VS Code webview bridge. Same idea you were already considering, just skip the NetBeans dependency. |
Beta Was this translation helpful? Give feedback.
Yes, technically, but it's not straightforward....
Compose Desktop can host Swing components via SwingPanel (you create the JComponent in its factory lambda). That part is easy and well-documented and people already embed Swing code editors like RSyntaxTextArea this way.
The hard part is NetBeans's editor itself - it's built as NetBeans Platform modules that expect the module system around them (Lookup, MimeLookup for language settings, layer.xml registration). It's not a "add this jar, new up this class" component. People have pulled it out standalone before (just the editor module jars + bootstrapping minimal Lookup/MimeLookup to get an NbEditorKit-backed JEditorPane running outside the…