A question about the Font in JTextPane
I added a JTextPane in a frame. When input letters in the text pane, the width of them is different. For example, a "H" is wider than "i". How can I make them have same width?
package test;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
publicclass TestFont{
/**
* @param args
*/
publicstaticvoid main(String[] args){
// TODO Auto-generated method stub
JFrame frame =new JFrame();
JTextPane textPane =new JTextPane();
AttributeSet as1 =new SimpleAttributeSet();
try{
textPane.getDocument().insertString(0,"abcabc",as1);
textPane.getDocument().insertString(textPane.getDocument().getLength(),"\nEEE", as1);
frame.add(textPane);
frame.setSize(100,100);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}catch(BadLocationException ex){
ex.printStackTrace();
}
}
}

