Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
15bf253b
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看板
提交
15bf253b
编写于
7月 30, 2013
作者:
A
ant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8020927: JLightweightFrame API should export layout properties change notifications
Reviewed-by: anthony
上级
b4243e14
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
76 addition
and
1 deletion
+76
-1
src/share/classes/sun/swing/JLightweightFrame.java
src/share/classes/sun/swing/JLightweightFrame.java
+58
-1
src/share/classes/sun/swing/LightweightContent.java
src/share/classes/sun/swing/LightweightContent.java
+18
-0
未找到文件。
src/share/classes/sun/swing/JLightweightFrame.java
浏览文件 @
15bf253b
...
...
@@ -29,12 +29,18 @@ import java.awt.BorderLayout;
import
java.awt.Color
;
import
java.awt.Component
;
import
java.awt.Container
;
import
java.awt.Dimension
;
import
java.awt.EventQueue
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Rectangle
;
import
java.awt.event.ComponentListener
;
import
java.awt.event.ContainerEvent
;
import
java.awt.event.ContainerListener
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBufferInt
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.PropertyChangeListener
;
import
java.security.AccessController
;
import
javax.swing.JLayeredPane
;
...
...
@@ -80,6 +86,8 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
private
boolean
copyBufferEnabled
;
private
int
[]
copyBuffer
;
private
PropertyChangeListener
layoutSizeListener
;
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
...
...
@@ -94,6 +102,23 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
if
(
getGraphicsConfiguration
().
isTranslucencyCapable
())
{
setBackground
(
new
Color
(
0
,
0
,
0
,
0
));
}
layoutSizeListener
=
new
PropertyChangeListener
()
{
@Override
public
void
propertyChange
(
PropertyChangeEvent
e
)
{
Dimension
d
=
(
Dimension
)
e
.
getNewValue
();
if
(
"preferredSize"
.
equals
(
e
.
getPropertyName
()))
{
content
.
preferredSizeChanged
(
d
.
width
,
d
.
height
);
}
else
if
(
"maximumSize"
.
equals
(
e
.
getPropertyName
()))
{
content
.
maximumSizeChanged
(
d
.
width
,
d
.
height
);
}
else
if
(
"minimumSize"
.
equals
(
e
.
getPropertyName
()))
{
content
.
minimumSizeChanged
(
d
.
width
,
d
.
height
);
}
}
};
}
/**
...
...
@@ -104,10 +129,23 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
*
* @param content the {@link LightweightContent} instance
*/
public
void
setContent
(
LightweightContent
content
)
{
public
void
setContent
(
final
LightweightContent
content
)
{
if
(
content
==
null
)
{
System
.
err
.
println
(
"JLightweightFrame.setContent: content may not be null!"
);
return
;
}
this
.
content
=
content
;
this
.
component
=
content
.
getComponent
();
Dimension
d
=
this
.
component
.
getPreferredSize
();
content
.
preferredSizeChanged
(
d
.
width
,
d
.
height
);
d
=
this
.
component
.
getMaximumSize
();
content
.
maximumSizeChanged
(
d
.
width
,
d
.
height
);
d
=
this
.
component
.
getMinimumSize
();
content
.
minimumSizeChanged
(
d
.
width
,
d
.
height
);
initInterior
();
}
...
...
@@ -202,6 +240,25 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
contentPane
.
setLayout
(
new
BorderLayout
());
contentPane
.
add
(
component
);
setContentPane
(
contentPane
);
contentPane
.
addContainerListener
(
new
ContainerListener
()
{
@Override
public
void
componentAdded
(
ContainerEvent
e
)
{
Component
c
=
JLightweightFrame
.
this
.
component
;
if
(
e
.
getChild
()
==
c
)
{
c
.
addPropertyChangeListener
(
"preferredSize"
,
layoutSizeListener
);
c
.
addPropertyChangeListener
(
"maximumSize"
,
layoutSizeListener
);
c
.
addPropertyChangeListener
(
"minimumSize"
,
layoutSizeListener
);
}
}
@Override
public
void
componentRemoved
(
ContainerEvent
e
)
{
Component
c
=
JLightweightFrame
.
this
.
component
;
if
(
e
.
getChild
()
==
c
)
{
c
.
removePropertyChangeListener
(
layoutSizeListener
);
}
}
});
}
@SuppressWarnings
(
"deprecation"
)
...
...
src/share/classes/sun/swing/LightweightContent.java
浏览文件 @
15bf253b
...
...
@@ -161,4 +161,22 @@ public interface LightweightContent {
* application that the frame has ungrabbed focus.
*/
public
void
focusUngrabbed
();
/**
* {@code JLightweightFrame} calls this method to notify the client
* application that the content preferred size has changed.
*/
public
void
preferredSizeChanged
(
int
width
,
int
height
);
/**
* {@code JLightweightFrame} calls this method to notify the client
* application that the content maximum size has changed.
*/
public
void
maximumSizeChanged
(
int
width
,
int
height
);
/**
* {@code JLightweightFrame} calls this method to notify the client
* application that the content minimum size has changed.
*/
public
void
minimumSizeChanged
(
int
width
,
int
height
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录