java中通过什么函数去下拉列表框的value
3个回答
展开全部
如果是JComboBox,则用getSelectedItem方法。例如:你声明一个JComboBox 变量 comboBox则可以用“comboBox.getSelectedItem()”得到所取的值,是String类型的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个对象?
java.lang.Object
extended by java.awt.Component
extended by java.awt.Container
extended by javax.swing.JComponent
extended by javax.swing.JComboBox
Object getItemAt(int index)
Returns the list item at the specified index.
int getItemCount()
Returns the number of items in the list.
int getSelectedIndex()
Returns the first item in the list that matches the given item.
Object getSelectedItem()
Returns the current selected item.
Object[] getSelectedObjects()
Returns an array containing the selected item.
void setSelectedIndex(int anIndex)
Selects the item at index anIndex.
void setSelectedItem(Object anObject)
Sets the selected item in the combo box display area to the object in the argument.
java.lang.Object
extended by java.awt.Component
extended by java.awt.Container
extended by javax.swing.JComponent
extended by javax.swing.JComboBox
Object getItemAt(int index)
Returns the list item at the specified index.
int getItemCount()
Returns the number of items in the list.
int getSelectedIndex()
Returns the first item in the list that matches the given item.
Object getSelectedItem()
Returns the current selected item.
Object[] getSelectedObjects()
Returns an array containing the selected item.
void setSelectedIndex(int anIndex)
Selects the item at index anIndex.
void setSelectedItem(Object anObject)
Sets the selected item in the combo box display area to the object in the argument.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询