diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java index 575d7c02387..428d1d27d55 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -138,6 +138,7 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; + compAccessor.setPeer(textPane, this); } @Override @@ -146,7 +147,6 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { // visible caret has a timer thread which must be stopped jtext.getCaret().setVisible(false); jtext.removeNotify(); - textPane.removeNotify(); super.dispose(); } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java index 6841d1546a1..b936b6bb26a 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -95,6 +95,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { // After this line we should not change the component's text firstChangeSkipped = true; + AWTAccessor.getComponentAccessor().setPeer(xtext, this); } @Override @@ -102,7 +103,6 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { XToolkit.specialPeerMap.remove(xtext); // visible caret has a timer thread which must be stopped xtext.getCaret().setVisible(false); - xtext.removeNotify(); super.dispose(); } @@ -259,7 +259,9 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { } background = c; if (xtext != null) { - xtext.setBackground(c); + if (xtext.getBackground() != c) { + xtext.setBackground(c); + } xtext.setSelectedTextColor(c); } repaintText(); @@ -269,7 +271,9 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { public void setForeground(Color c) { foreground = c; if (xtext != null) { - xtext.setForeground(foreground); + if (xtext.getForeground() != c) { + xtext.setForeground(foreground); + } xtext.setSelectionColor(foreground); xtext.setCaretColor(foreground); } @@ -280,7 +284,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { public void setFont(Font f) { synchronized (getStateLock()) { font = f; - if (xtext != null) { + if (xtext != null && xtext.getFont() != f) { xtext.setFont(font); } }