jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes How to add user input in a panel?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to add user input in a panel??" Watch "How to add user input in a panel??" New topic

How to add user input in a panel??

Luong Vuong

Joined: Jan 20, 2007
Posts: 8
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

Joined: Jul 08, 2003
Posts: 24193

Sure, of course! You can accept input in a TextField.

Moving to Swing/AWT/JFace/SWT.

[Jess in Action][AskingGoodQuestions]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
(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.
I agree. Here's the link: http://aspose.com/file-tools
subject: How to add user input in a panel??
It's not a secret anymore!