1
A
回答
2
那麼你得到"Microsoft"
(井Object
顯示微軟至少)從節目調用的返回值,是足夠好了嗎?
如果您需要索引,只需在您提供給對話框的輸入數組中找到該返回值的索引即可。
請參閱Java教程的輸入部分: http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html#input
假設你正在使用showInputDialog(..):
Object[] possibilities = {"Broadcom...", "Microsoft"};
Object result = JOptionPane.showInputDialog(frame, "Capture Interfaces", "Input", JOptionPane.PLAIN_MESSAGE, icon, possibilities, possibilities[0]);
if (result != null) {
//result is the choosen object, if you need the index even so:
int index = 0;
for (Object o : possibilities) {
if (result == o)
break;
index++
}
//index is now the index...
}
相關問題
- 1. 獲取的JOptionPane
- 2. ArrayList,獲取值,從索引()到索引()
- 3. 從索引獲取價值與索引
- 4. 從IndexColorModel獲取索引?
- 5. 從對象獲取索引
- 6. JOptionPane和從輸入中獲取文本
- 7. JOptionPane從showOptionDialog獲取一個字符串
- 8. Java Swing:從JOptionPane獲取文本值
- 9. 陣列從索引獲取PFFile時從索引
- 10. 的JOptionPane獲取口令
- 11. Linq獲取索引
- 12. 獲取行索引
- 13. TPageControl獲取索引
- 14. 從列表列表中獲取索引
- 15. 從tr1獲取匹配的索引:: regex_search
- 16. 從搜索引擎獲取結果
- 17. 只從索引頁面獲取Jquery .animate
- 18. 如何從表中獲取索引值?
- 19. 從排序的DataView獲取索引
- 20. 從JavaScript中獲取索引值
- 21. 從1D獲取二維數組索引
- 22. Javascript:從數組獲取索引值
- 23. 從MapItemView獲取模型索引
- 24. 從某個UISegmentedControl索引獲取幀?
- 25. 從字典數組ArrayList獲取索引
- 26. 如何從多索引中獲取值
- 27. 獲取從表索引(TR沒有ID)
- 28. 從Mat OpenCV獲取非零索引
- 29. 在Silverlight DataGrid中從索引獲取行
- 30. 從系列中獲取索引和值
類似的問題似乎在這裏已經回答: HTTP://計算器的.com /問題/ 3074478 /如何對選擇 - 一個指數值從 - 一個串陣-IN-A-的JOptionPane – bschandramohan