1
A
回答
2
JComboBox是複合JComponent幷包含JButton與Icon,您可以通過的setIcon(空)刪除或另一個圖標
例如(如何使用簡單的步驟去做,注意有效期只是Metal Look and Feel
)
JComboBox coloredArrowsCombo = myComboBox;
BufferedImage coloredArrowsImage = null;
try {
coloredArrowsImage = ImageIO.read(AppVariables.class.getResource("resources/passed.png"));
} catch (IOException ex) {
Logger.getLogger(someClessName.class.getName()).log(Level.SEVERE, null, ex);
}
if (!(coloredArrowsImage == null)) {
Icon coloredArrowsIcon = new ImageIcon(coloredArrowsImage);
Component[] comp = coloredArrowsCombo.getComponents();
for (int i = 0; i < comp.length; i++) {
if (comp[i] instanceof MetalComboBoxButton) {
MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i];
coloredArrowsButton.setComboIcon(coloredArrowsIcon);
break;
}
}
}
編輯:爲更好的輸出,你可以把這裏coloredArrowsButton.setRolloverIcon(someIcon);
相關問題
- 1. 刪除ASP.NET MVC3中的dropdownlist向下箭頭符號
- 2. 如何刪除dijit.form.dropDownButton中的向下箭頭圖標?
- 3. html向上向下箭頭
- 4. 向下箭頭的HTML
- 5. Chart.js - 刪除滾動箭頭
- 6. Eclipse刪除箭頭圖標
- 7. 刪除排序箭頭
- 8. 硒IDE向下箭頭鍵
- 9. 如何刪除UITableView中的箭頭
- 10. 向下箭頭列表中的列表
- 11. 向上和向下箭頭的JavaScript
- 12. 在jquery中切換右箭頭向下箭頭[accordion-like]
- 13. 防止向下箭頭或向上箭頭更新MS Access中的組合框
- 14. JComboBox setBackground()不改變箭頭的顏色
- 15. 如何刪除引導程序4中的下拉箭頭?
- 16. 禁用向上和向下箭頭
- 17. 如何從組合框中刪除下拉箭頭?
- 18. 刪除箭頭,使行hearver的igraph
- 19. Python中的向上箭頭?
- 20. 向下箭頭按鈕的HTML頁面
- 21. (向下)帶CSS的箭頭框
- 22. jquery sticked向上和向下箭頭向上和向下
- 23. 如何在jQuery或Javascript中將箭頭綁定到「向上滾動」和向下箭頭以「向下滾動」?
- 24. Bootstrap:刪除下拉字段的邊框和箭頭
- 25. CSS盒除箭頭外有箭頭
- 26. 刪除IE10選擇元素箭頭
- 27. Flex AdvancedDataGrid - 刪除排序箭頭
- 28. 引導酥料餅 - 刪除箭頭
- 29. 圖表控件刪除標籤箭頭
- 30. 彩盒刪除幀箭頭導航
爲什麼呢?不發明ui小部件,用戶會感到困惑! – kleopatra
,因爲我想要在Google中搜索時看起來就像在那裏看到任何箭頭,這正是我想要出現在我的JComboBox中。關於這件事的任何想法? – sack