aspose file tools
The moose likes Swing / AWT / SWT and the fly likes JTextArea question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "JTextArea question " Watch "JTextArea question " New topic
Author

JTextArea question

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi guys,

I wonder if there's anyway to (1) press a button (say ctrl-t) and the JtextArea will write a the NAME of the user (NAME=some string prepared in advance).

Currently I have it with a jbutton - but when the user press this button, the NAME is *append* to the jtextArea and not (2) getting in the right place (where the cursor is located).

any idea?

Thanks
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You can bind these keys and the corresponding Action to the JTextArea or one of its parent JComponents. The How to Use Key Bindings page in the tutorial shows how to do this.

JTextArea has an insert method that may be useful for adding the name. Also, its superclass JTextComponent has handy methods for moving around in a JTextArea. You can find the JTextComponent methods that apply to JTextArea in the Methods inherited from class javax.swing.text.JTextComponent section of the JTextArea api.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JTextArea question
 
Similar Threads
Urgent: Submitting a form in a page and using it's values in an already open page
JButtons
JSP throwing null pointer exception the first time I run it
JRadioButtons in applet
Back end validation problem .