简体   繁体   English

JTextField和JTextArea

[英]JTextField and JTextArea

What is the different between JTextField and JTextArea? JTextField和JTextArea有什么不同? Is this possible to work with this two classes in a one class? 这可以在一个类中使用这两个类吗?

In summary, a JTextField is a one-line text field, whereas a JTextArea can span over multiple lines. 总之,JTextField是一行文本字段,而JTextArea可以跨越多行。

The differences are clearly explained in the documentation: JTextArea and JTextField 文档中清楚地解释了这些差异: JTextArea JTextField

Of course, you can use them in the same class. 当然,您可以在同一个类中使用它们。 There would be zero conflicts between them. 他们之间不会有任何冲突。

You can always refer to the javadocs for such kind of question. 你总是可以参考javadocs来解决这类问题。

You can work with both classes in one class. 您可以在一个类中使用这两个类。 The main difference is the size, since JTextField are one line and JTextArea have columns and rows. 主要区别在于大小,因为JTextField是一行而JTextArea有列和行。 (Which makes suitable for lots of information) (这适合大量信息)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM