Even when you're not creating some kind of IDE, you might still have technical end users in mind. For this kind of user, it might be handy if you'd integrate a small scripting editor into your application, as I've done here for Groovy:

The editor area above is a JEditorPane. In the constructor of the TopComponent is this code:EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-groovy");editorPane.setEditorKit(kit);FileObject fob;try { //Create a file in memory: fob = FileUtil.createMemoryFileSystem().getRoot().create Data("tmp", "groovy"); DataObject dob = DataObject.find(fob); editorPane.getDocument().putProperty( Document.StreamDescriptionProperty, dob); DialogBinding.bindComponentToFile(fob, 0, 0, editorPane); //Provide some default content: editorPane.setText("def scores = [80, 90, 70]\n\n\"\"\"Maximum: ${scores.max()}\n" + "Minimum: ${scores.min()}\"\"\"");} catch (IOException ex) { Exceptions.printStackTrace(ex);}
When the "Evaluate" button is clicked, the following happens:private void evaluateButtonActionPerformed(java.awt.event.Actio nEvent evt) { ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("groovy"); try { InputOutput inout = IOProvider.getDefault().getIO("Result", true); inout.select(); inout.getOut().print(engine.eval(editorPane.getTex t())); } catch (ScriptException ex) { Exceptions.printStackTrace(ex); }}
Right now, though syntax coloring works, as well as keyboard shortcuts (such as Ctrl-E to delete a line), the code completion does not work yet. The code comes from here, but somehow ClassPathProvider needs to be hooked into the code so that the source files on the Groovy classpath are found in order to build up the code completion box. However, if I embed a Java editor (i.e., instead of creating "tmp.groovy", I create "tmp.java"), there's no problem with code completion at all. I believe the DialogBinding statement may be the cause of the problem.

Read More about [NetBeans Groovy Editor in a JEditorPane...