Reputation: 33
I created text editor using JTextArea. But it doesn't work for sinhala font type.
t = new JTextArea();
t.setFont(new Font("kaputadotcom2004", Font.PLAIN, 12));
Upvotes: 0
Views: 72
Reputation: 768
Since kaputadotcom2004
isn´t a default font, you need to register your font to use it in your environment. You could do something like this (example taken from this answer):
try
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("A.ttf")));
}
catch (IOException|FontFormatException e)
{
//Handle exception
}
Upvotes: 3