The jIvalo editor has three usage scenarios.
Usage
Download jivalo-editor-version.jar file and add it to classpath.
JFrame frame = new JFrame();
...
...
String fileSuffix = null;
try
{
fileSuffix = PropertiesUtils.getInstance().
getEditorProperties().getSyntaxHighlightingDefault();
} catch ( Exception e1 )
{
e1.printStackTrace();
}
StringBuffer method = new StringBuffer();
method.append( "public boolean isValid( String param )\n" );
method.append( "{\n" );
method.append( "\tif ( \"TEST\".equals( param) \n" );
method.append( "\t\treturn true\n" );
method.append( "\treturn false\n" );
method.append( "}\n" );
final JIvaloEditorDialog dialog =
new JIvaloEditorDialog( frame, true, fileSuffix );
dialog.setText( method.toString() );
dialog.setSize(new Dimension(400, 200));
dialog.setLocationRelativeTo( frame );
dialog.setVisible( true );
System.out.println("Text: "+dialog.getText());
Download jivalo-editor-version.jar file and add it to classpath.
JPanel contentPane = new JPanel();
contentPane.setPreferredSize( new Dimension( 600, 400 ) );
contentPane.setMinimumSize( new Dimension( 340, 200 ) );
contentPane.setMaximumSize( new Dimension( 1024, 768 ) );
JIvaloEditor editor = new JIvaloEditor();
contentPane.add( editor );
...
editor.setText( "Test text", "java" );
...
String encodedEditedText = editor.getText();