8085895: The Textfield can't be shown after clicking "Show Textfield" button.
authorssadetsky
Tue, 30 Jun 2015 11:04:58 +0300
changeset 31656 786638581dba
parent 31655 6bc54745fef4
child 31657 6b5f36a9a3c0
8085895: The Textfield can't be shown after clicking "Show Textfield" button. Reviewed-by: serb, azvegint
jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java
jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Tue Jun 30 10:45:32 2015 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Tue Jun 30 11:04:58 2015 +0300
@@ -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 @@
         setScrollBarVisibility();
         // After this line we should not change the component's text
         firstChangeSkipped = true;
+        compAccessor.setPeer(textPane, this);
     }
 
     @Override
@@ -146,7 +147,6 @@
         // visible caret has a timer thread which must be stopped
         jtext.getCaret().setVisible(false);
         jtext.removeNotify();
-        textPane.removeNotify();
         super.dispose();
     }
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Tue Jun 30 10:45:32 2015 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Tue Jun 30 11:04:58 2015 +0300
@@ -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 @@
 
         // After this line we should not change the component's text
         firstChangeSkipped = true;
+        AWTAccessor.getComponentAccessor().setPeer(xtext, this);
     }
 
     @Override
@@ -102,7 +103,6 @@
         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 @@
         }
         background = c;
         if (xtext != null) {
-            xtext.setBackground(c);
+            if (xtext.getBackground() != c) {
+                xtext.setBackground(c);
+            }
             xtext.setSelectedTextColor(c);
         }
         repaintText();
@@ -269,7 +271,9 @@
     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 @@
     public void setFont(Font f) {
         synchronized (getStateLock()) {
             font = f;
-            if (xtext != null) {
+            if (xtext != null && xtext.getFont() != f) {
                 xtext.setFont(font);
             }
         }