如何更改基本 ComboBox UI 的配色方案?我尝试过的是:setForeGround、setBackground、setOpaque(true)、setOpaque(false) setBorder。但这些都不起作用。
我现在的代码是:
weaponCB.setBounds(27,250,150,30);
weaponCB.setUI(new BasicComboBoxUI());
weaponCB.setForeground(Color.white);
weaponCB.setBackground(Color.black);
weaponCB.setBorder(whiteBorder);
weaponCB.setFont(new Font("Trajan Pro", Font.BOLD, 15));
lP.add(weaponCB, new Integer(2));
这是出现的:
但我真正想要的是下拉部分(白色区域)看起来像显示器,(黑色区域带有白色的“LANCE”)即背景为黑色,边框为白色,文字为白色。如果这是可能的,你告诉我怎么做,这对我会有很大的帮助。谢谢。