NPE fix in mnemonics painting

(cherry picked from commit c7e3ebbc83a19a22a3039e17906aafd65ca6e573)
This commit is contained in:
Konstantin Bulenkov
2015-10-05 10:49:23 +01:00
parent 1dafb814ca
commit 89b353ca0e
@@ -458,13 +458,15 @@ public class DarculaLaf extends BasicLookAndFeel {
private static void repaintMnemonics(@NotNull Component focusOwner, boolean pressed) {
if (pressed != myAltPressed) return;
Window window = SwingUtilities.windowForComponent(focusOwner);
for (Component component : window.getComponents()) {
if (component instanceof JComponent) {
for (JComponent c : UIUtil.findComponentsOfType((JComponent)component, JComponent.class)) {
if ((c instanceof JLabel && ((JLabel)c).getDisplayedMnemonicIndex() != -1)
|| (c instanceof AbstractButton && ((AbstractButton)c).getDisplayedMnemonicIndex() != -1)
) {
c.repaint();
if (window != null) {
for (Component component : window.getComponents()) {
if (component instanceof JComponent) {
for (JComponent c : UIUtil.findComponentsOfType((JComponent)component, JComponent.class)) {
if ((c instanceof JLabel && ((JLabel)c).getDisplayedMnemonicIndex() != -1)
|| (c instanceof AbstractButton && ((AbstractButton)c).getDisplayedMnemonicIndex() != -1)
) {
c.repaint();
}
}
}
}