8085895: The Textfield can't be shown after clicking "Show Textfield" button

Reviewed-by: serb, azvegint
This commit is contained in:
Semyon Sadetsky 2015-06-30 11:04:58 +03:00
parent e482146d84
commit 0ccb98b72a
2 changed files with 11 additions and 7 deletions

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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(); setScrollBarVisibility();
// After this line we should not change the component's text // After this line we should not change the component's text
firstChangeSkipped = true; firstChangeSkipped = true;
compAccessor.setPeer(textPane, this);
} }
@Override @Override
@ -146,7 +147,6 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
// visible caret has a timer thread which must be stopped // visible caret has a timer thread which must be stopped
jtext.getCaret().setVisible(false); jtext.getCaret().setVisible(false);
jtext.removeNotify(); jtext.removeNotify();
textPane.removeNotify();
super.dispose(); super.dispose();
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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 // After this line we should not change the component's text
firstChangeSkipped = true; firstChangeSkipped = true;
AWTAccessor.getComponentAccessor().setPeer(xtext, this);
} }
@Override @Override
@ -102,7 +103,6 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
XToolkit.specialPeerMap.remove(xtext); XToolkit.specialPeerMap.remove(xtext);
// visible caret has a timer thread which must be stopped // visible caret has a timer thread which must be stopped
xtext.getCaret().setVisible(false); xtext.getCaret().setVisible(false);
xtext.removeNotify();
super.dispose(); super.dispose();
} }
@ -259,7 +259,9 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
} }
background = c; background = c;
if (xtext != null) { if (xtext != null) {
xtext.setBackground(c); if (xtext.getBackground() != c) {
xtext.setBackground(c);
}
xtext.setSelectedTextColor(c); xtext.setSelectedTextColor(c);
} }
repaintText(); repaintText();
@ -269,7 +271,9 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
public void setForeground(Color c) { public void setForeground(Color c) {
foreground = c; foreground = c;
if (xtext != null) { if (xtext != null) {
xtext.setForeground(foreground); if (xtext.getForeground() != c) {
xtext.setForeground(foreground);
}
xtext.setSelectionColor(foreground); xtext.setSelectionColor(foreground);
xtext.setCaretColor(foreground); xtext.setCaretColor(foreground);
} }
@ -280,7 +284,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
public void setFont(Font f) { public void setFont(Font f) {
synchronized (getStateLock()) { synchronized (getStateLock()) {
font = f; font = f;
if (xtext != null) { if (xtext != null && xtext.getFont() != f) {
xtext.setFont(font); xtext.setFont(font);
} }
} }