taoujouti / macwidgets

Automatically exported from code.google.com/p/macwidgets
0 stars 0 forks source link

NPE at HudComboBoxUI#updateDisplayedItem #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Hey Ken, I'm getting an NPE when trying to apply the HudComboBoxUI to a 
checkbox.  The weird 
thing is that I'm not getting it when running the example DHudControls.

Calling Code:
JComboBox sideCombo = new JComboBox();
sideCombo.setName("side_combo");
sideCombo.setUI(new HudComboBoxUI());
for(Side side: sides) {
    sideCombo.addItem(side.getName());
}

panel.add(sideCombo, "span 2");

Exception:
Exception in thread "main" java.lang.NullPointerException
    at 
com.explodingpixels.macwidgets.plaf.HudComboBoxUI.updateDisplayedItem(HudComboBo
xUI.ja
va:78)
    at 
com.explodingpixels.macwidgets.plaf.HudComboBoxUI.installComponents(HudComboBoxU
I.java
:70)
    at javax.swing.plaf.basic.BasicComboBoxUI.installUI(BasicComboBoxUI.java:235)
    at javax.swing.JComponent.setUI(JComponent.java:673)
    at javax.swing.JComboBox.setUI(JComboBox.java:238)
    at napplelabs.ct.ui.AddTrackHud.createPanel(AddTrackHud.java:86)
    at napplelabs.ct.ui.AddTrackHud.<init>(AddTrackHud.java:49)
    at napplelabs.ct.ui.AddTrackHud.main(AddTrackHud.java:113)

See patch for fix (simple null check in HudComboBoxUI#updateDisplayedItem)

Let me know if you need more info. -Zack

Original issue reported on code.google.com by zachary....@gmail.com on 16 Jan 2009 at 7:22

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks Zack...I've added the fix.

Original comment by kenneth....@gmail.com on 16 Jan 2009 at 11:58