Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3cb008ff
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3cb008ff
编写于
10月 01, 2013
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7150100: [macosx] "0123456789" is selected in the TextField
Reviewed-by: anthony, art
上级
d33e790f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
247 addition
and
50 deletion
+247
-50
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
+2
-1
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
+18
-26
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
+18
-23
test/java/awt/TextArea/SelectionVisible/SelectionVisible.html
.../java/awt/TextArea/SelectionVisible/SelectionVisible.html
+42
-0
test/java/awt/TextArea/SelectionVisible/SelectionVisible.java
.../java/awt/TextArea/SelectionVisible/SelectionVisible.java
+62
-0
test/java/awt/TextField/SelectionVisible/SelectionVisible.html
...java/awt/TextField/SelectionVisible/SelectionVisible.html
+42
-0
test/java/awt/TextField/SelectionVisible/SelectionVisible.java
...java/awt/TextField/SelectionVisible/SelectionVisible.java
+63
-0
未找到文件。
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
浏览文件 @
3cb008ff
...
...
@@ -71,13 +71,14 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
}
setEditable
(
getTarget
().
isEditable
());
setText
(
getTarget
().
getText
());
setCaretPosition
(
getTarget
().
getCaretPosition
());
getTarget
().
addInputMethodListener
(
this
);
final
int
start
=
getTarget
().
getSelectionStart
();
final
int
end
=
getTarget
().
getSelectionEnd
();
if
(
end
>
start
)
{
// Should be called after setText() and setCaretPosition()
select
(
start
,
end
);
}
setCaretPosition
(
getTarget
().
getCaretPosition
());
firstChangeSkipped
=
true
;
}
...
...
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
浏览文件 @
3cb008ff
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, 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
...
...
@@ -64,16 +64,14 @@ import sun.awt.AWTAccessor;
import
sun.awt.SunToolkit
;
class
XTextAreaPeer
extends
XComponentPeer
implements
TextAreaPeer
{
boolean
editable
;
final
class
XTextAreaPeer
extends
XComponentPeer
implements
TextAreaPeer
{
AWTTextPane
textPane
;
AWTTextArea
jtext
;
private
final
AWTTextPane
textPane
;
private
final
AWTTextArea
jtext
;
private
final
boolean
firstChangeSkipped
;
boolean
firstChangeSkipped
;
private
final
JavaMouseEventHandler
javaMouseEventHandler
=
new
JavaMouseEventHandler
(
this
);
private
final
JavaMouseEventHandler
javaMouseEventHandler
=
new
JavaMouseEventHandler
(
this
);
/* FIXME */
...
...
@@ -98,7 +96,7 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
* Create a Text area.
*/
XTextAreaPeer
(
TextArea
target
)
{
super
(
target
);
super
(
target
);
// some initializations require that target be set even
// though init(target) has not been called
...
...
@@ -106,8 +104,7 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
//ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK);
firstChangeSkipped
=
false
;
String
text
=
((
TextArea
)
target
).
getText
();
String
text
=
target
.
getText
();
jtext
=
new
AWTTextArea
(
text
,
this
);
jtext
.
setWrapStyleWord
(
true
);
jtext
.
getDocument
().
addDocumentListener
(
jtext
);
...
...
@@ -143,25 +140,22 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
setFont
(
font
);
// set the text of this object to the text of its target
setTextImpl
(
target
.
getText
());
//?? should this be setText
int
start
=
target
.
getSelectionStart
();
int
end
=
target
.
getSelectionEnd
();
if
(
end
>
start
)
{
select
(
start
,
end
);
}
// Fix for 5100200
// Restoring Motif behaviour
// Since the end position of the selected text can be greater then the length of the text,
// so we should set caret to max position of the text
int
caretPosition
=
Math
.
min
(
end
,
text
.
length
());
setCaretPosition
(
caretPosition
);
setCaretPosition
(
Math
.
min
(
end
,
text
.
length
()));
if
(
end
>
start
)
{
// Should be called after setText() and setCaretPosition()
select
(
start
,
end
);
}
setEditable
(
target
.
isEditable
());
setScrollBarVisibility
();
// set the text of this object to the text of its target
setTextImpl
(
target
.
getText
());
//?? should this be setText
// After this line we should not change the component's text
firstChangeSkipped
=
true
;
}
...
...
@@ -408,7 +402,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
* @see java.awt.peer.TextComponentPeer
*/
public
void
setEditable
(
boolean
editable
)
{
this
.
editable
=
editable
;
if
(
jtext
!=
null
)
jtext
.
setEditable
(
editable
);
repaintText
();
}
...
...
@@ -461,7 +454,7 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
repaintText
();
}
pr
otected
boolean
setTextImpl
(
String
txt
)
{
pr
ivate
void
setTextImpl
(
String
txt
)
{
if
(
jtext
!=
null
)
{
// JTextArea.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
...
...
@@ -474,7 +467,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
}
jtext
.
getDocument
().
addDocumentListener
(
jtext
);
}
return
true
;
}
/**
...
...
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
浏览文件 @
3cb008ff
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, 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
...
...
@@ -57,46 +57,41 @@ import sun.util.logging.PlatformLogger;
import
sun.awt.CausedFocusEvent
;
import
sun.awt.AWTAccessor
;
public
class
XTextFieldPeer
extends
XComponentPeer
implements
TextFieldPeer
{
final
class
XTextFieldPeer
extends
XComponentPeer
implements
TextFieldPeer
{
private
static
final
PlatformLogger
log
=
PlatformLogger
.
getLogger
(
"sun.awt.X11.XTextField"
);
String
text
;
XAWTTextField
xtext
;
private
String
text
;
private
final
XAWTTextField
xtext
;
private
final
boolean
firstChangeSkipped
;
boolean
firstChangeSkipped
;
public
XTextFieldPeer
(
TextField
target
)
{
XTextFieldPeer
(
TextField
target
)
{
super
(
target
);
int
start
,
end
;
firstChangeSkipped
=
false
;
text
=
target
.
getText
();
xtext
=
new
XAWTTextField
(
text
,
this
,
target
.
getParent
());
xtext
.
getDocument
().
addDocumentListener
(
xtext
);
xtext
.
setCursor
(
target
.
getCursor
());
XToolkit
.
specialPeerMap
.
put
(
xtext
,
this
);
TextField
txt
=
(
TextField
)
target
;
initTextField
();
setText
(
t
x
t
.
getText
());
if
(
t
x
t
.
echoCharIsSet
())
{
setEchoChar
(
t
x
t
.
getEchoChar
());
setText
(
t
arge
t
.
getText
());
if
(
t
arge
t
.
echoCharIsSet
())
{
setEchoChar
(
t
arge
t
.
getEchoChar
());
}
else
setEchoChar
((
char
)
0
);
start
=
txt
.
getSelectionStart
();
end
=
txt
.
getSelectionEnd
();
if
(
end
>
start
)
{
select
(
start
,
end
);
}
int
start
=
target
.
getSelectionStart
();
int
end
=
target
.
getSelectionEnd
();
// Fix for 5100200
// Restoring Motif behaviour
// Since the end position of the selected text can be greater then the length of the text,
// so we should set caret to max position of the text
int
caretPosition
=
Math
.
min
(
end
,
text
.
length
());
setCaretPosition
(
caretPosition
);
setCaretPosition
(
Math
.
min
(
end
,
text
.
length
()));
if
(
end
>
start
)
{
// Should be called after setText() and setCaretPosition()
select
(
start
,
end
);
}
setEditable
(
t
x
t
.
isEditable
());
setEditable
(
t
arge
t
.
isEditable
());
// After this line we should not change the component's text
firstChangeSkipped
=
true
;
...
...
@@ -219,7 +214,7 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
repaint
();
}
pr
otected
boolean
setXAWTTextField
(
String
txt
)
{
pr
ivate
boolean
setXAWTTextField
(
String
txt
)
{
text
=
txt
;
if
(
xtext
!=
null
)
{
// JTextField.setText() posts two different events (remove & insert).
...
...
test/java/awt/TextArea/SelectionVisible/SelectionVisible.html
0 → 100644
浏览文件 @
3cb008ff
<html>
<!--
Copyright (c) 1999, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!--
@test
@bug 4082144 7150100
@summary Ensures that TextArea.select() works when called
before setVisible()
@author Eric.Hawkes: area=TextComponent
@run applet/manual=yesno SelectionVisible.html
-->
<head>
<title>
SelectionVisible
</title>
</head>
<body>
<h1>
SelectionVisible
<br>
Bugid: 4082144
</h1>
<APPLET
CODE=
"SelectionVisible.class"
WIDTH=
400
HEIGHT=
160
></APPLET>
</body>
</html>
test/java/awt/TextArea/SelectionVisible/SelectionVisible.java
0 → 100644
浏览文件 @
3cb008ff
/*
* Copyright (c) 1999, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.applet.Applet
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.FlowLayout
;
import
java.awt.Panel
;
import
java.awt.TextArea
;
public
final
class
SelectionVisible
extends
Applet
{
TextArea
tf
;
@Override
public
void
init
()
{
tf
=
new
TextArea
(
3
,
20
);
tf
.
setText
(
"0123456789"
);
tf
.
select
(
0
,
6
);
final
TextArea
ta
=
new
TextArea
(
"INSTRUCTIONS:\n"
+
"The text 012345 should be selected in the TextArea.\n"
+
"If this is what you observe, then the test passes.\n"
+
"Otherwise, the test fails."
,
40
,
5
,
TextArea
.
SCROLLBARS_NONE
);
ta
.
setEditable
(
false
);
ta
.
setPreferredSize
(
new
Dimension
(
300
,
70
));
final
Panel
panel
=
new
Panel
();
panel
.
setLayout
(
new
FlowLayout
());
panel
.
add
(
tf
);
setLayout
(
new
BorderLayout
());
add
(
ta
,
BorderLayout
.
CENTER
);
add
(
panel
,
BorderLayout
.
PAGE_END
);
}
@Override
public
void
start
()
{
setVisible
(
true
);
tf
.
requestFocus
();
}
}
test/java/awt/TextField/SelectionVisible/SelectionVisible.html
0 → 100644
浏览文件 @
3cb008ff
<html>
<!--
Copyright (c) 1999, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!--
@test
@bug 4082144 7150100
@summary Ensures that TextField.select() works when called
before setVisible()
@author Eric.Hawkes: area=TextComponent
@run applet/manual=yesno SelectionVisible.html
-->
<head>
<title>
SelectionVisible
</title>
</head>
<body>
<h1>
SelectionVisible
<br>
Bugid: 4082144
</h1>
<APPLET
CODE=
"SelectionVisible.class"
WIDTH=
400
HEIGHT=
160
></APPLET>
</body>
</html>
test/java/awt/TextField/SelectionVisible/SelectionVisible.java
0 → 100644
浏览文件 @
3cb008ff
/*
* Copyright (c) 1999, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.applet.Applet
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.FlowLayout
;
import
java.awt.Panel
;
import
java.awt.TextArea
;
import
java.awt.TextField
;
public
final
class
SelectionVisible
extends
Applet
{
TextField
tf
;
@Override
public
void
init
()
{
tf
=
new
TextField
(
20
);
tf
.
setText
(
"0123456789"
);
tf
.
select
(
0
,
6
);
final
TextArea
ta
=
new
TextArea
(
"INSTRUCTIONS:\n"
+
"The text 012345 should be selected in the TextField.\n"
+
"If this is what you observe, then the test passes.\n"
+
"Otherwise, the test fails."
,
40
,
5
,
TextArea
.
SCROLLBARS_NONE
);
ta
.
setEditable
(
false
);
ta
.
setPreferredSize
(
new
Dimension
(
300
,
70
));
final
Panel
panel
=
new
Panel
();
panel
.
setLayout
(
new
FlowLayout
());
panel
.
add
(
tf
);
setLayout
(
new
BorderLayout
());
add
(
ta
,
BorderLayout
.
CENTER
);
add
(
panel
,
BorderLayout
.
PAGE_END
);
}
@Override
public
void
start
()
{
setVisible
(
true
);
tf
.
requestFocus
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录