Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to add user input in a panel??

 
Luong Vuong
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have created a panel:



Is there anyway of using the panel to accept user input, in this case the number of triangles.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, of course! You can accept input in a TextField.

Moving to Swing/AWT/JFace/SWT.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(looks like you may be using awt only).

a TextField is the normal way to handle user input, but you need to include
a fair amount of error handling. If the range of 'number of triangles' is limited,
it might be easier for you to use a java.awt.Choice, where the user can select
the number from a range you have set.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic