In the code below, the glass pane is a JPanel which everybody knows is a Swing lightweight component. Then why JComboBox requires setLightWeightPopupEnabled(false) for its proper functioning? What on earth does the method, in the first place? Why glass pane? What oddity in the hell does the glass pane have that other Swing component doesn't, never?
import javax.swing.*;
import java.awt.*;
public class GlassPaneOddity{
public static void main(String[] args){
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel gp = new JPanel(new BorderLayout());
frame.setGlassPane(gp);
JComboBox cb
= new JComboBox(new String[]{"alpha", "beta", "gamma", "delta"});
cb.setLightWeightPopupEnabled(false); // why this line is so critical?
gp.add(cb, BorderLayout.NORTH);
frame.setSize(300, 300);
frame.setVisible(true);
gp.setVisible(true);
}
}