• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java swing class for user input  RSS feed

 
Greenhorn
Posts: 8
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

what is the class of the SWING library that we mainly use to enter information entered by a user?

I was thinking maybe JTextField or JOptionPane.

Could you guys correct me and explain why the other wouldn't be it.

Thank you
 
Saloon Keeper
Posts: 3330
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are both used for user input. A JTextField has to be placed in a container (e.g. JPanel) and a container can have multiple JTextField's. JOptionPane pops up a small window where the user can enter their input. JOptionPane only has one input per popup (assuming you haven't created a custom version).

Also, JOptionPane has to popup for every entry an some button has to be clicked to accept an entry. This can get very annoying if you have multiple inputs to enter.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!