Results 1 to 3 of 3
  1. #1
    Doctor Cactus is offline Member
    Join Date
    Oct 2008
    Rep Power

    Default Syntax Colouring

    Hi, I am writing a Java application. I have Java code in a jtext area and I want to know is there a way to colour the syntax like in JCreator? If so, could someone explain how?
    Help is greatly appreciated.

  2. #2
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    First of all why would you want to code in a JTextArea? But anyway, to answer your question, you could, but you would need a JStyledPane or JTextPane to have multiple colours in one text box. I'm not sure how it would work, whether you would constantly be checking the entire string to find regular expressions which are java keywords, and then changing their colour when found, or maybe only do it when you click a button, or lose focus, or the typing pauses, etc.
    Hope this helps.
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Colombo, Sri Lanka
    Blog Entries
    Rep Power

Similar Threads

  1. simple loop syntax( ; ;), ( something : somthing)
    By xcallmejudasx in forum New To Java
    Replies: 4
    Last Post: 12-13-2008, 12:19 PM
  2. [SOLVED] Looking for web.xml syntax doc
    By Norm in forum Java Servlet
    Replies: 2
    Last Post: 08-21-2008, 07:59 PM
  3. Syntax for choice box(combo box)
    By NickkicN in forum New To Java
    Replies: 2
    Last Post: 08-14-2008, 10:26 PM
  4. Cannot get passed these syntax errors
    By MrKP in forum New To Java
    Replies: 1
    Last Post: 05-12-2008, 07:05 AM
  5. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts