Hi guys,
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?
Hi guys,
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?
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.
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();
Check out this Sun toturial:
http://java.sun.com/docs/books/tutorial/uiswing/components/textarea.html
In particular, scroll down to the "TextAreaDemo" example.