styled JTextPane
Michael Hall
mik3hall at gmail.com
Thu Apr 19 18:45:30 PDT 2012
As I indicated earlier this does appear to be a separate issue.
I'm not 100% sure again though that it is a bug. It is different from 1.6.
Test case....
import javax.swing.*;
import javax.swing.text.*;
public class StyledTest extends JTextPane {
private static final StyleContext sc = new StyleContext();
private static final DefaultStyledDocument doc = new DefaultStyledDocument(sc);
static final Style mono = sc.addStyle("mono",null);
public static void main(String[] args) {
JFrame f = new JFrame("StyledTest");
f.setMinimumSize(new java.awt.Dimension(100,100));
StyledTest st = new StyledTest();
f.add(st);
f.pack();
f.setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
doc.insertString(0,"AaBbCcDd\nEeFfGgHh",mono);
}
catch (BadLocationException blex) {
blex.printStackTrace();
}
}});
}
public StyledTest() {
setStyledDocument(doc);
StyleConstants.setFontFamily(mono,"monospaced");
}
}
Run on 1.6 you get a smaller serifed font that could be monospaced.
Run on 1.7 you get a larger non-serified font that, well, still just might be monospaced.
Bug or incidental change?
Strictly as opinion probably biased to what I'm used to, assuming both are correctly monospaced output, I like the smaller serifed better, it tends to stand out as different a little better in my application.
Not a voting situation?
More information about the macosx-port-dev
mailing list