JTextArea txt = new JTextArea();
StringBuffer sb = new StringBuffer();
sb.append("Employee Information");
sb.append("\n");
sb.append("Name:");
txt.setText(sb.toString());
Here I need to set “Employee Information” to BOLD format..How to do that..
I tried like this
sb.append("<html><b>Employee Information</b></html>");
But its printing the text normally… how to make bold?
The JText Area is a plain text area, for styled text areas you need something like JEditorPane or JTextPane, take a look at the Documentation