*
The moose likes Swing / AWT / SWT and the fly likes Tabbing JTextArea Code Editor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Tabbing JTextArea Code Editor" Watch "Tabbing JTextArea Code Editor" New topic
Author

Tabbing JTextArea Code Editor

Isaac Skelton
Greenhorn

Joined: Sep 06, 2012
Posts: 5

I have always wanted to create a simple code editor; nothing fancy, all I want is a TextArea that once the user pushes tab it stays in tab. For example, notepad++ allows the user to tidy his/her script up while notepad (MS) dosn't allow a easy method to do this. I have been researching for a while now and all I could find that was might help me was "setTabSize"

For example,


I hope you understand what im asking for, if not please ask and ill try explain more
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

You should change the key binding (look it up) for Enter to a) get the whitespace the current line starts with, then perform the default behaviour (add an Enter), then add the whitespace you just got. I'm sure you can solve each of these sub tasks separately; combining them will be easy as well.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tabbing JTextArea Code Editor
 
Similar Threads
Writing data into file from a String variable
not getting howdy and folks in the new line, string related from scjp6.0 book
If/Else/Switch Statements
Does everybody seriously follow the Style Guide?
I cant seem to fix this compile error !! please help me