0

I am designing a Swing Application to open a Java Program from .java file and save it to same.

My question is how will I display the Java program in JTextArea or any other editor with proper formatting, designing and Indentation.

Right now I use JTextArea & get something like this, which is not so soothing:

Right now I get something like this, which is not at so soothing

Any suggestion how I may make it look better?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Hilal Kaldane
  • 145
  • 1
  • 9
  • 1
    Please tell us more about "not so soothing". How is this display not working? Perhaps all you need/want to do is to change the JTextArea's Font, but it is difficult for any of us to say without more specific information as to exactly what your problem is. – Hovercraft Full Of Eels Jul 28 '18 at 14:07
  • 3
    If you mean to context color words for a Java source editor, that requires a styled document, where a `JTextArea` supports only plain text (one font, font size, style and color). For a styled document, use a `JTextPane` or `JEditorPane`. – Andrew Thompson Jul 28 '18 at 14:13
  • @HovercraftFullOfEels by "soothing" I mean proper handling of indentations. thats my only consideration. – Hilal Kaldane Jul 30 '18 at 11:22
  • 1
    @AndrewThompson thankyou very much. it was a great help – Hilal Kaldane Jul 30 '18 at 11:23

0 Answers0