1 Reply Latest reply: Feb 20, 2009 4:17 PM by 843804 RSS

    NullPointerException in JFileChooser (?) when accessing system level icons

    843804
      Hi,

      I reference problem ID 4711700, though I do not have JFileChooser from Swing, but java.awt.FileDialog. (Please cross-post if necessary).

      I use Java V 1.6 Beta on Linux:

      leder@tokyo:~/workspace/GMR$ java -version
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b85)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b85, mixed mode, sharing)
      leder@tokyo:~/workspace/GMR$ uname -r
      2.6.8-3-k7

      Since I updated from Eclipse 3.1 to Eclipse 3.2 I have the following error:

      ----------------------------

      leder@tokyo:~/workspace/GMR$ java -jar gmr-1.5.7.jar
      --------- NICHT ABGEFANGENE AUSNAHMEBEDINGUNG ---------
      java.lang.NullPointerException
      at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
      at Projekt.Wstart.getAusschneidenButton(Wstart.java:432)
      at Projekt.Wstart.getToolBarPane(Wstart.java:1232)
      at Projekt.Wstart.getJFrameContentPane(Wstart.java:756)
      at Projekt.Wstart.initialize(Wstart.java:1432)
      at Projekt.Wstart.<init>(Wstart.java:136)
      at Projekt.Wstart.main(Wstart.java:1449)
      --------- NICHT ABGEFANGENE AUSNAHMEBEDINGUNG ---------
      java.lang.NullPointerException
      at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
      at Projekt.Wstart.getKopierenButton(Wstart.java:905)
      at Projekt.Wstart.getToolBarPane(Wstart.java:1233)
      at Projekt.Wstart.getJFrameContentPane(Wstart.java:756)
      at Projekt.Wstart.initialize(Wstart.java:1432)
      at Projekt.Wstart.<init>(Wstart.java:136)
      at Projekt.Wstart.main(Wstart.java:1449)
      --------- NICHT ABGEFANGENE AUSNAHMEBEDINGUNG ---------
      java.lang.NullPointerException
      at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
      at Projekt.Wstart.getEinf_genButton(Wstart.java:601)
      at Projekt.Wstart.getToolBarPane(Wstart.java:1234)
      at Projekt.Wstart.getJFrameContentPane(Wstart.java:756)
      at Projekt.Wstart.initialize(Wstart.java:1432)
      at Projekt.Wstart.<init>(Wstart.java:136)
      at Projekt.Wstart.main(Wstart.java:1449)
      leder@tokyo:~/workspace/GMR$

      ----------------------------
        • 1. Re: NullPointerException in JFileChooser (?) when accessing system level icons
          843804
          I too have this problem:
          Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
               at javax.swing.plaf.metal.MetalFileChooserUI$IndentIcon.getIconWidth(MetalFileChooserUI.java:878)
               at javax.swing.SwingUtilities.layoutCompoundLabelImpl(SwingUtilities.java:946)
               at javax.swing.SwingUtilities.layoutCompoundLabel(SwingUtilities.java:873)
               at javax.swing.plaf.basic.BasicLabelUI.layoutCL(BasicLabelUI.java:72)
               at javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(BasicLabelUI.java:235)
               at javax.swing.JComponent.getPreferredSize(JComponent.java:1632)
               at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1351)
               at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1299)
               at javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(BasicListUI.java:2615)
               at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
               at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:147)
               at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:194)
               at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:388)
               at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:398)
               at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:442)
               at javax.swing.JList.setSelectedIndex(JList.java:2179)
               at javax.swing.plaf.basic.BasicComboPopup.setListSelection(BasicComboPopup.java:1125)
               at javax.swing.plaf.basic.BasicComboPopup.access$300(BasicComboPopup.java:46)
               at javax.swing.plaf.basic.BasicComboPopup$Handler.itemStateChanged(BasicComboPopup.java:963)
               at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1205)
               at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1262)
               at javax.swing.JComboBox.contentsChanged(JComboBox.java:1309)
               at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
               at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.setSelectedItem(MetalFileChooserUI.java:1001)
               at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(MetalFileChooserUI.java:972)
               at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.access$900(MetalFileChooserUI.java:897)
               at javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(MetalFileChooserUI.java:648)
               at javax.swing.plaf.metal.MetalFileChooserUI.access$1200(MetalFileChooserUI.java:38)
               at javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(MetalFileChooserUI.java:734)
               at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
               at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
               at java.awt.Component.firePropertyChange(Component.java:8083)
               at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:568)
               at javax.swing.JFileChooser.<init>(JFileChooser.java:334)
               at javax.swing.JFileChooser.<init>(JFileChooser.java:286)

          Only with Metal on Win XP SP3 when running inside Eclipse (any version)
          java version "1.6.0_12"
          Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
          Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)