如何在J2ME中创建ComboBox?
我想创建一个带有两个参数的函数
- 一个字符串值(名称)
- 一个字符串对象数组
该函数使用这两个参数创建 LWUIT Combobox 并返回一个 ComboBox 变量...
我编写了以下代码...
public void createComboxBox(String recStoreName,String [] values){
comboBox = new ComboBox(recStoreName, values);
surveyForm.addComponent(comboBox);
}
I want to create a function which takes two arguments
- A String value (name)
- An array of String objects
The function creates LWUIT Combobox with these two parameters and returns a ComboBox varialble...
I have written following code ...
public void createComboxBox(String recStoreName,String [] values){
comboBox = new ComboBox(recStoreName, values);
surveyForm.addComponent(comboBox);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
前两行代码非常不言自明,AWT/Swing 开发人员应该熟悉。第三行设置表单的背景颜色属性。
组合框也以类似的方式实例化:
资源
另请参阅
The first two lines of code are quite self-explanatory and should be familiar to AWT/Swing developers. The third line sets the background color attribute for the form.
The combo box is also instantiated in a similar manner:
Resource
Also See
只需创建 bean 类,就像设置键和值一样。
例如,
然后在您的类上创建
beanClass
数组并传递键和值。然后将beanClass
数组传递给ComboBox
。comboBox.getSelectedItem()
返回 beanClass。这样你就可以从选定的beanClass
中获取键和值。Just create the bean class like set the key and value.
For example,
then create the
beanClass
array on your class and pass the Key's and Value's. then pass thebeanClass
array toComboBox
.comboBox.getSelectedItem()
returns the beanClass. So you can get the key and value from selectedbeanClass
.