Can someone tell me the difference between JTextField and JTextArea, and if so how do i use the JTextArea | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone tell me the difference between JTextField and JTextArea, and if so how do i use the JTextArea

Java Graphical User Interface

28th Mar 2020, 2:04 PM
Ntsako Baloyi
Ntsako Baloyi - avatar
2 Answers
+ 2
A text field is just one line. For example name: [ ] password: [ ] [ ] would be a textfield. A textarea is for multiline text input. Something you would use in an text document or the area where we write our posts. Are you searching for tutorials about JTextField / JTextArea or do you have a project and don't know which one you should use?
28th Mar 2020, 2:21 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
JTextField and JTextArea are almost similar and the difference is explained by Denise Roßberg . Use it just like you use the JTextField. <JTextArea name>.getText(); and <JTextArea name>.setText();
28th Mar 2020, 2:29 PM
Avinesh
Avinesh - avatar