Search code examples
javaswingjcomboboxmiglayoutz-order

JCombobox dropdown visibility issue?


I have a root panel (2 rows, 1 column) which has panel P and a label L in it. P has a JComboBox B in it. Whenever I click on B, the resulting dropdown shows-up behind L. How do I fix this? I played around with all sorts of setComponentZOrder() but I could not fix this. What should I do?


Solution

  • Don't mix heavyweight components (e.g. Label) with lightweight components (e.g. JLabel).

    If you use Swing always use lightweight components starting with a J.