提交 0b9a6517 编写于 作者: S serb

7184945: [macosx] NPE in AquaComboBoxUI since jdk7u6b17, jdk8b47

Reviewed-by: malenkov, alexsch
上级 e9761aad
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -34,7 +34,6 @@ import javax.swing.border.Border;
import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import com.apple.laf.ClientPropertyApplicator;
import com.apple.laf.ClientPropertyApplicator.Property;
import apple.laf.JRSUIConstants.Size;
......@@ -142,35 +141,46 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
return new AquaComboBoxEditor();
}
class AquaComboBoxEditor extends BasicComboBoxEditor implements UIResource, DocumentListener {
protected AquaComboBoxEditor() {
final class AquaComboBoxEditor extends BasicComboBoxEditor
implements UIResource, DocumentListener {
AquaComboBoxEditor() {
super();
editor = new AquaCustomComboTextField();
editor.addFocusListener(this);
editor.getDocument().addDocumentListener(this);
}
@Override
public void focusGained(final FocusEvent e) {
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void focusLost(final FocusEvent e) {
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void changedUpdate(final DocumentEvent e) {
editorTextChanged();
}
@Override
public void insertUpdate(final DocumentEvent e) {
editorTextChanged();
}
@Override
public void removeUpdate(final DocumentEvent e) {
editorTextChanged();
}
protected void editorTextChanged() {
private void editorTextChanged() {
if (!popup.isVisible()) return;
final Object text = editor.getText();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册