??JComboBox实现类似于HTML的select一般是怎么做的,就是有一个显示值有一个实际值 JComboBox实现类似于HTML的select一般是怎么做的,就是有一个显示值有一个实际值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是类似于<select><option value='test'>测试</option><select>option 不是有一个value么 fontComBox.addItem("A");fontComBox.addItem("B");fontComBox.addItem("C");fontComBox.addItem("D");if(fontComBox.getSelectedItem()=="B") System.out.println("B"); public class ComboBoxItem { private Object value = null; private String text = null; public ComboBoxItem(Object value, String text) { this.value = value; this.text = text; } public Object getValue() { return value; } public String toString() { return text == null ? "" : text; }}...combobox.add(new ComboBoxItem("test", "测试"));...ComboBoxItem item = (ComboBoxItem))combobox.getSelectedItem();String value = (String)item.getValue(); List和数组的问题 这程序怎么Run 怎样实现记事本程序里面的查询功能呢?急~~~~ 处理5W~50W的数据方法 线程 在线等 没分了,希望好心帮助下 如何这样付值? 请问在JAVA打印程序设计中应该怎样设置页边距呢? 初学Java,写了个小applet不知哪错了,帮忙改一下!!! 在用内隐类来实现某个监听器时,是否有必要把内隐类声明为private 关于jcreate的javadoc配置 要CS1.5过任何平台的作弊器的朋友请加我MSN JTable如何使用?有没有最简单的例子。
option 不是有一个value么
fontComBox.addItem("B");
fontComBox.addItem("C");
fontComBox.addItem("D");if(fontComBox.getSelectedItem()=="B")
System.out.println("B");
private Object value = null;
private String text = null;
public ComboBoxItem(Object value, String text)
{
this.value = value;
this.text = text;
} public Object getValue()
{
return value;
} public String toString()
{
return text == null ? "" : text;
}
}...
combobox.add(new ComboBoxItem("test", "测试"));
...
ComboBoxItem item = (ComboBoxItem))combobox.getSelectedItem();
String value = (String)item.getValue();