0

I want to load up a window using the java swing, something like this

However I want to be able to use it for text input also not just to dump data into it..

any idea how to do it?

3 Answers 3

2

JTextAreas are editable by default, so input is trivial. Just put one into a test UI and see for yourself.

From a design perspective, using the same JTextArea for both input and output strikes me as unwise. The only example I can think of is a shell interface, and that imposes stronger limits on how input and output works than a JTextArea will provide out of the box.

Sign up to request clarification or add additional context in comments.

1 Comment

yep.. i want to use it as a shell interface
0

I'm not sure if I got the point of your question, but you can get the text the user has typed in using the getText() method:

JTextArea ta = new JTextArea(); String input = ta.getText();

Comments

0

Check out this Sun toturial:

http://java.sun.com/docs/books/tutorial/uiswing/components/textarea.html

In particular, scroll down to the "TextAreaDemo" example.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.