JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.42k stars 272 forks source link

FontDesignMetrics NullPointerException #439

Closed tferr closed 2 years ago

tferr commented 2 years ago

Just noticed this exception on MacOS 10.15.7, AdoptOpenJdk

java.lang.NullPointerException
    at sun.font.FontDesignMetrics$MetricsKey.init(FontDesignMetrics.java:217)
    at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:286)
    at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113)
    at javax.swing.JComponent.getFontMetrics(JComponent.java:1626)
    at com.formdev.flatlaf.ui.FlatComboBoxUI$2.layoutContainer(FlatComboBoxUI.java:265)
    at java.awt.Container.layout(Container.java:1513)
    at java.awt.Container.doLayout(Container.java:1502)
    at java.awt.Container.validateTree(Container.java:1698)
    at java.awt.Container.validate(Container.java:1633)
    at javax.swing.plaf.basic.BasicComboBoxUI$Handler.propertyChange(BasicComboBoxUI.java:1753)
    at com.formdev.flatlaf.ui.FlatComboBoxUI.lambda$createPropertyChangeListener$0(FlatComboBoxUI.java:311)
    at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
    at java.awt.Component.firePropertyChange(Component.java:8434)
    at java.awt.Component.setFont(Component.java:1907)
    at java.awt.Container.setFont(Container.java:1753)
    at javax.swing.JComponent.setFont(JComponent.java:2754)
    at sun.lwawt.LWComponentPeer.resetColorsAndFont(LWComponentPeer.java:334)
    at sun.lwawt.LWComponentPeer.<init>(LWComponentPeer.java:229)
    at sun.lwawt.LWChoicePeer.<init>(LWChoicePeer.java:53)
    at sun.lwawt.LWToolkit.createChoice(LWToolkit.java:279)
    at java.awt.Choice.addNotify(Choice.java:152)
    at java.awt.Container.addNotify(Container.java:2776)
    at java.awt.Window.addNotify(Window.java:770)
DevCharly commented 2 years ago

What a surprise: AWT components use Swing components internally on macOS. Didn't know this 😮

The exception is fixed in latest 1.6.5-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots