Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4c55daa3
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看板
提交
4c55daa3
编写于
7月 22, 2009
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6802868: JInternalFrame is not maximized when maximized parent frame.
Reviewed-by: rupashka
上级
493173b6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
136 addition
and
197 deletion
+136
-197
src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java
...re/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java
+1
-14
src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java
.../classes/javax/swing/plaf/basic/BasicInternalFrameUI.java
+27
-15
src/share/classes/javax/swing/plaf/basic/DesktopIconMover.java
...hare/classes/javax/swing/plaf/basic/DesktopIconMover.java
+0
-168
test/javax/swing/JInternalFrame/Test6802868.java
test/javax/swing/JInternalFrame/Test6802868.java
+108
-0
未找到文件。
src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java
浏览文件 @
4c55daa3
/*
/*
* Copyright 1997-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-200
9
Sun Microsystems, Inc. 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
...
@@ -32,9 +32,6 @@ import javax.swing.event.*;
...
@@ -32,9 +32,6 @@ import javax.swing.event.*;
import
javax.swing.border.*
;
import
javax.swing.border.*
;
import
javax.swing.plaf.*
;
import
javax.swing.plaf.*
;
import
java.beans.*
;
import
java.beans.*
;
import
java.util.EventListener
;
import
java.io.Serializable
;
/**
/**
* Basic L&F for a minimized window on a desktop.
* Basic L&F for a minimized window on a desktop.
...
@@ -47,7 +44,6 @@ public class BasicDesktopIconUI extends DesktopIconUI {
...
@@ -47,7 +44,6 @@ public class BasicDesktopIconUI extends DesktopIconUI {
protected
JInternalFrame
.
JDesktopIcon
desktopIcon
;
protected
JInternalFrame
.
JDesktopIcon
desktopIcon
;
protected
JInternalFrame
frame
;
protected
JInternalFrame
frame
;
private
DesktopIconMover
desktopIconMover
;
/**
/**
* The title pane component used in the desktop icon.
* The title pane component used in the desktop icon.
...
@@ -128,21 +124,12 @@ public class BasicDesktopIconUI extends DesktopIconUI {
...
@@ -128,21 +124,12 @@ public class BasicDesktopIconUI extends DesktopIconUI {
mouseInputListener
=
createMouseInputListener
();
mouseInputListener
=
createMouseInputListener
();
desktopIcon
.
addMouseMotionListener
(
mouseInputListener
);
desktopIcon
.
addMouseMotionListener
(
mouseInputListener
);
desktopIcon
.
addMouseListener
(
mouseInputListener
);
desktopIcon
.
addMouseListener
(
mouseInputListener
);
getDesktopIconMover
().
installListeners
();
}
}
protected
void
uninstallListeners
()
{
protected
void
uninstallListeners
()
{
desktopIcon
.
removeMouseMotionListener
(
mouseInputListener
);
desktopIcon
.
removeMouseMotionListener
(
mouseInputListener
);
desktopIcon
.
removeMouseListener
(
mouseInputListener
);
desktopIcon
.
removeMouseListener
(
mouseInputListener
);
mouseInputListener
=
null
;
mouseInputListener
=
null
;
getDesktopIconMover
().
uninstallListeners
();
}
private
DesktopIconMover
getDesktopIconMover
()
{
if
(
desktopIconMover
==
null
)
{
desktopIconMover
=
new
DesktopIconMover
(
desktopIcon
);
}
return
desktopIconMover
;
}
}
protected
void
installDefaults
()
{
protected
void
installDefaults
()
{
...
...
src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java
浏览文件 @
4c55daa3
...
@@ -27,16 +27,10 @@ package javax.swing.plaf.basic;
...
@@ -27,16 +27,10 @@ package javax.swing.plaf.basic;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.event.*
;
import
java.awt.peer.LightweightPeer
;
import
javax.swing.*
;
import
javax.swing.*
;
import
javax.swing.border.*
;
import
javax.swing.plaf.*
;
import
javax.swing.plaf.*
;
import
javax.swing.event.*
;
import
javax.swing.event.*
;
import
java.beans.*
;
import
java.beans.*
;
import
java.io.Serializable
;
import
sun.swing.DefaultLookup
;
import
sun.swing.DefaultLookup
;
import
sun.swing.UIAction
;
import
sun.swing.UIAction
;
...
@@ -55,6 +49,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -55,6 +49,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
protected
MouseInputAdapter
borderListener
;
protected
MouseInputAdapter
borderListener
;
protected
PropertyChangeListener
propertyChangeListener
;
protected
PropertyChangeListener
propertyChangeListener
;
protected
LayoutManager
internalFrameLayout
;
protected
LayoutManager
internalFrameLayout
;
protected
ComponentListener
componentListener
;
protected
MouseInputListener
glassPaneDispatcher
;
protected
MouseInputListener
glassPaneDispatcher
;
private
InternalFrameListener
internalFrameListener
;
private
InternalFrameListener
internalFrameListener
;
...
@@ -66,9 +61,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -66,9 +61,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
protected
BasicInternalFrameTitlePane
titlePane
;
// access needs this
protected
BasicInternalFrameTitlePane
titlePane
;
// access needs this
private
static
DesktopManager
sharedDesktopManager
;
private
static
DesktopManager
sharedDesktopManager
;
private
boolean
componentListenerAdded
=
false
;
private
Rectangle
parentBounds
;
private
Rectangle
parentBounds
;
private
DesktopIconMover
desktopIconMover
;
private
boolean
dragging
=
false
;
private
boolean
dragging
=
false
;
private
boolean
resizing
=
false
;
private
boolean
resizing
=
false
;
...
@@ -209,17 +204,14 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -209,17 +204,14 @@ public class BasicInternalFrameUI extends InternalFrameUI
frame
.
getGlassPane
().
addMouseListener
(
glassPaneDispatcher
);
frame
.
getGlassPane
().
addMouseListener
(
glassPaneDispatcher
);
frame
.
getGlassPane
().
addMouseMotionListener
(
glassPaneDispatcher
);
frame
.
getGlassPane
().
addMouseMotionListener
(
glassPaneDispatcher
);
}
}
componentListener
=
createComponentListener
();
if
(
frame
.
getParent
()
!=
null
)
{
if
(
frame
.
getParent
()
!=
null
)
{
parentBounds
=
frame
.
getParent
().
getBounds
();
parentBounds
=
frame
.
getParent
().
getBounds
();
}
}
getDesktopIconMover
().
installListeners
();
if
((
frame
.
getParent
()
!=
null
)
&&
!
componentListenerAdded
)
{
}
frame
.
getParent
().
addComponentListener
(
componentListener
);
componentListenerAdded
=
true
;
private
DesktopIconMover
getDesktopIconMover
()
{
if
(
desktopIconMover
==
null
)
{
desktopIconMover
=
new
DesktopIconMover
(
frame
);
}
}
return
desktopIconMover
;
}
}
// Provide a FocusListener to listen for a WINDOW_LOST_FOCUS event,
// Provide a FocusListener to listen for a WINDOW_LOST_FOCUS event,
...
@@ -290,7 +282,11 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -290,7 +282,11 @@ public class BasicInternalFrameUI extends InternalFrameUI
* @since 1.3
* @since 1.3
*/
*/
protected
void
uninstallListeners
()
{
protected
void
uninstallListeners
()
{
getDesktopIconMover
().
uninstallListeners
();
if
((
frame
.
getParent
()
!=
null
)
&&
componentListenerAdded
)
{
frame
.
getParent
().
removeComponentListener
(
componentListener
);
componentListenerAdded
=
false
;
}
componentListener
=
null
;
if
(
glassPaneDispatcher
!=
null
)
{
if
(
glassPaneDispatcher
!=
null
)
{
frame
.
getGlassPane
().
removeMouseListener
(
glassPaneDispatcher
);
frame
.
getGlassPane
().
removeMouseListener
(
glassPaneDispatcher
);
frame
.
getGlassPane
().
removeMouseMotionListener
(
glassPaneDispatcher
);
frame
.
getGlassPane
().
removeMouseMotionListener
(
glassPaneDispatcher
);
...
@@ -1228,6 +1224,15 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -1228,6 +1224,15 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
}
}
}
// Relocate the icon base on the new parent bounds.
if
(
icon
!=
null
)
{
Rectangle
iconBounds
=
icon
.
getBounds
();
int
y
=
iconBounds
.
y
+
(
parentNewBounds
.
height
-
parentBounds
.
height
);
icon
.
setBounds
(
iconBounds
.
x
,
y
,
iconBounds
.
width
,
iconBounds
.
height
);
}
// Update the new parent bounds for next resize.
// Update the new parent bounds for next resize.
if
(!
parentBounds
.
equals
(
parentNewBounds
))
{
if
(!
parentBounds
.
equals
(
parentNewBounds
))
{
parentBounds
=
parentNewBounds
;
parentBounds
=
parentNewBounds
;
...
@@ -1399,6 +1404,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -1399,6 +1404,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
// Cancel a resize in progress if the internal frame
// Cancel a resize in progress if the internal frame
// gets a setClosed(true) or dispose().
// gets a setClosed(true) or dispose().
cancelResize
();
cancelResize
();
if
((
frame
.
getParent
()
!=
null
)
&&
componentListenerAdded
)
{
frame
.
getParent
().
removeComponentListener
(
componentListener
);
}
closeFrame
(
f
);
closeFrame
(
f
);
}
}
}
else
if
(
JInternalFrame
.
IS_MAXIMUM_PROPERTY
==
prop
)
{
}
else
if
(
JInternalFrame
.
IS_MAXIMUM_PROPERTY
==
prop
)
{
...
@@ -1431,6 +1439,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
...
@@ -1431,6 +1439,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
else
{
}
else
{
parentBounds
=
null
;
parentBounds
=
null
;
}
}
if
((
frame
.
getParent
()
!=
null
)
&&
!
componentListenerAdded
)
{
f
.
getParent
().
addComponentListener
(
componentListener
);
componentListenerAdded
=
true
;
}
}
else
if
(
JInternalFrame
.
TITLE_PROPERTY
==
prop
||
}
else
if
(
JInternalFrame
.
TITLE_PROPERTY
==
prop
||
prop
==
"closable"
||
prop
==
"iconable"
||
prop
==
"closable"
||
prop
==
"iconable"
||
prop
==
"maximizable"
)
{
prop
==
"maximizable"
)
{
...
...
src/share/classes/javax/swing/plaf/basic/DesktopIconMover.java
已删除
100644 → 0
浏览文件 @
493173b6
/*
* Copyright 1997-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
javax.swing.plaf.basic
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.beans.*
;
/**
* DesktopIconMover is intended to move desktop icon
* when parent window is resized.
*/
class
DesktopIconMover
implements
ComponentListener
,
PropertyChangeListener
{
private
Component
parent
;
private
JInternalFrame
frame
;
// if not null, DesktopIconMover(frame)
// constructor was used
private
JInternalFrame
.
JDesktopIcon
icon
;
private
Rectangle
parentBounds
;
private
boolean
componentListenerAdded
=
false
;
public
DesktopIconMover
(
JInternalFrame
frame
)
{
if
(
frame
==
null
)
{
throw
new
NullPointerException
(
"Frame cannot be null"
);
}
this
.
frame
=
frame
;
this
.
icon
=
frame
.
getDesktopIcon
();
if
(
icon
==
null
)
{
throw
new
NullPointerException
(
"frame.getDesktopIcon() cannot be null"
);
}
this
.
parent
=
frame
.
getParent
();
if
(
this
.
parent
!=
null
)
{
parentBounds
=
this
.
parent
.
getBounds
();
}
}
public
DesktopIconMover
(
JInternalFrame
.
JDesktopIcon
icon
)
{
if
(
icon
==
null
)
{
throw
new
NullPointerException
(
"Icon cannot be null"
);
}
this
.
icon
=
icon
;
this
.
parent
=
icon
.
getParent
();
if
(
this
.
parent
!=
null
)
{
parentBounds
=
this
.
parent
.
getBounds
();
}
}
public
void
installListeners
()
{
if
(
frame
!=
null
)
{
frame
.
addPropertyChangeListener
(
this
);
}
else
{
icon
.
addPropertyChangeListener
(
this
);
}
addComponentListener
();
}
public
void
uninstallListeners
()
{
if
(
frame
!=
null
)
{
frame
.
removePropertyChangeListener
(
this
);
}
else
{
icon
.
removePropertyChangeListener
(
this
);
}
removeComponentListener
();
}
public
void
propertyChange
(
PropertyChangeEvent
evt
)
{
String
propName
=
evt
.
getPropertyName
();
if
(
"ancestor"
.
equals
(
propName
))
{
Component
newAncestor
=
(
Component
)
evt
.
getNewValue
();
// Remove component listener if parent is changing
Component
probablyNewParent
=
getCurrentParent
();
if
((
probablyNewParent
!=
null
)
&&
(!
probablyNewParent
.
equals
(
parent
)))
{
removeComponentListener
();
parent
=
probablyNewParent
;
}
if
(
newAncestor
==
null
)
{
removeComponentListener
();
}
else
{
addComponentListener
();
}
// Update parentBounds
if
(
parent
!=
null
)
{
parentBounds
=
parent
.
getBounds
();
}
else
{
parentBounds
=
null
;
}
}
else
if
(
JInternalFrame
.
IS_CLOSED_PROPERTY
.
equals
(
propName
))
{
removeComponentListener
();
}
}
private
void
addComponentListener
()
{
if
(!
componentListenerAdded
&&
(
parent
!=
null
))
{
parent
.
addComponentListener
(
this
);
componentListenerAdded
=
true
;
}
}
private
void
removeComponentListener
()
{
if
((
parent
!=
null
)
&&
componentListenerAdded
)
{
parent
.
removeComponentListener
(
this
);
componentListenerAdded
=
false
;
}
}
private
Component
getCurrentParent
()
{
if
(
frame
!=
null
)
{
return
frame
.
getParent
();
}
else
{
return
icon
.
getParent
();
}
}
public
void
componentResized
(
ComponentEvent
e
)
{
if
((
parent
==
null
)
||
(
parentBounds
==
null
))
{
return
;
}
Rectangle
parentNewBounds
=
parent
.
getBounds
();
if
((
parentNewBounds
==
null
)
||
parentNewBounds
.
equals
(
parentBounds
))
{
return
;
}
// Move desktop icon only in up-down direction
int
newIconY
=
icon
.
getLocation
().
y
+
(
parentNewBounds
.
height
-
parentBounds
.
height
);
icon
.
setLocation
(
icon
.
getLocation
().
x
,
newIconY
);
parentBounds
=
parentNewBounds
;
}
public
void
componentMoved
(
ComponentEvent
e
)
{
}
public
void
componentShown
(
ComponentEvent
e
)
{
}
public
void
componentHidden
(
ComponentEvent
e
)
{
}
}
test/javax/swing/JInternalFrame/Test6802868.java
0 → 100644
浏览文件 @
4c55daa3
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6802868
* @summary JInternalFrame is not maximized when maximized parent frame
* @author Alexander Potochkin
*/
import
sun.awt.SunToolkit
;
import
java.awt.Dimension
;
import
java.awt.Point
;
import
java.awt.Robot
;
import
java.awt.Toolkit
;
import
java.beans.PropertyVetoException
;
import
javax.swing.JDesktopPane
;
import
javax.swing.JFrame
;
import
javax.swing.JInternalFrame
;
import
javax.swing.SwingUtilities
;
public
class
Test6802868
{
static
JInternalFrame
jif
;
static
JFrame
frame
;
static
Dimension
size
;
static
Point
location
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
20
);
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
frame
=
new
JFrame
();
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
JDesktopPane
jdp
=
new
JDesktopPane
();
frame
.
getContentPane
().
add
(
jdp
);
jif
=
new
JInternalFrame
(
"Title"
,
true
,
true
,
true
,
true
);
jdp
.
add
(
jif
);
jif
.
setVisible
(
true
);
frame
.
setSize
(
200
,
200
);
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
try
{
jif
.
setMaximum
(
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
toolkit
.
realSync
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
size
=
jif
.
getSize
();
frame
.
setSize
(
300
,
300
);
}
});
toolkit
.
realSync
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
if
(
jif
.
getSize
().
equals
(
size
))
{
throw
new
RuntimeException
(
"InternalFrame hasn't changed its size"
);
}
try
{
jif
.
setIcon
(
true
);
}
catch
(
PropertyVetoException
e
)
{
e
.
printStackTrace
();
}
location
=
jif
.
getDesktopIcon
().
getLocation
();
frame
.
setSize
(
400
,
400
);
}
});
toolkit
.
realSync
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
if
(
jif
.
getDesktopIcon
().
getLocation
().
equals
(
location
))
{
throw
new
RuntimeException
(
"JDesktopIcon hasn't moved"
);
}
}
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录