changeset 12337:8044d252fa0b

8085895: The Textfield can't be shown after clicking "Show Textfield" button. Reviewed-by: serb, azvegint
author ssadetsky
date Tue, 30 Jun 2015 11:04:58 +0300
parents 2f3170c192c3
children e791dee767a6
files src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Tue Jun 30 10:45:32 2015 +0300
+++ b/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/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Tue Jun 30 10:45:32 2015 +0300
+++ b/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);
             }
         }