JComboBox containing Icon is too small on Mac?

Using CustomComboBoxDemo shown in How to Use Combo Boxes the custom renderer works as expected; but the UI delegate com.apple.laf. AquaComboBoxUI ignores a request such as this.

Using CustomComboBoxDemo shown in How to Use Combo Boxes, the custom renderer works as expected; but the UI delegate, com.apple.laf. AquaComboBoxUI, ignores a request such as this: petList. SetPreferredSize(new Dimension(200, 130)); As an alternative, javax.swing.plaf.metal.

MetalComboBoxUI produces the result shown below. Note that the arrow and scrollbar (not shown) remain unchanged. As an aside, the arrow may changed, as shown here.

Addendum: You can alter the UI defaults ad lib, as depicted below. //Create the combo box. JComboBox petList = new JComboBox(intArray); Color bg = (Color) UIManager.

Get("ComboBox. Background"); Color fg = (Color) UIManager. Get("ComboBox.

Foreground"); UIManager. Put("ComboBox. SelectionBackground", bg); UIManager.

Put("ComboBox. SelectionForeground", fg); petList. SetUI(new MetalComboBoxUI()); ComboBoxRenderer renderer = new ComboBoxRenderer(); ....

Ght tax for more that expensive platform +1 – mKorbel Jul 2 at 18:17 I think that will do the trick (have to wait until tomorrow to test it) but that means, my JComboBoxes won't look like usual MacOS-ComboBoxes any more - not quite what I wanted. Changing the arrow might help a bit, but the rounded border and blue "glowing" might be something not that easy to copy. So is there no alternative between "Looks like MacOS but is too small" and "Correct size but does not look like MacOS any more"?

– MikeG Jul 2 at 19:11 NB: The scroll bar and button remain Mac L&F. You can change the arrow, but it's not required. You can alter the metal default colors, as shown above.

The two delegates use the defaults differently, so you'll need to experiment. Also, condition this on the "os. Name" property.

– trashgod Jul 2 at 20:01 Have your tried SWT? – Lukas Knuth Jul 2 at 20:22 @Lukas Knuth: Yes, but the question specified Swing. – trashgod Jul 2 at 20:29.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions