I am making a simple chat application and I am trying to find out which text component is more appropriate to use.The component will need to support coloured text , provide line wrap and support scroll pane. Also it must allow the user to choose the font thats going to be used ( size , style etc ).
Which is the best option for this ? Thanks .
The JTextArea can do all those things and you might look into the Document interface since this is a chat app. The Document will give you the ability to sync two components like JTextField and JTextArea. Document is not a text field of any kind, but is to be used with one. JTextField has a constructor method for Document “JTextField(Document doc)”. To set the color of you text just call the setForeground(Color) method of JTextArea, also this method is inherited from its parent component JComponent.