Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c6ac174c
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c6ac174c
编写于
10月 08, 2013
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8025603: Unused methods in the awt text peers should be removed
Reviewed-by: art, anthony
上级
4b8e480a
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
212 addition
and
558 deletion
+212
-558
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
+2
-2
src/share/classes/java/awt/TextComponent.java
src/share/classes/java/awt/TextComponent.java
+2
-33
src/share/classes/java/awt/peer/TextComponentPeer.java
src/share/classes/java/awt/peer/TextComponentPeer.java
+2
-2
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
+97
-97
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
+54
-90
src/windows/classes/sun/awt/windows/WButtonPeer.java
src/windows/classes/sun/awt/windows/WButtonPeer.java
+2
-9
src/windows/classes/sun/awt/windows/WCheckboxPeer.java
src/windows/classes/sun/awt/windows/WCheckboxPeer.java
+2
-10
src/windows/classes/sun/awt/windows/WChoicePeer.java
src/windows/classes/sun/awt/windows/WChoicePeer.java
+2
-9
src/windows/classes/sun/awt/windows/WComponentPeer.java
src/windows/classes/sun/awt/windows/WComponentPeer.java
+1
-9
src/windows/classes/sun/awt/windows/WLabelPeer.java
src/windows/classes/sun/awt/windows/WLabelPeer.java
+2
-10
src/windows/classes/sun/awt/windows/WListPeer.java
src/windows/classes/sun/awt/windows/WListPeer.java
+2
-7
src/windows/classes/sun/awt/windows/WScrollbarPeer.java
src/windows/classes/sun/awt/windows/WScrollbarPeer.java
+2
-11
src/windows/classes/sun/awt/windows/WTextAreaPeer.java
src/windows/classes/sun/awt/windows/WTextAreaPeer.java
+12
-46
src/windows/classes/sun/awt/windows/WTextComponentPeer.java
src/windows/classes/sun/awt/windows/WTextComponentPeer.java
+13
-32
src/windows/classes/sun/awt/windows/WTextFieldPeer.java
src/windows/classes/sun/awt/windows/WTextFieldPeer.java
+12
-39
src/windows/native/sun/windows/awt_TextArea.cpp
src/windows/native/sun/windows/awt_TextArea.cpp
+2
-17
src/windows/native/sun/windows/awt_TextComponent.cpp
src/windows/native/sun/windows/awt_TextComponent.cpp
+0
-132
src/windows/native/sun/windows/awt_TextField.cpp
src/windows/native/sun/windows/awt_TextField.cpp
+3
-3
未找到文件。
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
浏览文件 @
c6ac174c
...
...
@@ -123,7 +123,7 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
}
@Override
public
final
void
setText
(
final
String
l
)
{
public
final
void
setText
(
final
String
text
)
{
synchronized
(
getDelegateLock
())
{
// JTextArea.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
...
...
@@ -131,7 +131,7 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
// JTextArea.setText() is called.
final
Document
document
=
getTextComponent
().
getDocument
();
document
.
removeDocumentListener
(
this
);
getTextComponent
().
setText
(
l
);
getTextComponent
().
setText
(
text
);
revalidate
();
if
(
firstChangeSkipped
)
{
postEvent
(
new
TextEvent
(
getTarget
(),
...
...
src/share/classes/java/awt/TextComponent.java
浏览文件 @
c6ac174c
...
...
@@ -822,37 +822,6 @@ public class TextComponent extends Component implements Accessible {
// Accessibility support
////////////////
/**
*
*/
int
getIndexAtPoint
(
Point
p
)
{
return
-
1
;
/* To be fully implemented in a future release
if (peer == null) {
return -1;
}
TextComponentPeer peer = (TextComponentPeer)this.peer;
return peer.getIndexAtPoint(p.x, p.y);
*/
}
/**
*
*/
Rectangle
getCharacterBounds
(
int
i
)
{
return
null
;
/* To be fully implemented in a future release
if (peer == null) {
return null;
}
TextComponentPeer peer = (TextComponentPeer)this.peer;
return peer.getCharacterBounds(i);
*/
}
/**
* Gets the AccessibleContext associated with this TextComponent.
* For text components, the AccessibleContext takes the form of an
...
...
@@ -963,7 +932,7 @@ public class TextComponent extends Component implements Accessible {
* @return the zero-based index of the character under Point p.
*/
public
int
getIndexAtPoint
(
Point
p
)
{
return
TextComponent
.
this
.
getIndexAtPoint
(
p
)
;
return
-
1
;
}
/**
...
...
@@ -976,7 +945,7 @@ public class TextComponent extends Component implements Accessible {
* @return the screen coordinates of the character's bounding box
*/
public
Rectangle
getCharacterBounds
(
int
i
)
{
return
TextComponent
.
this
.
getCharacterBounds
(
i
)
;
return
null
;
}
/**
...
...
src/share/classes/java/awt/peer/TextComponentPeer.java
浏览文件 @
c6ac174c
...
...
@@ -60,11 +60,11 @@ public interface TextComponentPeer extends ComponentPeer {
/**
* Sets the content for the text component.
*
* @param
l
the content to set
* @param
text
the content to set
*
* @see TextComponent#setText(String)
*/
void
setText
(
String
l
);
void
setText
(
String
text
);
/**
* Returns the start index of the current selection.
...
...
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
浏览文件 @
c6ac174c
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
浏览文件 @
c6ac174c
...
...
@@ -97,6 +97,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
firstChangeSkipped
=
true
;
}
@Override
public
void
dispose
()
{
XToolkit
.
specialPeerMap
.
remove
(
xtext
);
// visible caret has a timer thread which must be stopped
...
...
@@ -136,10 +137,10 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
setFont
(
font
);
}
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
void
setEditable
(
boolean
editable
)
{
if
(
xtext
!=
null
)
{
xtext
.
setEditable
(
editable
);
...
...
@@ -150,6 +151,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
/**
* @see java.awt.peer.ComponentPeer
*/
@Override
public
void
setEnabled
(
boolean
enabled
)
{
super
.
setEnabled
(
enabled
);
if
(
xtext
!=
null
)
{
...
...
@@ -161,22 +163,23 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
InputMethodRequests
getInputMethodRequests
()
{
if
(
xtext
!=
null
)
return
xtext
.
getInputMethodRequests
();
else
return
null
;
}
@Override
void
handleJavaInputMethodEvent
(
InputMethodEvent
e
)
{
if
(
xtext
!=
null
)
xtext
.
processInputMethodEventImpl
(
e
);
}
/**
* @see java.awt.peer.TextFieldPeer
*/
@Override
public
void
setEchoChar
(
char
c
)
{
if
(
xtext
!=
null
)
{
xtext
.
setEchoChar
(
c
);
...
...
@@ -188,6 +191,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
int
getSelectionStart
()
{
return
xtext
.
getSelectionStart
();
}
...
...
@@ -195,6 +199,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
int
getSelectionEnd
()
{
return
xtext
.
getSelectionEnd
();
}
...
...
@@ -202,6 +207,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
String
getText
()
{
return
xtext
.
getText
();
}
...
...
@@ -209,12 +215,13 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
/**
* @see java.awt.peer.TextComponentPeer
*/
public
void
setText
(
String
txt
)
{
setXAWTTextField
(
txt
);
@Override
public
void
setText
(
String
text
)
{
setXAWTTextField
(
text
);
repaint
();
}
private
boolean
setXAWTTextField
(
String
txt
)
{
private
void
setXAWTTextField
(
String
txt
)
{
text
=
txt
;
if
(
xtext
!=
null
)
{
// JTextField.setText() posts two different events (remove & insert).
...
...
@@ -229,29 +236,22 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
xtext
.
getDocument
().
addDocumentListener
(
xtext
);
xtext
.
setCaretPosition
(
0
);
}
return
true
;
}
/**
* to be implemented.
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
void
setCaretPosition
(
int
position
)
{
if
(
xtext
!=
null
)
xtext
.
setCaretPosition
(
position
);
}
/**
* DEPRECATED
* @see java.awt.peer.TextFieldPeer
*/
public
void
setEchoCharacter
(
char
c
)
{
setEchoChar
(
c
);
}
void
repaintText
()
{
xtext
.
repaintNow
();
}
@Override
public
void
setBackground
(
Color
c
)
{
if
(
log
.
isLoggable
(
PlatformLogger
.
Level
.
FINE
))
{
log
.
fine
(
"target="
+
target
+
", old="
+
background
+
", new="
+
c
);
...
...
@@ -264,6 +264,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
repaintText
();
}
@Override
public
void
setForeground
(
Color
c
)
{
foreground
=
c
;
if
(
xtext
!=
null
)
{
...
...
@@ -274,6 +275,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
repaintText
();
}
@Override
public
void
setFont
(
Font
f
)
{
synchronized
(
getStateLock
())
{
font
=
f
;
...
...
@@ -284,14 +286,6 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
xtext
.
validate
();
}
/**
* DEPRECATED
* @see java.awt.peer.TextFieldPeer
*/
public
Dimension
preferredSize
(
int
cols
)
{
return
getPreferredSize
(
cols
);
}
/**
* Deselects the the highlighted text.
*/
...
...
@@ -303,20 +297,19 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
/**
* to be implemented.
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
int
getCaretPosition
()
{
return
xtext
.
getCaretPosition
();
}
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public
void
select
(
int
s
,
int
e
)
{
xtext
.
select
(
s
,
e
);
// Fixed 5100806
...
...
@@ -324,29 +317,32 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
xtext
.
repaint
();
}
@Override
public
Dimension
getMinimumSize
()
{
return
xtext
.
getMinimumSize
();
}
@Override
public
Dimension
getPreferredSize
()
{
return
xtext
.
getPreferredSize
();
}
@Override
public
Dimension
getPreferredSize
(
int
cols
)
{
return
getMinimumSize
(
cols
);
}
private
static
final
int
PADDING
=
16
;
@Override
public
Dimension
getMinimumSize
(
int
cols
)
{
Font
f
=
xtext
.
getFont
();
FontMetrics
fm
=
xtext
.
getFontMetrics
(
f
);
return
new
Dimension
(
fm
.
charWidth
(
'0'
)
*
cols
+
10
,
fm
.
getMaxDescent
()
+
fm
.
getMaxAscent
()
+
PADDING
);
}
@Override
public
boolean
isFocusable
()
{
return
true
;
}
...
...
@@ -359,11 +355,10 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
modifiers
));
}
protected
void
disposeImpl
()
{
}
@Override
public
void
repaint
()
{
if
(
xtext
!=
null
)
xtext
.
repaint
();
}
...
...
@@ -372,27 +367,32 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
if
(
xtext
!=
null
)
xtext
.
paint
(
g
);
}
@Override
public
void
print
(
Graphics
g
)
{
if
(
xtext
!=
null
)
{
xtext
.
print
(
g
);
}
}
@Override
public
void
focusLost
(
FocusEvent
e
)
{
super
.
focusLost
(
e
);
xtext
.
forwardFocusLost
(
e
);
}
@Override
public
void
focusGained
(
FocusEvent
e
)
{
super
.
focusGained
(
e
);
xtext
.
forwardFocusGained
(
e
);
}
@Override
void
handleJavaKeyEvent
(
KeyEvent
e
)
{
AWTAccessor
.
getComponentAccessor
().
processEvent
(
xtext
,
e
);
}
@Override
public
void
handleJavaMouseEvent
(
MouseEvent
mouseEvent
)
{
super
.
handleJavaMouseEvent
(
mouseEvent
);
if
(
xtext
!=
null
)
{
...
...
@@ -405,26 +405,21 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
/**
* DEPRECATED
*/
@Override
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
(
int
cols
)
{
return
getMinimumSize
(
cols
);
}
@Override
public
void
setVisible
(
boolean
b
)
{
super
.
setVisible
(
b
);
if
(
xtext
!=
null
)
xtext
.
setVisible
(
b
);
}
@Override
public
void
setBounds
(
int
x
,
int
y
,
int
width
,
int
height
,
int
op
)
{
super
.
setBounds
(
x
,
y
,
width
,
height
,
op
);
if
(
xtext
!=
null
)
{
...
...
@@ -451,47 +446,11 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
final
class
AWTTextFieldUI
extends
MotifPasswordFieldUI
{
//
// Accessibility support
//
// stub functions: to be fully implemented in a future release
public
int
getIndexAtPoint
(
int
x
,
int
y
)
{
return
-
1
;
}
public
Rectangle
getCharacterBounds
(
int
i
)
{
return
null
;
}
public
long
filterEvents
(
long
mask
)
{
return
0
;
}
/* To be fully implemented in a future release
int oldSelectionStart;
int oldSelectionEnd;
public native int getIndexAtPoint(int x, int y);
public native Rectangle getCharacterBounds(int i);
public native long filterEvents(long mask);
/**
* Handle a change in the text selection endpoints
* (Note: could be simply a change in the caret location)
*
public void selectionValuesChanged(int start, int end) {
return; // Need to write implemetation of this.
}
*/
class
AWTTextFieldUI
extends
MotifPasswordFieldUI
{
/**
* Creates a UI for a JTextField.
*
* @param c the text field
* @return the UI
*/
JTextField
jtf
;
private
JTextField
jtf
;
@Override
protected
String
getPropertyPrefix
()
{
JTextComponent
comp
=
getComponent
();
if
(
comp
instanceof
JPasswordField
&&
((
JPasswordField
)
comp
).
echoCharIsSet
())
{
...
...
@@ -501,6 +460,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
@Override
public
void
installUI
(
JComponent
c
)
{
super
.
installUI
(
c
);
...
...
@@ -557,6 +517,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
@Override
protected
void
installKeyboardActions
()
{
super
.
installKeyboardActions
();
...
...
@@ -574,21 +535,19 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
@Override
protected
Caret
createCaret
()
{
return
new
XTextAreaPeer
.
XAWTCaret
();
}
}
class
XAWTTextField
extends
JPasswordField
implements
ActionListener
,
DocumentListener
{
final
class
XAWTTextField
extends
JPasswordField
implements
ActionListener
,
DocumentListener
{
boolean
isFocused
=
false
;
private
boolean
isFocused
=
false
;
private
final
XComponentPeer
peer
;
XComponentPeer
peer
;
public
XAWTTextField
(
String
text
,
XComponentPeer
peer
,
Container
parent
)
{
XAWTTextField
(
String
text
,
XComponentPeer
peer
,
Container
parent
)
{
super
(
text
);
this
.
peer
=
peer
;
setDoubleBuffered
(
true
);
...
...
@@ -603,6 +562,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
@Override
public
void
actionPerformed
(
ActionEvent
actionEvent
)
{
peer
.
postEvent
(
new
ActionEvent
(
peer
.
target
,
ActionEvent
.
ACTION_PERFORMED
,
...
...
@@ -612,6 +572,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
@Override
public
void
insertUpdate
(
DocumentEvent
e
)
{
if
(
peer
!=
null
)
{
peer
.
postEvent
(
new
TextEvent
(
peer
.
target
,
...
...
@@ -619,6 +580,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
@Override
public
void
removeUpdate
(
DocumentEvent
e
)
{
if
(
peer
!=
null
)
{
peer
.
postEvent
(
new
TextEvent
(
peer
.
target
,
...
...
@@ -626,6 +588,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
@Override
public
void
changedUpdate
(
DocumentEvent
e
)
{
if
(
peer
!=
null
)
{
peer
.
postEvent
(
new
TextEvent
(
peer
.
target
,
...
...
@@ -633,33 +596,32 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
}
@Override
public
ComponentPeer
getPeer
()
{
return
(
ComponentPeer
)
peer
;
}
public
void
repaintNow
()
{
paintImmediately
(
getBounds
());
}
@Override
public
Graphics
getGraphics
()
{
return
peer
.
getGraphics
();
}
@Override
public
void
updateUI
()
{
ComponentUI
ui
=
new
AWTTextFieldUI
();
setUI
(
ui
);
}
void
forwardFocusGained
(
FocusEvent
e
)
{
isFocused
=
true
;
FocusEvent
fe
=
CausedFocusEvent
.
retarget
(
e
,
this
);
super
.
processFocusEvent
(
fe
);
}
void
forwardFocusLost
(
FocusEvent
e
)
{
isFocused
=
false
;
FocusEvent
fe
=
CausedFocusEvent
.
retarget
(
e
,
this
);
...
...
@@ -667,11 +629,11 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
@Override
public
boolean
hasFocus
()
{
return
isFocused
;
}
public
void
processInputMethodEventImpl
(
InputMethodEvent
e
)
{
processInputMethodEvent
(
e
);
}
...
...
@@ -686,6 +648,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
// Fix for 4915454 - override the default implementation to avoid
// loading SystemFlavorMap and associated classes.
@Override
public
void
setTransferHandler
(
TransferHandler
newHandler
)
{
TransferHandler
oldHandler
=
(
TransferHandler
)
getClientProperty
(
AWTAccessor
.
getClientPropertyKeyAccessor
()
...
...
@@ -697,6 +660,7 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
firePropertyChange
(
"transferHandler"
,
oldHandler
,
newHandler
);
}
@Override
public
void
setEchoChar
(
char
c
)
{
super
.
setEchoChar
(
c
);
((
AWTTextFieldUI
)
ui
).
installKeyboardActions
();
...
...
src/windows/classes/sun/awt/windows/WButtonPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -29,7 +29,7 @@ import java.awt.peer.*;
import
java.awt.event.ActionEvent
;
import
java.awt.event.KeyEvent
;
class
WButtonPeer
extends
WComponentPeer
implements
ButtonPeer
{
final
class
WButtonPeer
extends
WComponentPeer
implements
ButtonPeer
{
static
{
initIDs
();
...
...
@@ -83,13 +83,6 @@ class WButtonPeer extends WComponentPeer implements ButtonPeer {
return
false
;
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
/**
* Initialize JNI field and method IDs
*/
...
...
src/windows/classes/sun/awt/windows/WCheckboxPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -28,7 +28,7 @@ import java.awt.*;
import
java.awt.peer.*
;
import
java.awt.event.ItemEvent
;
public
class
WCheckboxPeer
extends
WComponentPeer
implements
CheckboxPeer
{
final
class
WCheckboxPeer
extends
WComponentPeer
implements
CheckboxPeer
{
// CheckboxPeer implementation
...
...
@@ -100,12 +100,4 @@ public class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
}
});
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
}
src/windows/classes/sun/awt/windows/WChoicePeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -32,7 +32,7 @@ import java.awt.event.WindowListener;
import
java.awt.event.WindowAdapter
;
import
sun.awt.SunToolkit
;
class
WChoicePeer
extends
WComponentPeer
implements
ChoicePeer
{
final
class
WChoicePeer
extends
WComponentPeer
implements
ChoicePeer
{
// WComponentPeer overrides
...
...
@@ -151,12 +151,5 @@ class WChoicePeer extends WComponentPeer implements ChoicePeer {
return
fm
.
getHeight
()
*
maxItems
;
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
native
void
closeList
();
}
src/windows/classes/sun/awt/windows/WComponentPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -50,7 +50,6 @@ import sun.java2d.ScreenUpdateManager;
import
sun.java2d.d3d.D3DSurfaceData
;
import
sun.java2d.opengl.OGLSurfaceData
;
import
sun.java2d.pipe.Region
;
import
sun.awt.DisplayChangedListener
;
import
sun.awt.PaintEventDispatcher
;
import
sun.awt.SunToolkit
;
import
sun.awt.event.IgnorePaintEvent
;
...
...
@@ -881,13 +880,6 @@ public abstract class WComponentPeer extends WObjectPeer
public
native
void
beginValidate
();
public
native
void
endValidate
();
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
/**
* DEPRECATED
*/
...
...
src/windows/classes/sun/awt/windows/WLabelPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
01
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -27,7 +27,7 @@ package sun.awt.windows;
import
java.awt.*
;
import
java.awt.peer.*
;
class
WLabelPeer
extends
WComponentPeer
implements
LabelPeer
{
final
class
WLabelPeer
extends
WComponentPeer
implements
LabelPeer
{
// ComponentPeer overrides
...
...
@@ -82,12 +82,4 @@ class WLabelPeer extends WComponentPeer implements LabelPeer {
super
.
initialize
();
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
}
src/windows/classes/sun/awt/windows/WListPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -29,13 +29,8 @@ import java.awt.peer.*;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ItemEvent
;
class
WListPeer
extends
WComponentPeer
implements
ListPeer
{
final
class
WListPeer
extends
WComponentPeer
implements
ListPeer
{
// ComponentPeer overrides
public
Dimension
minimumSize
()
{
return
minimumSize
(
4
);
}
public
boolean
isFocusable
()
{
return
true
;
}
...
...
src/windows/classes/sun/awt/windows/WScrollbarPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
02
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -28,8 +28,7 @@ import java.awt.*;
import
java.awt.peer.*
;
import
java.awt.event.AdjustmentEvent
;
class
WScrollbarPeer
extends
WComponentPeer
implements
ScrollbarPeer
{
final
class
WScrollbarPeer
extends
WComponentPeer
implements
ScrollbarPeer
{
// Returns width for vertial scrollbar as SM_CXHSCROLL,
// height for horizontal scrollbar as SM_CYVSCROLL
...
...
@@ -140,12 +139,4 @@ class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
public
boolean
shouldClearRectBeforePaint
()
{
return
false
;
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
}
src/windows/classes/sun/awt/windows/WTextAreaPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
0
3, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
1
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
...
...
@@ -30,34 +30,36 @@ import java.awt.peer.*;
import
java.awt.im.InputMethodRequests
;
class
WTextAreaPeer
extends
WTextComponentPeer
implements
TextAreaPeer
{
final
class
WTextAreaPeer
extends
WTextComponentPeer
implements
TextAreaPeer
{
// WComponentPeer overrides
@Override
public
Dimension
getMinimumSize
()
{
return
getMinimumSize
(
10
,
60
);
}
// TextAreaPeer implementation
/* This should eventually be a direct native method. */
public
void
insert
(
String
txt
,
int
pos
)
{
insertText
(
txt
,
pos
);
@Override
public
void
insert
(
String
t
e
xt
,
int
pos
)
{
replaceRange
(
text
,
pos
,
pos
);
}
/* This should eventually be a direct native method. */
public
void
replaceRange
(
String
txt
,
int
start
,
int
end
)
{
replaceText
(
txt
,
start
,
end
);
}
@Override
public
native
void
replaceRange
(
String
text
,
int
start
,
int
end
);
@Override
public
Dimension
getPreferredSize
(
int
rows
,
int
cols
)
{
return
getMinimumSize
(
rows
,
cols
);
}
@Override
public
Dimension
getMinimumSize
(
int
rows
,
int
cols
)
{
FontMetrics
fm
=
getFontMetrics
(((
TextArea
)
target
).
getFont
());
return
new
Dimension
(
fm
.
charWidth
(
'0'
)
*
cols
+
20
,
fm
.
getHeight
()
*
rows
+
20
);
}
@Override
public
InputMethodRequests
getInputMethodRequests
()
{
return
null
;
}
...
...
@@ -68,42 +70,6 @@ class WTextAreaPeer extends WTextComponentPeer implements TextAreaPeer {
super
(
target
);
}
@Override
native
void
create
(
WComponentPeer
parent
);
// native callbacks
// deprecated methods
/**
* DEPRECATED but, for now, still called by insert(String, int).
*/
public
native
void
insertText
(
String
txt
,
int
pos
);
/**
* DEPRECATED but, for now, still called by replaceRange(String, int, int).
*/
public
native
void
replaceText
(
String
txt
,
int
start
,
int
end
);
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
(
int
rows
,
int
cols
)
{
return
getMinimumSize
(
rows
,
cols
);
}
/**
* DEPRECATED
*/
public
Dimension
preferredSize
(
int
rows
,
int
cols
)
{
return
getPreferredSize
(
rows
,
cols
);
}
}
src/windows/classes/sun/awt/windows/WTextComponentPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
01
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -38,14 +38,20 @@ class WTextComponentPeer extends WComponentPeer implements TextComponentPeer {
// TextComponentPeer implementation
@Override
public
void
setEditable
(
boolean
editable
)
{
enableEditing
(
editable
);
setBackground
(((
TextComponent
)
target
).
getBackground
());
}
@Override
public
native
String
getText
();
public
native
void
setText
(
String
txt
);
@Override
public
native
void
setText
(
String
text
);
@Override
public
native
int
getSelectionStart
();
@Override
public
native
int
getSelectionEnd
();
@Override
public
native
void
select
(
int
selStart
,
int
selEnd
);
// Toolkit & peer internals
...
...
@@ -54,6 +60,7 @@ class WTextComponentPeer extends WComponentPeer implements TextComponentPeer {
super
(
target
);
}
@Override
void
initialize
()
{
TextComponent
tc
=
(
TextComponent
)
target
;
String
text
=
tc
.
getText
();
...
...
@@ -64,14 +71,12 @@ class WTextComponentPeer extends WComponentPeer implements TextComponentPeer {
select
(
tc
.
getSelectionStart
(),
tc
.
getSelectionEnd
());
setEditable
(
tc
.
isEditable
());
// oldSelectionStart = -1; // accessibility support
// oldSelectionEnd = -1; // accessibility support
super
.
initialize
();
}
native
void
enableEditing
(
boolean
e
);
@Override
public
boolean
isFocusable
()
{
return
true
;
}
...
...
@@ -81,6 +86,7 @@ class WTextComponentPeer extends WComponentPeer implements TextComponentPeer {
* unfortunately resets the selection, but seems to be the
* only way to get this to work.
*/
@Override
public
void
setCaretPosition
(
int
pos
)
{
select
(
pos
,
pos
);
}
...
...
@@ -89,6 +95,7 @@ class WTextComponentPeer extends WComponentPeer implements TextComponentPeer {
* Get the caret position by looking up the end of the current
* selection.
*/
@Override
public
int
getCaretPosition
()
{
return
getSelectionStart
();
}
...
...
@@ -105,34 +112,8 @@ class WTextComponentPeer extends WComponentPeer implements TextComponentPeer {
*/
private
static
native
void
initIDs
();
// stub functions: to be fully implemented in a future release
public
int
getIndexAtPoint
(
int
x
,
int
y
)
{
return
-
1
;
}
public
Rectangle
getCharacterBounds
(
int
i
)
{
return
null
;
}
public
long
filterEvents
(
long
mask
)
{
return
0
;
}
@Override
public
boolean
shouldClearRectBeforePaint
()
{
return
false
;
}
//
// Accessibility support
//
/* To be fully implemented in a future release
int oldSelectionStart;
int oldSelectionEnd;
public native int getIndexAtPoint(int x, int y);
public native Rectangle getCharacterBounds(int i);
public native long filterEvents(long mask);
/**
* Handle a change in the text selection endpoints
* (Note: could be simply a change in the caret location)
*
public void selectionValuesChanged(int start, int end) {
return; // Need to write implementation of this.
}
*/
}
src/windows/classes/sun/awt/windows/WTextFieldPeer.java
浏览文件 @
c6ac174c
/*
* Copyright (c) 1996, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -31,16 +31,18 @@ import java.awt.event.ActionEvent;
import
java.awt.event.KeyEvent
;
import
java.awt.im.InputMethodRequests
;
class
WTextFieldPeer
extends
WTextComponentPeer
implements
TextFieldPeer
{
final
class
WTextFieldPeer
extends
WTextComponentPeer
implements
TextFieldPeer
{
// WComponentPeer overrides
@Override
public
Dimension
getMinimumSize
()
{
FontMetrics
fm
=
getFontMetrics
(((
TextField
)
target
).
getFont
());
return
new
Dimension
(
fm
.
stringWidth
(
getText
())
+
24
,
fm
.
getHeight
()
+
8
);
}
@Override
public
boolean
handleJavaKeyEvent
(
KeyEvent
e
)
{
switch
(
e
.
getID
())
{
case
KeyEvent
.
KEY_TYPED
:
...
...
@@ -56,35 +58,35 @@ class WTextFieldPeer extends WTextComponentPeer implements TextFieldPeer {
// TextFieldPeer implementation
@Override
public
native
void
setEchoChar
(
char
echoChar
);
/* This should eventually be a direct native method. */
public
void
setEchoChar
(
char
c
)
{
setEchoCharacter
(
c
);
}
@Override
public
Dimension
getPreferredSize
(
int
cols
)
{
return
getMinimumSize
(
cols
);
}
@Override
public
Dimension
getMinimumSize
(
int
cols
)
{
FontMetrics
fm
=
getFontMetrics
(((
TextField
)
target
).
getFont
());
return
new
Dimension
(
fm
.
charWidth
(
'0'
)
*
cols
+
24
,
fm
.
getHeight
()
+
8
);
}
@Override
public
InputMethodRequests
getInputMethodRequests
()
{
return
null
;
return
null
;
}
// Toolkit & peer internals
WTextFieldPeer
(
TextField
target
)
{
super
(
target
);
}
@Override
native
void
create
(
WComponentPeer
parent
);
@Override
void
initialize
()
{
TextField
tf
=
(
TextField
)
target
;
if
(
tf
.
echoCharIsSet
())
{
...
...
@@ -92,33 +94,4 @@ class WTextFieldPeer extends WTextComponentPeer implements TextFieldPeer {
}
super
.
initialize
();
}
// deprecated methods
/**
* DEPRECATED but, for now, called by setEchoChar(char).
*/
public
native
void
setEchoCharacter
(
char
c
);
/**
* DEPRECATED
*/
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
/**
* DEPRECATED
*/
public
Dimension
minimumSize
(
int
cols
)
{
return
getMinimumSize
(
cols
);
}
/**
* DEPRECATED
*/
public
Dimension
preferredSize
(
int
cols
)
{
return
getPreferredSize
(
cols
);
}
}
src/windows/native/sun/windows/awt_TextArea.cpp
浏览文件 @
c6ac174c
...
...
@@ -767,11 +767,11 @@ Java_sun_awt_windows_WTextAreaPeer_create(JNIEnv *env, jobject self,
/*
* Class: sun_awt_windows_WTextAreaPeer
* Method: replace
Text
* Method: replace
Range
* Signature: (Ljava/lang/String;II)V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_windows_WTextAreaPeer_replace
Text
(
JNIEnv
*
env
,
jobject
self
,
Java_sun_awt_windows_WTextAreaPeer_replace
Range
(
JNIEnv
*
env
,
jobject
self
,
jstring
text
,
jint
start
,
jint
end
)
{
...
...
@@ -791,19 +791,4 @@ Java_sun_awt_windows_WTextAreaPeer_replaceText(JNIEnv *env, jobject self,
CATCH_BAD_ALLOC
;
}
/*
* Class: sun_awt_windows_WTextAreaPeer
* Method: insertText
* Signature: (Ljava/lang/String;I)V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_windows_WTextAreaPeer_insertText
(
JNIEnv
*
env
,
jobject
self
,
jstring
text
,
jint
pos
)
{
Java_sun_awt_windows_WTextAreaPeer_replaceText
(
env
,
self
,
text
,
pos
,
pos
);
}
}
/* extern "C" */
src/windows/native/sun/windows/awt_TextComponent.cpp
浏览文件 @
c6ac174c
...
...
@@ -987,30 +987,6 @@ AwtTextComponent::OleCallback::GetContextMenu(WORD seltype,
// Accessibility support
//
/* To be fully implemented in a future release
*
* Class: sun_awt_windows_WTextComponentPeer
* Method: getIndexAtPoint
* Signature: (II)I
*
JNIEXPORT jlong JNICALL
Java_sun_awt_windows_WTextComponentPeer_filterEvents(JNIEnv *env, jobject self, jlong mask)
{
TRY;
PDATA pData;
JNI_CHECK_PEER_RETURN_NULL(self);
AwtTextComponent* c = (AwtTextComponent*)pData;
jlong oldMask = c->javaEventsMask;
c->javaEventsMask = mask;
return oldMask;
CATCH_BAD_ALLOC_RET(0);
}
*/
// [[[FIXME]]] need to switch to rich edit field; look for EN_SELCHANGE event instead
/*
* Handle WmKeyDown to catch keystrokes which may move the caret,
...
...
@@ -1051,112 +1027,4 @@ MsgRouting AwtTextComponent::WmKeyDown(UINT wkey, UINT repCnt,
return AwtComponent::WmKeyDown(wkey, repCnt, flags, system);
}
*/
/* To be fully implemented in a future release
*
* Class: sun_awt_windows_WTextComponentPeer
* Method: getIndexAtPoint
* Signature: (II)I
*
JNIEXPORT jint JNICALL
Java_sun_awt_windows_WTextComponentPeer_getIndexAtPoint(JNIEnv *env, jobject self, jint x, jint y)
{
TRY;
PDATA pData;
// JNI_CHECK_PEER_RETURN_VAL(self, -1); [[[FIXME]]] Peter Korn -> should return -1 here
JNI_CHECK_PEER_RETURN_NULL(self);
AwtTextComponent* c = (AwtTextComponent*)pData;
int indicies = c->SendMessage(EM_CHARFROMPOS, (WPARAM) 0, (LPARAM) MAKELPARAM(x, y));
int index = LOWORD(indicies); // index into the line the (x,y) coord is on
int lineIndex = c->SendMessage(EM_LINEINDEX, HIWORD(indicies)); // index of start of line
return (index + lineIndex);
CATCH_BAD_ALLOC_RET(-1);
}
*/
/* To be fully implemented in a future release
*
* Class: sun_awt_windows_WTextComponentPeer
* Method: getCharacterBounds
* Signature: (I)Ljava/awt/Rectangle;
*
JNIEXPORT jobject JNICALL
Java_sun_awt_windows_WTextComponentPeer_getCharacterBounds(JNIEnv *env, jobject self, jint i)
{
// loop through lines with EM_LINELENGTH? e.g.:
// line = 0; ttl = 0; // index is passed in as 'i' above
// while (ttl < index) {
// ttl += SendMessage(EM_LINELENGTH, line++);
// }
// line-- (decrement back again)
// alternately, we could use EM_LINEINDEX to the same effect; perhaps slightly cleaner:
// computedIndex = 0; line = 0;
// while (computedIndex < index) {
// computedIndex = SendMessage(EM_LINEINDEX, 1 + line++);
// }
// line--;
// EM_POSFROMCHAR - convert char index into a Point
// wParam = (LPPOINT) lpPoint; // address of structure
// receiving character position
// lParam = (LPARAM) wCharIndex; // zero-based index of character
//
// still need to turn the above into a Rect somehow...
// (use font metrics on font info for letter to get height? use
// getLineHeight type of message?).
// WM_GETFONT - get the font struct for the window control
// wParam = lParam = 0
// returns an HFONT
// -or-
// GetTextMetrics(hDC) to get the text info for the font selected
// into the hDC of the control (tmHeight is what we want in the
// TEXTMETRIC struct).
// also GetCharWidth32() with the char at the index in question to get
// the width of that char
// *** Can't use GetTextMetrics/GetCharWidth32, as we don't have an hDC!! ***
TRY;
PDATA pData;
JNI_CHECK_PEER_RETURN_NULL(self);
AwtComponent* c = (AwtComponent*)pData;
/*
int line = 0;
int lineIndex = 0;
while (lineIndex < i) {
lineIndex = c->SendMessage(EM_LINEINDEX, 1 + line++);
}
line--; // line is now the line which contains our character at position 'i'
int offsetIndex = i - lineIndex; // offsetIndex is now distance in on the line
* /
POINT p;
c->SendMessage(EM_POSFROMCHAR, (WPARAM) &p, (LPARAM) i); // x coord is meaningful; y may not be
// need to calculate charWidth, charHeight, and set p.y to something meangful
jint charWidth;
jint charHeight;
/*
HFONT font = c->SendMessage(WM_GETFONT);
if (GetCharWidth32(c->hdc, i, i, &charWidth) != 0) { // [[[FIXME]]] need to get hDC!
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jobject rect = JNU_NewObjectByName(env, "java/awt/Rectangle", "(IIII)V",
(jint) p.x, (jint) p.y, charWidth, charHeight);
return rect;
}
* /
return (jobject) 0;
CATCH_BAD_ALLOC_RET(0);
}
*/
}
/* extern "C" */
src/windows/native/sun/windows/awt_TextField.cpp
浏览文件 @
c6ac174c
...
...
@@ -316,12 +316,12 @@ Java_sun_awt_windows_WTextFieldPeer_create(JNIEnv *env, jobject self,
/*
* Class: sun_awt_windows_WTextFieldPeer
* Method: setEchoChar
acter
* Method: setEchoChar
* Signature: (C)V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_windows_WTextFieldPeer_setEchoChar
acter
(
JNIEnv
*
env
,
jobject
self
,
jchar
ch
)
Java_sun_awt_windows_WTextFieldPeer_setEchoChar
(
JNIEnv
*
env
,
jobject
self
,
jchar
ch
)
{
TRY
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录