Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f864700b
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看板
提交
f864700b
编写于
10月 21, 2010
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
4358979: javax.swing.border should have a DashedBorder
Reviewed-by: flar, alexp
上级
44ab7618
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
601 addition
and
6 deletion
+601
-6
src/share/classes/java/awt/BasicStroke.java
src/share/classes/java/awt/BasicStroke.java
+4
-1
src/share/classes/java/awt/GradientPaint.java
src/share/classes/java/awt/GradientPaint.java
+3
-1
src/share/classes/java/awt/LinearGradientPaint.java
src/share/classes/java/awt/LinearGradientPaint.java
+3
-2
src/share/classes/java/awt/RadialGradientPaint.java
src/share/classes/java/awt/RadialGradientPaint.java
+3
-1
src/share/classes/java/awt/geom/AffineTransform.java
src/share/classes/java/awt/geom/AffineTransform.java
+3
-1
src/share/classes/javax/swing/BorderFactory.java
src/share/classes/javax/swing/BorderFactory.java
+123
-0
src/share/classes/javax/swing/border/StrokeBorder.java
src/share/classes/javax/swing/border/StrokeBorder.java
+156
-0
test/java/beans/XMLEncoder/java_awt_BasicStroke.java
test/java/beans/XMLEncoder/java_awt_BasicStroke.java
+46
-0
test/java/beans/XMLEncoder/java_awt_GradientPaint.java
test/java/beans/XMLEncoder/java_awt_GradientPaint.java
+47
-0
test/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java
test/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java
+60
-0
test/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java
test/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java
+60
-0
test/java/beans/XMLEncoder/java_awt_geom_AffineTransform.java
.../java/beans/XMLEncoder/java_awt_geom_AffineTransform.java
+45
-0
test/java/beans/XMLEncoder/javax_swing_border_StrokeBorder.java
...ava/beans/XMLEncoder/javax_swing_border_StrokeBorder.java
+48
-0
未找到文件。
src/share/classes/java/awt/BasicStroke.java
浏览文件 @
f864700b
/*
/*
* Copyright (c) 1997, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
10
, 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
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
package
java.awt
;
package
java.awt
;
import
java.beans.ConstructorProperties
;
/**
/**
* The <code>BasicStroke</code> class defines a basic set of rendering
* The <code>BasicStroke</code> class defines a basic set of rendering
* attributes for the outlines of graphics primitives, which are rendered
* attributes for the outlines of graphics primitives, which are rendered
...
@@ -183,6 +185,7 @@ public class BasicStroke implements Stroke {
...
@@ -183,6 +185,7 @@ public class BasicStroke implements Stroke {
* <code>dash</code> is zero
* <code>dash</code> is zero
* @throws IllegalArgumentException if dash lengths are all zero.
* @throws IllegalArgumentException if dash lengths are all zero.
*/
*/
@ConstructorProperties
({
"lineWidth"
,
"endCap"
,
"lineJoin"
,
"miterLimit"
,
"dashArray"
,
"dashPhase"
})
public
BasicStroke
(
float
width
,
int
cap
,
int
join
,
float
miterlimit
,
public
BasicStroke
(
float
width
,
int
cap
,
int
join
,
float
miterlimit
,
float
dash
[],
float
dash_phase
)
{
float
dash
[],
float
dash_phase
)
{
if
(
width
<
0.0f
)
{
if
(
width
<
0.0f
)
{
...
...
src/share/classes/java/awt/GradientPaint.java
浏览文件 @
f864700b
/*
/*
* Copyright (c) 1997, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
10
, 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
...
@@ -29,6 +29,7 @@ import java.awt.geom.Point2D;
...
@@ -29,6 +29,7 @@ import java.awt.geom.Point2D;
import
java.awt.geom.Rectangle2D
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.AffineTransform
;
import
java.awt.image.ColorModel
;
import
java.awt.image.ColorModel
;
import
java.beans.ConstructorProperties
;
/**
/**
* The <code>GradientPaint</code> class provides a way to fill
* The <code>GradientPaint</code> class provides a way to fill
...
@@ -166,6 +167,7 @@ public class GradientPaint implements Paint {
...
@@ -166,6 +167,7 @@ public class GradientPaint implements Paint {
* @throws NullPointerException if either one of colors or points
* @throws NullPointerException if either one of colors or points
* is null
* is null
*/
*/
@ConstructorProperties
({
"point1"
,
"color1"
,
"point2"
,
"color2"
,
"cyclic"
})
public
GradientPaint
(
Point2D
pt1
,
public
GradientPaint
(
Point2D
pt1
,
Color
color1
,
Color
color1
,
Point2D
pt2
,
Point2D
pt2
,
...
...
src/share/classes/java/awt/LinearGradientPaint.java
浏览文件 @
f864700b
/*
/*
* Copyright (c) 2006, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 20
10
, 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
...
@@ -26,10 +26,10 @@
...
@@ -26,10 +26,10 @@
package
java.awt
;
package
java.awt
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.NoninvertibleTransformException
;
import
java.awt.geom.Point2D
;
import
java.awt.geom.Point2D
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.image.ColorModel
;
import
java.awt.image.ColorModel
;
import
java.beans.ConstructorProperties
;
/**
/**
* The {@code LinearGradientPaint} class provides a way to fill
* The {@code LinearGradientPaint} class provides a way to fill
...
@@ -271,6 +271,7 @@ public final class LinearGradientPaint extends MultipleGradientPaint {
...
@@ -271,6 +271,7 @@ public final class LinearGradientPaint extends MultipleGradientPaint {
* or a {@code fractions} value is less than 0.0 or greater than 1.0,
* or a {@code fractions} value is less than 0.0 or greater than 1.0,
* or the {@code fractions} are not provided in strictly increasing order
* or the {@code fractions} are not provided in strictly increasing order
*/
*/
@ConstructorProperties
({
"startPoint"
,
"endPoint"
,
"fractions"
,
"colors"
,
"cycleMethod"
,
"colorSpace"
,
"transform"
})
public
LinearGradientPaint
(
Point2D
start
,
Point2D
end
,
public
LinearGradientPaint
(
Point2D
start
,
Point2D
end
,
float
[]
fractions
,
Color
[]
colors
,
float
[]
fractions
,
Color
[]
colors
,
CycleMethod
cycleMethod
,
CycleMethod
cycleMethod
,
...
...
src/share/classes/java/awt/RadialGradientPaint.java
浏览文件 @
f864700b
/*
/*
* Copyright (c) 2006, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 20
10
, 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
...
@@ -29,6 +29,7 @@ import java.awt.geom.AffineTransform;
...
@@ -29,6 +29,7 @@ import java.awt.geom.AffineTransform;
import
java.awt.geom.Point2D
;
import
java.awt.geom.Point2D
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.image.ColorModel
;
import
java.awt.image.ColorModel
;
import
java.beans.ConstructorProperties
;
/**
/**
* The {@code RadialGradientPaint} class provides a way to fill a shape with
* The {@code RadialGradientPaint} class provides a way to fill a shape with
...
@@ -428,6 +429,7 @@ public final class RadialGradientPaint extends MultipleGradientPaint {
...
@@ -428,6 +429,7 @@ public final class RadialGradientPaint extends MultipleGradientPaint {
* or a {@code fractions} value is less than 0.0 or greater than 1.0,
* or a {@code fractions} value is less than 0.0 or greater than 1.0,
* or the {@code fractions} are not provided in strictly increasing order
* or the {@code fractions} are not provided in strictly increasing order
*/
*/
@ConstructorProperties
({
"centerPoint"
,
"radius"
,
"focusPoint"
,
"fractions"
,
"colors"
,
"cycleMethod"
,
"colorSpace"
,
"transform"
})
public
RadialGradientPaint
(
Point2D
center
,
public
RadialGradientPaint
(
Point2D
center
,
float
radius
,
float
radius
,
Point2D
focus
,
Point2D
focus
,
...
...
src/share/classes/java/awt/geom/AffineTransform.java
浏览文件 @
f864700b
/*
/*
* Copyright (c) 1996, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
10
, 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
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
package
java.awt.geom
;
package
java.awt.geom
;
import
java.awt.Shape
;
import
java.awt.Shape
;
import
java.beans.ConstructorProperties
;
/**
/**
* The <code>AffineTransform</code> class represents a 2D affine transform
* The <code>AffineTransform</code> class represents a 2D affine transform
...
@@ -508,6 +509,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
...
@@ -508,6 +509,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* @param m12 the Y coordinate translation element of the 3x3 matrix
* @param m12 the Y coordinate translation element of the 3x3 matrix
* @since 1.2
* @since 1.2
*/
*/
@ConstructorProperties
({
"scaleX"
,
"shearY"
,
"shearX"
,
"scaleY"
,
"translateX"
,
"translateY"
})
public
AffineTransform
(
float
m00
,
float
m10
,
public
AffineTransform
(
float
m00
,
float
m10
,
float
m01
,
float
m11
,
float
m01
,
float
m11
,
float
m02
,
float
m12
)
{
float
m02
,
float
m12
)
{
...
...
src/share/classes/javax/swing/BorderFactory.java
浏览文件 @
f864700b
...
@@ -24,8 +24,10 @@
...
@@ -24,8 +24,10 @@
*/
*/
package
javax.swing
;
package
javax.swing
;
import
java.awt.BasicStroke
;
import
java.awt.Color
;
import
java.awt.Color
;
import
java.awt.Font
;
import
java.awt.Font
;
import
java.awt.Paint
;
import
javax.swing.border.*
;
import
javax.swing.border.*
;
/**
/**
...
@@ -636,4 +638,125 @@ public class BorderFactory
...
@@ -636,4 +638,125 @@ public class BorderFactory
Icon
tileIcon
)
{
Icon
tileIcon
)
{
return
new
MatteBorder
(
top
,
left
,
bottom
,
right
,
tileIcon
);
return
new
MatteBorder
(
top
,
left
,
bottom
,
right
,
tileIcon
);
}
}
//// StrokeBorder //////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/**
* Creates a border of the specified {@code stroke}.
* The component's foreground color will be used to render the border.
*
* @param stroke the {@link BasicStroke} object used to stroke a shape
* @return the {@code Border} object
*
* @throws NullPointerException if the specified {@code stroke} is {@code null}
*
* @since 1.7
*/
public
static
Border
createStrokeBorder
(
BasicStroke
stroke
)
{
return
new
StrokeBorder
(
stroke
);
}
/**
* Creates a border of the specified {@code stroke} and {@code paint}.
* If the specified {@code paint} is {@code null},
* the component's foreground color will be used to render the border.
*
* @param stroke the {@link BasicStroke} object used to stroke a shape
* @param paint the {@link Paint} object used to generate a color
* @return the {@code Border} object
*
* @throws NullPointerException if the specified {@code stroke} is {@code null}
*
* @since 1.7
*/
public
static
Border
createStrokeBorder
(
BasicStroke
stroke
,
Paint
paint
)
{
return
new
StrokeBorder
(
stroke
,
paint
);
}
//// DashedBorder //////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
private
static
Border
sharedDashedBorder
;
/**
* Creates a dashed border of the specified {@code paint}.
* If the specified {@code paint} is {@code null},
* the component's foreground color will be used to render the border.
* The width of a dash line is equal to {@code 1}.
* The relative length of a dash line and
* the relative spacing between dash lines are equal to {@code 1}.
* A dash line is not rounded.
*
* @param paint the {@link Paint} object used to generate a color
* @return the {@code Border} object
*
* @since 1.7
*/
public
static
Border
createDashedBorder
(
Paint
paint
)
{
return
createDashedBorder
(
paint
,
1.0f
,
1.0f
,
1.0f
,
false
);
}
/**
* Creates a dashed border of the specified {@code paint},
* relative {@code length}, and relative {@code spacing}.
* If the specified {@code paint} is {@code null},
* the component's foreground color will be used to render the border.
* The width of a dash line is equal to {@code 1}.
* A dash line is not rounded.
*
* @param paint the {@link Paint} object used to generate a color
* @param length the relative length of a dash line
* @param spacing the relative spacing between dash lines
* @return the {@code Border} object
*
* @throws IllegalArgumentException if the specified {@code length} is less than {@code 1}, or
* if the specified {@code spacing} is less than {@code 0}
* @since 1.7
*/
public
static
Border
createDashedBorder
(
Paint
paint
,
float
length
,
float
spacing
)
{
return
createDashedBorder
(
paint
,
1.0f
,
length
,
spacing
,
false
);
}
/**
* Creates a dashed border of the specified {@code paint}, {@code thickness},
* line shape, relative {@code length}, and relative {@code spacing}.
* If the specified {@code paint} is {@code null},
* the component's foreground color will be used to render the border.
*
* @param paint the {@link Paint} object used to generate a color
* @param thickness the width of a dash line
* @param length the relative length of a dash line
* @param spacing the relative spacing between dash lines
* @param rounded whether or not line ends should be round
* @return the {@code Border} object
*
* @throws IllegalArgumentException if the specified {@code thickness} is less than {@code 1}, or
* if the specified {@code length} is less than {@code 1}, or
* if the specified {@code spacing} is less than {@code 0}
* @since 1.7
*/
public
static
Border
createDashedBorder
(
Paint
paint
,
float
thickness
,
float
length
,
float
spacing
,
boolean
rounded
)
{
boolean
shared
=
!
rounded
&&
(
paint
==
null
)
&&
(
thickness
==
1.0f
)
&&
(
length
==
1.0f
)
&&
(
spacing
==
1.0f
);
if
(
shared
&&
(
sharedDashedBorder
!=
null
))
{
return
sharedDashedBorder
;
}
if
(
thickness
<
1.0f
)
{
throw
new
IllegalArgumentException
(
"thickness is less than 1"
);
}
if
(
length
<
1.0f
)
{
throw
new
IllegalArgumentException
(
"length is less than 1"
);
}
if
(
spacing
<
0.0f
)
{
throw
new
IllegalArgumentException
(
"spacing is less than 0"
);
}
int
cap
=
rounded
?
BasicStroke
.
CAP_ROUND
:
BasicStroke
.
CAP_SQUARE
;
int
join
=
rounded
?
BasicStroke
.
JOIN_ROUND
:
BasicStroke
.
JOIN_MITER
;
float
[]
array
=
{
thickness
*
(
length
-
1.0f
),
thickness
*
(
spacing
+
1.0f
)
};
Border
border
=
createStrokeBorder
(
new
BasicStroke
(
thickness
,
cap
,
join
,
thickness
*
2.0f
,
array
,
0.0f
),
paint
);
if
(
shared
)
{
sharedDashedBorder
=
border
;
}
return
border
;
}
}
}
src/share/classes/javax/swing/border/StrokeBorder.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
javax.swing.border
;
import
java.awt.BasicStroke
;
import
java.awt.Component
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Insets
;
import
java.awt.Paint
;
import
java.awt.RenderingHints
;
import
java.awt.geom.Rectangle2D
;
import
java.beans.ConstructorProperties
;
/**
* A class which implements a border of an arbitrary stroke.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI
* between applications running the same version of Swing.
* As of 1.4, support for long term storage of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Sergey A. Malenkov
*
* @since 1.7
*/
public
class
StrokeBorder
extends
AbstractBorder
{
private
final
BasicStroke
stroke
;
private
final
Paint
paint
;
/**
* Creates a border of the specified {@code stroke}.
* The component's foreground color will be used to render the border.
*
* @param stroke the {@link BasicStroke} object used to stroke a shape
*
* @throws NullPointerException if the specified {@code stroke} is {@code null}
*/
public
StrokeBorder
(
BasicStroke
stroke
)
{
this
(
stroke
,
null
);
}
/**
* Creates a border of the specified {@code stroke} and {@code paint}.
* If the specified {@code paint} is {@code null},
* the component's foreground color will be used to render the border.
*
* @param stroke the {@link BasicStroke} object used to stroke a shape
* @param paint the {@link Paint} object used to generate a color
*
* @throws NullPointerException if the specified {@code stroke} is {@code null}
*/
@ConstructorProperties
({
"stroke"
,
"paint"
})
public
StrokeBorder
(
BasicStroke
stroke
,
Paint
paint
)
{
if
(
stroke
==
null
)
{
throw
new
NullPointerException
(
"border's stroke"
);
}
this
.
stroke
=
stroke
;
this
.
paint
=
paint
;
}
/**
* Paints the border for the specified component
* with the specified position and size.
*
* @param c the component for which this border is being painted
* @param g the paint graphics
* @param x the x position of the painted border
* @param y the y position of the painted border
* @param width the width of the painted border
* @param height the height of the painted border
*
* @throws NullPointerException if the specified {@code c} or {@code g} are {@code null}
*/
@Override
public
void
paintBorder
(
Component
c
,
Graphics
g
,
int
x
,
int
y
,
int
width
,
int
height
)
{
float
size
=
this
.
stroke
.
getLineWidth
();
if
(
size
>
0.0f
)
{
g
=
g
.
create
();
if
(
g
instanceof
Graphics2D
)
{
Graphics2D
g2d
=
(
Graphics2D
)
g
;
g2d
.
setStroke
(
this
.
stroke
);
g2d
.
setPaint
(
this
.
paint
!=
null
?
this
.
paint
:
c
.
getForeground
());
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
g2d
.
draw
(
new
Rectangle2D
.
Float
(
x
+
size
/
2
,
y
+
size
/
2
,
width
-
size
,
height
-
size
));
}
g
.
dispose
();
}
}
/**
* Reinitializes the {@code insets} parameter
* with this border's current insets.
* All insets are equal to the line width of the stroke.
*
* @param c the component for which this border insets value applies
* @param insets the {@code Insets} object to be reinitialized
* @return the reinitialized {@code insets} parameter
*
* @throws NullPointerException if the specified {@code insets} is {@code null}
*/
@Override
public
Insets
getBorderInsets
(
Component
c
,
Insets
insets
)
{
int
size
=
(
int
)
Math
.
ceil
(
this
.
stroke
.
getLineWidth
());
insets
.
set
(
size
,
size
,
size
,
size
);
return
insets
;
}
/**
* Returns the {@link BasicStroke} object used to stroke a shape
* during the border rendering.
*
* @return the {@link BasicStroke} object
*/
public
BasicStroke
getStroke
()
{
return
this
.
stroke
;
}
/**
* Returns the {@link Paint} object used to generate a color
* during the border rendering.
*
* @return the {@link Paint} object or {@code null}
* if the {@code paint} parameter is not set
*/
public
Paint
getPaint
()
{
return
this
.
paint
;
}
}
test/java/beans/XMLEncoder/java_awt_BasicStroke.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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 4358979
* @summary Tests BasicStroke encoding
* @author Sergey Malenkov
*/
import
java.awt.BasicStroke
;
public
final
class
java_awt_BasicStroke
extends
AbstractTest
<
BasicStroke
>
{
public
static
void
main
(
String
[]
args
)
{
new
java_awt_BasicStroke
().
test
(
true
);
}
protected
BasicStroke
getObject
()
{
return
new
BasicStroke
();
}
protected
BasicStroke
getAnotherObject
()
{
float
[]
f
=
{
1.0f
,
2.0f
,
3.0f
,
4.0f
};
return
new
BasicStroke
(
f
[
1
],
BasicStroke
.
CAP_ROUND
,
BasicStroke
.
JOIN_ROUND
,
f
[
2
],
f
,
f
[
3
]);
}
}
test/java/beans/XMLEncoder/java_awt_GradientPaint.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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 4358979
* @summary Tests GradientPaint encoding
* @author Sergey Malenkov
*/
import
java.awt.Color
;
import
java.awt.GradientPaint
;
public
final
class
java_awt_GradientPaint
extends
AbstractTest
<
GradientPaint
>
{
public
static
void
main
(
String
[]
args
)
{
new
java_awt_GradientPaint
().
test
(
true
);
}
protected
GradientPaint
getObject
()
{
return
new
GradientPaint
(
0.1f
,
0.2f
,
Color
.
BLACK
,
0.3f
,
0.4f
,
Color
.
WHITE
,
true
);
}
protected
GradientPaint
getAnotherObject
()
{
return
null
;
/* TODO: could not update property
return new GradientPaint(0.4f, 0.3f, Color.WHITE, 0.2f, 0.1f, Color.BLACK, false);*/
}
}
test/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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 4358979
* @summary Tests LinearGradientPaint encoding
* @author Sergey Malenkov
*/
import
java.awt.Color
;
import
java.awt.LinearGradientPaint
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.Point2D
;
import
static
java
.
awt
.
MultipleGradientPaint
.
ColorSpaceType
.
LINEAR_RGB
;
import
static
java
.
awt
.
MultipleGradientPaint
.
CycleMethod
.
REFLECT
;
public
final
class
java_awt_LinearGradientPaint
extends
AbstractTest
<
LinearGradientPaint
>
{
public
static
void
main
(
String
[]
args
)
{
new
java_awt_LinearGradientPaint
().
test
(
true
);
}
protected
LinearGradientPaint
getObject
()
{
float
[]
f
=
{
0.1f
,
0.2f
,
0.3f
,
0.4f
,
0.5f
,
0.6f
};
Color
[]
c
=
{
Color
.
BLUE
,
Color
.
GREEN
,
Color
.
RED
,
Color
.
BLUE
,
Color
.
GREEN
,
Color
.
RED
};
return
new
LinearGradientPaint
(
f
[
0
],
f
[
1
],
f
[
2
],
f
[
3
],
f
,
c
);
}
protected
LinearGradientPaint
getAnotherObject
()
{
return
null
;
/* TODO: could not update property
float[] f = { 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f };
Color[] c = { Color.RED, Color.GREEN, Color.BLUE, Color.RED, Color.GREEN, Color.BLUE };
return new LinearGradientPaint(
new Point2D.Float(f[0], f[1]),
new Point2D.Float(f[2], f[3]),
f, c, REFLECT, LINEAR_RGB,
new AffineTransform(f));*/
}
}
test/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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 4358979
* @summary Tests RadialGradientPaint encoding
* @author Sergey Malenkov
*/
import
java.awt.Color
;
import
java.awt.RadialGradientPaint
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.Point2D
;
import
static
java
.
awt
.
MultipleGradientPaint
.
ColorSpaceType
.
LINEAR_RGB
;
import
static
java
.
awt
.
MultipleGradientPaint
.
CycleMethod
.
REFLECT
;
public
final
class
java_awt_RadialGradientPaint
extends
AbstractTest
<
RadialGradientPaint
>
{
public
static
void
main
(
String
[]
args
)
{
new
java_awt_RadialGradientPaint
().
test
(
true
);
}
protected
RadialGradientPaint
getObject
()
{
float
[]
f
=
{
0.1f
,
0.2f
,
0.3f
,
0.4f
,
0.5f
,
0.6f
};
Color
[]
c
=
{
Color
.
BLUE
,
Color
.
GREEN
,
Color
.
RED
,
Color
.
BLUE
,
Color
.
GREEN
,
Color
.
RED
};
return
new
RadialGradientPaint
(
f
[
0
],
f
[
1
],
f
[
2
],
f
,
c
);
}
protected
RadialGradientPaint
getAnotherObject
()
{
return
null
;
/* TODO: could not update property
float[] f = { 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f };
Color[] c = { Color.RED, Color.GREEN, Color.BLUE, Color.RED, Color.GREEN, Color.BLUE };
return new RadialGradientPaint(
new Point2D.Float(f[0], f[1]), 100.0f,
new Point2D.Float(f[2], f[3]),
f, c, REFLECT, LINEAR_RGB,
new AffineTransform(f));*/
}
}
test/java/beans/XMLEncoder/java_awt_geom_AffineTransform.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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 4358979
* @summary Tests AffineTransform encoding
* @author Sergey Malenkov
*/
import
java.awt.geom.AffineTransform
;
public
final
class
java_awt_geom_AffineTransform
extends
AbstractTest
<
AffineTransform
>
{
public
static
void
main
(
String
[]
args
)
{
new
java_awt_geom_AffineTransform
().
test
(
true
);
}
protected
AffineTransform
getObject
()
{
return
new
AffineTransform
(
0.1f
,
0.2f
,
0.3f
,
0.4f
,
0.5f
,
0.6f
);
}
protected
AffineTransform
getAnotherObject
()
{
return
new
AffineTransform
(
0.4f
,
0.5f
,
0.6f
,
0.7f
,
0.8f
,
0.9f
);
}
}
test/java/beans/XMLEncoder/javax_swing_border_StrokeBorder.java
0 → 100644
浏览文件 @
f864700b
/*
* Copyright (c) 2010, 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 4358979
* @summary Tests StrokeBorder encoding
* @author Sergey Malenkov
*/
import
java.awt.BasicStroke
;
import
java.awt.Color
;
import
javax.swing.border.StrokeBorder
;
public
final
class
javax_swing_border_StrokeBorder
extends
AbstractTest
<
StrokeBorder
>
{
public
static
void
main
(
String
[]
args
)
{
new
javax_swing_border_StrokeBorder
().
test
(
true
);
}
protected
StrokeBorder
getObject
()
{
return
new
StrokeBorder
(
new
BasicStroke
(
0
),
Color
.
WHITE
);
}
protected
StrokeBorder
getAnotherObject
()
{
return
null
;
// TODO: could not update property
//return new StrokeBorder(new BasicStroke(1));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录