-
Using Java Vectors?
I am used to VB's dynamic data statements with the Redim abilities and was wondering if Java's Vectors would provide the similiar options. Also, had a vector/variable question.
I am writting a program which accepts input from 5 JComboboxs and 5 Jtextfields. There can be several (exact number unknown) imputs per user. That is I have one user with several accounts (Records) per input.
I want to use arrays but, think Java's vector would be more appropreate.
1) Am I correct?
2) Does each JCombobox and JTextfield need its own Vector object?
That is:
Vector vecJCombobox1 = new Vector();
.
.
Vector vecJCombobox5 = new Vector();
Vector vecJTextfield1 = new Vector();
.
.
Vector vecJTextField5 = new Vector();
Thanks for your help...Ronnie
-
Vectors are thread-safe so they're a bit heavyweight. You can just use an ArrayList:
http://java.sun.com/j2se/1.3/docs/ap...ArrayList.html
You will see from JComboBox's API:
http://java.sun.com/j2se/1.3/docs/ap...JComboBox.html
...that you can pass in a Vector into the constructor which will be used as the data source for the Vector. However, you can just use the default constructor and then repeatedly called addItem method:
http://java.sun.com/j2se/1.3/docs/ap...x.html#addItem(java.lang.Object)
ArchAngel.
O:-)
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks