Java: prevent NPE in MetalFileChooserUI $ IndentIcon.getIconWidth?

on Windows systems. I get the next NPE with FileChooser. This is a known mistake that has not yet been fixed by the sun. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342301

Does anyone know a workaround to prevent this exception?

Thank. Andre

An exception in the thread "AWT-EventQueue-2" java.lang.NullPointerException in javax.swing.plaf.metal.MetalFileChooserUI $ IndentIcon.getIconWidth (Unknown Source) in javax.swing.SwingUtilities.layoutCompoundLabelImsw (Not known). SwingUtilities.layoutCompoundLabel (Unknown Source) in the javax.swing.plaf.basic.BasicLabelUI.layoutCL (Unknown Source) file in javax.swing.plaf.basic.BasicLabelUI.getPreferredSize (Unknown source) in JPrefer.ing.Compent.Singfer.swaf.swaf.swf.swing.preferred.ize source) in javax.swing.plaf.basic.BasicListUI.updateLayoutState (Unknown source) in javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState (Unknown Source) in javax.swing.plaf.basic.BasListlerChasListval Source) in javax.swing.DefaultListSelectionModel.fireValueChanged (Unknown source) in javax.swing.DefaultListSelectionModel.fireValueChanged (Unknown Source) in javax.swing.DefaultListSelectionModel.fireValueChanged (Unknown source) Javax.swing.DefaultListSelectionLesellection.selectionMeLesellection.selectionMelex.Lesellection.selectionMeLode.Level.SelectionMeasure.l Unknown source) in javax.swing.DefaultListSelectionModel.setSelectionInterval (Unknown Source) in javax.swing.JList.setSelectedIndex (Unknown source) in javax.swing.plaf.basic.BasicComboPopup.setListaxfspling (Unknown). basic.BasicComboPopup.access $ 300 (Unknown Source) in javax.swing.plaf.basic.BasicComboPopup $ Handler.itemStateChanged (Unknown Source) in javax.swing.JComboBox.fireItemStateChanged (Unknown Source) in javax.swing.JComboBox.selectedItemChanged (Unknown source) in javax.swing.JComboBox.contentsChanged (Unknown source)

+3
3

, , . , . ?

A : -, , . ui, , ui , . , ?

: : . setUI : .

+1

, :)

, . , , .

: Missunderstood . , . .

+1

, , , . ?

If this does not work, is it possible to instantiate your managed FileFilters at the same point where you are setting up your interface?

0
source

Source: https://habr.com/ru/post/1697193/


All Articles