1) If I run it like (Code example in bottom) :
In other Windows Look and Feel ( not in a Metal) when i do lines multiply selecting, selected text color is very dark, but Selection background color is
very dark too. Will be nice if you will make white selected text color.
/**
* An example of how to use SDoc
*
* @author mohadib
*
*/
public class Example
{
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException e) { /* Do nothing */ } // look and feel
catch (InstantiationException e) { /* Do nothing */ }
catch (IllegalAccessException e) { /* Do nothing */ }
catch (UnsupportedLookAndFeelException e) { /* Do nothing */ }
Toolkit.getDefaultToolkit().setDynamicLayout(true);
//Configure the SyntaxDocumentFactory
SyntaxDocumentFactory fac = SyntaxDocumentFactory.getInstance();
//force Anti-Aliasing on - somewhat slow
fac.forceAA(SyntaxDocumentFactory.FORCE_AA_ALWAYS_ON);
//force Anti-Aliasing off - very fast - this is the default
fac.forceAA(SyntaxDocumentFactory.FORCE_AA_ALWAYS_OFF);
//not using aa is fast but makes italics look bad
//you can enable AA just for italics - this is the default
fac.forceAAItalics(SyntaxDocumentFactory.FORCE_AA_ALWAYS_ON);
//highlight the line where the cursor is - this is on by default
fac.highlightCurrent(true);
//show print margin -- this is default
fac.showPrintMargin(true);
//enable built in basic undo/redo support
//this is on by default
fac.setUseDefaultUndoManager(true);
//there are more config options check the javadoc
// for SyntaxDocumentFactory
//create a text component and add it to a scrollpane
final JEditorPane area = new JEditorPane();
JScrollPane sp = new JScrollPane(area);
//set the font before making the gutter/line number area
//highlighting needs a fixed width font
area.setFont(new Font("dialoginput" , Font.PLAIN , 12));
//if you want line numbering
sp.setRowHeaderView(new Gutter(area));
//Create a Document that will highlight Java
// this uses one of the built in lexers
Document doc = fac.getDefaultDocument(SyntaxDocumentFactory.JAVA_LEXER, area);
//set the document on the text area
area.setDocument(doc);
//area.setTabSize(2);
//show it and use it
JFrame frame = new JFrame("Highlight Test - Java Mode");
I try this -> http://downloads.sourceforge.net/sdoc/sdoc-0.4.0-beta-src.jar?use_mirror=kent version of sDoc.
1) If I run it like (Code example in bottom) :
In other Windows Look and Feel ( not in a Metal) when i do lines multiply selecting, selected text color is very dark, but Selection background color is
very dark too. Will be nice if you will make white selected text color.
package sdoc;
import java.awt.Color;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.text.Document;
import sdoc.lexers.SQLLexer;
/**
* An example of how to use SDoc
*
* @author mohadib
*
*/
public class Example
{
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException e) { /* Do nothing */ } // look and feel
catch (InstantiationException e) { /* Do nothing */ }
catch (IllegalAccessException e) { /* Do nothing */ }
catch (UnsupportedLookAndFeelException e) { /* Do nothing */ }
Toolkit.getDefaultToolkit().setDynamicLayout(true);
//Configure the SyntaxDocumentFactory
SyntaxDocumentFactory fac = SyntaxDocumentFactory.getInstance();
//force Anti-Aliasing on - somewhat slow
fac.forceAA(SyntaxDocumentFactory.FORCE_AA_ALWAYS_ON);
//force Anti-Aliasing off - very fast - this is the default
fac.forceAA(SyntaxDocumentFactory.FORCE_AA_ALWAYS_OFF);
//not using aa is fast but makes italics look bad
//you can enable AA just for italics - this is the default
fac.forceAAItalics(SyntaxDocumentFactory.FORCE_AA_ALWAYS_ON);
//highlight the line where the cursor is - this is on by default
fac.highlightCurrent(true);
//show print margin -- this is default
fac.showPrintMargin(true);
//enable built in basic undo/redo support
//this is on by default
fac.setUseDefaultUndoManager(true);
//there are more config options check the javadoc
// for SyntaxDocumentFactory
//create a text component and add it to a scrollpane
final JEditorPane area = new JEditorPane();
JScrollPane sp = new JScrollPane(area);
//set the font before making the gutter/line number area
//highlighting needs a fixed width font
area.setFont(new Font("dialoginput" , Font.PLAIN , 12));
//if you want line numbering
sp.setRowHeaderView(new Gutter(area));
//Create a Document that will highlight Java
// this uses one of the built in lexers
Document doc = fac.getDefaultDocument(SyntaxDocumentFactory.JAVA_LEXER, area);
//set the document on the text area
area.setDocument(doc);
//area.setTabSize(2);
//show it and use it
JFrame frame = new JFrame("Highlight Test - Java Mode");
frame.setContentPane(sp);
frame.pack();
frame.setSize(800,600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationByPlatform(true);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter()
{
public void windowOpened(WindowEvent e)
{
area.requestFocusInWindow();
}
});
}
}