GUI components creation idioms

King Lung Chiu <[email protected]>
Newsgroups gmane.comp.java.netbeans.user-interface
Message-ID <[email protected]>
Hi again,

Usually when I create a form, there are multiple components of the same
type, eg. 5 combo boxes, or 5 text fields, and Netbeans creates a new
variable for each of those components.

I'd like to have them created as items in a data structure (eg. an array or
ArrayList or HashMap of combo boxes),to make it easier to reference them
later. Is there an automatic way to do that?

My current workaround is to create the data structure myself (eg.
EnumMap<FieldAttribute, JTextField>), and manually add the components to
that data structure in each comopnent's post-creation code (in this case,
maping each component to its corresponding enum value). However, this method
doesn't scale when I have a large number of components to add. (lots of code
copy + paste + small-edit).

Any comments welcome, thanks

King
-- 
View this message in context: http://www.nabble.com/GUI-components-creation-idioms-tf2367563.html#a6595539
Sent from the Netbeans - UI mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.