提交 245b51e4 编写于 作者: L lana

Merge

......@@ -190,3 +190,5 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63
4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66
ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67
53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68
a8012d8d7e9c5035de0bdd4887dc9f7c54008f21 jdk8-b69
a996b57e554198f4592a5f3c30f2f9f4075e545d jdk8-b70
......@@ -90,14 +90,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
ARFLAGS:=$(ARFLAGS),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
else
#
# On macosx they do partial (incremental) linking of fdlibm
# code it here...rather than add support to NativeCompilation
# as this is firt time I see it
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
# On macosx the old build does partial (incremental) linking of fdlibm instead of
# a plain static library.
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC,\
LIBRARY:=fdlibm,\
OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
SRC:=$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src,\
......@@ -107,11 +104,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
LDFLAGS:=-nostdlib -r -arch x86_64,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
$(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM)
BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC)
$(CP) -a $< $@
BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
endif
BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
##########################################################################################
......
......@@ -812,9 +812,8 @@ EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
$(JAVA) \
-Xbootclasspath/a:$(JDK_OUTPUTDIR)/classes \
$(JAVAC_JARS) \
$(JAVA) $(JAVAC_JARS) \
-bootclasspath $(JDK_OUTPUTDIR)/classes \
-XDprocess.packages -proc:only \
-processor com.sun.tools.javac.sym.CreateSymbols \
-Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \
......
......@@ -119,7 +119,9 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void handleWindowFocusEvent(boolean parentWindowActive) {
this.parentWindowActive = parentWindowActive;
if (focused) {
// ignore focus "lost" native request as it may mistakenly
// deactivate active window (see 8001161)
if (focused && parentWindowActive) {
responder.handleWindowFocusEvent(parentWindowActive, null);
}
}
......
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008, 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
......@@ -16,9 +16,9 @@
* 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.
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import <JavaNativeFoundation/JavaNativeFoundation.h>
......
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, 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
......@@ -58,7 +58,8 @@ import sun.reflect.misc.*;
*/
public class DefaultPersistenceDelegate extends PersistenceDelegate {
private String[] constructor;
private static final String[] EMPTY = {};
private final String[] constructor;
private Boolean definesEquals;
/**
......@@ -67,7 +68,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
* @see #DefaultPersistenceDelegate(java.lang.String[])
*/
public DefaultPersistenceDelegate() {
this(new String[0]);
this.constructor = EMPTY;
}
/**
......@@ -92,7 +93,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
* @see #instantiate
*/
public DefaultPersistenceDelegate(String[] constructorPropertyNames) {
this.constructor = constructorPropertyNames;
this.constructor = (constructorPropertyNames == null) ? EMPTY : constructorPropertyNames.clone();
}
private static boolean definesEquals(Class<?> type) {
......
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
......@@ -277,7 +277,9 @@ public class EventSetDescriptor extends FeatureDescriptor {
Method removeListenerMethod)
throws IntrospectionException {
setName(eventSetName);
this.listenerMethodDescriptors = listenerMethodDescriptors;
this.listenerMethodDescriptors = (listenerMethodDescriptors != null)
? listenerMethodDescriptors.clone()
: null;
setAddListenerMethod(addListenerMethod);
setRemoveListenerMethod(removeListenerMethod);
setListenerType(listenerType);
......@@ -347,7 +349,9 @@ public class EventSetDescriptor extends FeatureDescriptor {
* events are fired.
*/
public synchronized MethodDescriptor[] getListenerMethodDescriptors() {
return listenerMethodDescriptors;
return (this.listenerMethodDescriptors != null)
? this.listenerMethodDescriptors.clone()
: null;
}
/**
......
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
......@@ -70,7 +70,9 @@ public class MethodDescriptor extends FeatureDescriptor {
ParameterDescriptor parameterDescriptors[]) {
setName(method.getName());
setMethod(method);
this.parameterDescriptors = parameterDescriptors;
this.parameterDescriptors = (parameterDescriptors != null)
? parameterDescriptors.clone()
: null;
}
/**
......@@ -161,7 +163,9 @@ public class MethodDescriptor extends FeatureDescriptor {
* a null array if the parameter names aren't known.
*/
public ParameterDescriptor[] getParameterDescriptors() {
return parameterDescriptors;
return (this.parameterDescriptors != null)
? this.parameterDescriptors.clone()
: null;
}
/*
......
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, 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
......@@ -92,7 +92,7 @@ public class Statement {
public Statement(Object target, String methodName, Object[] arguments) {
this.target = target;
this.methodName = methodName;
this.arguments = (arguments == null) ? emptyArray : arguments;
this.arguments = (arguments == null) ? emptyArray : arguments.clone();
}
/**
......@@ -128,7 +128,7 @@ public class Statement {
* @return the array of arguments
*/
public Object[] getArguments() {
return arguments;
return this.arguments.clone();
}
/**
......
......@@ -295,9 +295,6 @@ class InvokerBytecodeGenerator {
String invokerDesc = invokerType.toMethodDescriptorString();
mv = cw.visitMethod(Opcodes.ACC_STATIC, invokerName, invokerDesc, null, null);
// Force inlining of this invoker method.
mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
}
/**
......@@ -524,6 +521,9 @@ class InvokerBytecodeGenerator {
// Mark this method as a compiled LambdaForm
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
// Force inlining of this invoker method.
mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
// iterate over the form's names, generating bytecode instructions for each
// start iterating at the first name following the arguments
for (int i = lambdaForm.arity; i < lambdaForm.names.length; i++) {
......@@ -943,6 +943,9 @@ class InvokerBytecodeGenerator {
// Suppress this method in backtraces displayed to the user.
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Don't inline the interpreter entry.
mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
// create parameter array
emitIconstInsn(invokerType.parameterCount());
mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
......@@ -1005,6 +1008,9 @@ class InvokerBytecodeGenerator {
// Suppress this method in backtraces displayed to the user.
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Force inlining of this invoker method.
mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
// Load receiver
emitAloadInsn(0);
......
......@@ -592,6 +592,7 @@ class LambdaForm {
private int invocationCounter = 0;
@Hidden
@DontInline
/** Interpretively invoke this form on the given arguments. */
Object interpretWithArguments(Object... argumentValues) throws Throwable {
if (TRACE_INTERPRETER)
......@@ -606,6 +607,7 @@ class LambdaForm {
}
@Hidden
@DontInline
/** Evaluate a single Name within this form, applying its function to its arguments. */
Object interpretName(Name name, Object[] values) throws Throwable {
if (TRACE_INTERPRETER)
......
......@@ -310,9 +310,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
}
static class AsVarargsCollector extends MethodHandle {
MethodHandle target;
final Class<?> arrayType;
MethodHandle cache;
private final MethodHandle target;
private final Class<?> arrayType;
private MethodHandle cache;
AsVarargsCollector(MethodHandle target, MethodType type, Class<?> arrayType) {
super(type, reinvokerForm(type));
......
......@@ -28,7 +28,7 @@ formatVersion=1
# Version of the currency code information in this class.
# It is a serial number that accompanies with each amendment.
dataVersion=153
dataVersion=154
# List of all valid ISO 4217 currency codes.
# To ensure compatibility, do not remove codes.
......@@ -52,7 +52,8 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036
TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-\
UYU858-UZS860-VEB862-VEF937-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\
XBB956-XBC957-XBD958-XCD951-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\
XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZWD716-ZWL932-ZWN942-ZWR935
XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZMW967-ZWD716-ZWL932-\
ZWN942-ZWR935
# Mappings from ISO 3166 country codes to ISO 4217 currency codes.
......@@ -573,7 +574,7 @@ EH=MAD
# YEMEN
YE=YER
# ZAMBIA
ZM=ZMK
ZM=ZMW
# ZIMBABWE
ZW=ZWL
......
......@@ -473,7 +473,7 @@ class LocaleISOData {
+ "YE" + "YEM" // Yemen
+ "YT" + "MYT" // Mayotte
+ "ZA" + "ZAF" // South Africa, Republic of
+ "ZM" + "ZMB" // Zambia, Republic of
+ "ZM" + "ZMW" // Zambia, Republic of
+ "ZW" + "ZWE" // Zimbabwe
;
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......
......@@ -449,8 +449,16 @@ public class ValueConversions {
* @param x an arbitrary reference value
* @return the same value x
*/
@SuppressWarnings("unchecked")
static <T,U> T castReference(Class<? extends T> t, U x) {
return t.cast(x);
// inlined Class.cast because we can't ForceInline it
if (x != null && !t.isInstance(x))
throw newClassCastException(t, x);
return (T) x;
}
private static ClassCastException newClassCastException(Class<?> t, Object obj) {
return new ClassCastException("Cannot cast " + obj.getClass().getName() + " to " + t.getName());
}
private static final MethodHandle IDENTITY, CAST_REFERENCE, ZERO_OBJECT, IGNORE, EMPTY,
......
......@@ -53,7 +53,9 @@ public class LCMS implements PCMM {
public static native long getProfileID(ICC_Profile profile);
public static native long createNativeTransform(
long[] profileIDs, int renderType, int inFormatter, int outFormatter,
long[] profileIDs, int renderType,
int inFormatter, boolean isInIntPacked,
int outFormatter, boolean isOutIntPacked,
Object disposerRef);
/**
......
......@@ -196,7 +196,8 @@ class LCMSImageLayout {
case BufferedImage.TYPE_4BYTE_ABGR:
byteRaster = (ByteComponentRaster)image.getRaster();
nextRowOffset = byteRaster.getScanlineStride();
offset = byteRaster.getDataOffset(0);
int firstBand = image.getSampleModel().getNumBands() - 1;
offset = byteRaster.getDataOffset(firstBand);
dataArray = byteRaster.getDataStorage();
dataType = DT_BYTE;
break;
......
......@@ -55,8 +55,10 @@ import sun.java2d.cmm.lcms.*;
public class LCMSTransform implements ColorTransform {
long ID;
private int inFormatter;
private int outFormatter;
private int inFormatter = 0;
private boolean isInIntPacked = false;
private int outFormatter = 0;
private boolean isOutIntPacked = false;
ICC_Profile[] profiles;
long [] profileIDs;
......@@ -135,18 +137,23 @@ public class LCMSTransform implements ColorTransform {
LCMSImageLayout out) {
// update native transfrom if needed
if (ID == 0L ||
inFormatter != in.pixelType ||
outFormatter != out.pixelType) {
inFormatter != in.pixelType || isInIntPacked != in.isIntPacked ||
outFormatter != out.pixelType || isOutIntPacked != out.isIntPacked)
{
if (ID != 0L) {
// Disposer will destroy forgotten transform
disposerReferent = new Object();
}
inFormatter = in.pixelType;
isInIntPacked = in.isIntPacked;
outFormatter = out.pixelType;
isOutIntPacked = out.isIntPacked;
ID = LCMS.createNativeTransform(profileIDs, renderType,
inFormatter, outFormatter,
inFormatter, isInIntPacked,
outFormatter, isOutIntPacked,
disposerReferent);
}
......
/*
* Copyright (c) 2008, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2011, 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
......
......@@ -1008,4 +1008,125 @@ public final class Unsafe {
* if the load average is unobtainable.
*/
public native int getLoadAverage(double[] loadavg, int nelems);
// The following contain CAS-based Java implementations used on
// platforms not supporting native instructions
/**
* Atomically adds the given value to the current value of a field
* or array element within the given object <code>o</code>
* at the given <code>offset</code>.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
* @param delta the value to add
* @return the previous value
* @since 1.8
*/
public final int getAndAddInt(Object o, long offset, int delta) {
int v;
do {
v = getIntVolatile(o, offset);
} while (!compareAndSwapInt(o, offset, v, v + delta));
return v;
}
/**
* Atomically adds the given value to the current value of a field
* or array element within the given object <code>o</code>
* at the given <code>offset</code>.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
* @param delta the value to add
* @return the previous value
* @since 1.8
*/
public final long getAndAddLong(Object o, long offset, long delta) {
long v;
do {
v = getLongVolatile(o, offset);
} while (!compareAndSwapLong(o, offset, v, v + delta));
return v;
}
/**
* Atomically exchanges the given value with the current value of
* a field or array element within the given object <code>o</code>
* at the given <code>offset</code>.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
* @param newValue new value
* @return the previous value
* @since 1.8
*/
public final int getAndSetInt(Object o, long offset, int newValue) {
int v;
do {
v = getIntVolatile(o, offset);
} while (!compareAndSwapInt(o, offset, v, newValue));
return v;
}
/**
* Atomically exchanges the given value with the current value of
* a field or array element within the given object <code>o</code>
* at the given <code>offset</code>.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
* @param newValue new value
* @return the previous value
* @since 1.8
*/
public final long getAndSetLong(Object o, long offset, long newValue) {
long v;
do {
v = getLongVolatile(o, offset);
} while (!compareAndSwapLong(o, offset, v, newValue));
return v;
}
/**
* Atomically exchanges the given reference value with the current
* reference value of a field or array element within the given
* object <code>o</code> at the given <code>offset</code>.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
* @param newValue new value
* @return the previous value
* @since 1.8
*/
public final Object getAndSetObject(Object o, long offset, Object newValue) {
Object v;
do {
v = getObjectVolatile(o, offset);
} while (!compareAndSwapObject(o, offset, v, newValue));
return v;
}
/**
* Ensures lack of reordering of loads before the fence
* with loads or stores after the fence.
* @since 1.8
*/
public native void loadFence();
/**
* Ensures lack of reordering of stores before the fence
* with loads or stores after the fence.
* @since 1.8
*/
public native void storeFence();
/**
* Ensures lack of reordering of loads or stores before the fence
* with loads or stores after the fence.
* @since 1.8
*/
public native void fullFence();
}
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*com.sun.tools.attach.AttachNotSupportedException
*
* 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
......
......@@ -278,6 +278,7 @@ YER=YER
YUM=YUM
ZAR=ZAR
ZMK=ZMK
ZMW=ZMW
ZWD=ZWD
ZWL=ZWL
ZWN=ZWN
......
......@@ -49,7 +49,7 @@
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac debug="false" source="1.2" target="1.2" srcdir="${src}" destdir="${build}"/>
<javac debug="flase" source="1.5" target="1.5" srcdir="${src}" destdir="${build}"/>
</target>
<target name="run" depends="dist"
......
......@@ -69,6 +69,7 @@ import j2dbench.tests.MiscTests;
import j2dbench.tests.RenderTests;
import j2dbench.tests.PixelTests;
import j2dbench.tests.iio.IIOTests;
import j2dbench.tests.cmm.CMMTests;
import j2dbench.tests.text.TextConstructionTests;
import j2dbench.tests.text.TextMeasureTests;
import j2dbench.tests.text.TextRenderTests;
......@@ -199,6 +200,7 @@ public class J2DBench {
TextMeasureTests.init();
TextConstructionTests.init();
IIOTests.init();
CMMTests.init();
boolean gui = true;
boolean showresults = true;
......
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
package j2dbench.tests.cmm;
import j2dbench.Group;
import j2dbench.Option;
import j2dbench.Result;
import j2dbench.Test;
import j2dbench.TestEnvironment;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
import java.io.IOException;
import java.io.InputStream;
public class CMMTests extends Test {
protected static Group cmmRoot;
protected static Group cmmOptRoot;
protected static Option csList;
protected static Option usePlatfromProfiles;
public static void init() {
cmmRoot = new Group("cmm", "Color Management Benchmarks");
cmmRoot.setTabbed();
cmmOptRoot = new Group(cmmRoot, "opts", "General Options");
/*
usePlatfromProfiles =
new Option.Enable(cmmOptRoot, "csPlatfrom",
"Use Platfrom Profiles", false);
*/
int[] colorspaces = new int[] {
ColorSpace.CS_sRGB,
ColorSpace.CS_GRAY,
ColorSpace.CS_LINEAR_RGB,
ColorSpace.CS_CIEXYZ
};
String[] csNames = new String[]{
"CS_sRGB",
"CS_GRAY",
"CS_LINEAR_RGB",
"CS_CIEXYZ"
};
csList = new Option.IntList(cmmOptRoot,
"profiles", "Color Profiles",
colorspaces, csNames, csNames, 0x8);
ColorConversionTests.init();
ProfileTests.init();
}
protected static ColorSpace getColorSpace(TestEnvironment env) {
ColorSpace cs;
Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);
int cs_code = env.getIntValue(csList);
if (usePlatfrom) {
cs = ColorSpace.getInstance(cs_code);
} else {
String resource = "profiles/";
switch (cs_code) {
case ColorSpace.CS_CIEXYZ:
resource += "CIEXYZ.pf";
break;
case ColorSpace.CS_GRAY:
resource += "GRAY.pf";
break;
case ColorSpace.CS_LINEAR_RGB:
resource += "LINEAR_RGB.pf";
break;
case ColorSpace.CS_PYCC:
resource += "PYCC.pf";
break;
case ColorSpace.CS_sRGB:
resource += "sRGB.pf";
break;
default:
throw new RuntimeException("Unknown color space: " + cs_code);
}
try {
InputStream is = CMMTests.class.getResourceAsStream(resource);
ICC_Profile p = ICC_Profile.getInstance(is);
cs = new ICC_ColorSpace(p);
} catch (IOException e) {
throw new RuntimeException("Unable load profile from resource " + resource, e);
}
}
return cs;
}
protected CMMTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
addDependencies(cmmOptRoot, true);
}
@Override
public Object initTest(TestEnvironment te, Result result) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void runTest(Object o, int i) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void cleanupTest(TestEnvironment te, Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
package j2dbench.tests.cmm;
import j2dbench.Group;
public class ColorConversionTests extends CMMTests {
protected static Group colorConvRoot;
public static void init() {
colorConvRoot = new Group(cmmRoot, "colorconv", "Color Conversion Benchmarks");
colorConvRoot.setTabbed();
DataConversionTests.init();
ColorConvertOpTests.init();
}
protected ColorConversionTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
}
}
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
package j2dbench.tests.cmm;
import j2dbench.Group;
import j2dbench.Option;
import j2dbench.Result;
import j2dbench.TestEnvironment;
import j2dbench.tests.iio.IIOTests;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import javax.imageio.ImageIO;
public class ColorConvertOpTests extends ColorConversionTests {
private static enum ImageContent {
BLANK("bank", "Blank (opaque black)"),
RANDOM("random", "Random"),
VECTOR("vector", "Vector Art"),
PHOTO("photo", "Photograph");
public final String name;
public final String descr;
private ImageContent(String name, String descr) {
this.name = name;
this.descr = descr;
}
}
private static enum ImageType {
INT_ARGB(BufferedImage.TYPE_INT_ARGB, "INT_ARGB", "TYPE_INT_ARGB"),
INT_RGB(BufferedImage.TYPE_INT_RGB, "INT_RGB", "TYPE_INT_RGB"),
INT_BGR(BufferedImage.TYPE_INT_BGR, "INT_BGR", "TYPE_INT_BGR"),
BYTE_3BYTE_BGR(BufferedImage.TYPE_3BYTE_BGR, "3BYTE_BGR", "TYPE_3BYTE_BGR"),
BYTE_4BYTE_ABGR(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_BGR", "TYPE_4BYTE_BGR"),
COMPATIBLE_DST(0, "Compatible", "Compatible destination");
private ImageType(int type, String abbr, String descr) {
this.type = type;
this.abbrev = abbr;
this.descr = descr;
}
public final int type;
public final String abbrev;
public final String descr;
}
private static enum ListType {
SRC("srcType", "Source Images"),
DST("dstType", "Destination Images");
private ListType(String name, String description) {
this.name = name;
this.description = description;
}
public final String name;
public final String description;
}
public static Option createImageTypeList(ListType listType) {
ImageType[] allTypes = ImageType.values();
int num = allTypes.length;
if (listType == ListType.SRC) {
num -= 1; // exclude compatible destination
}
ImageType[] t = new ImageType[num];
String[] names = new String[num];
String[] abbrev = new String[num];
String[] descr = new String[num];
for (int i = 0; i < num; i++) {
t[i] = allTypes[i];
names[i] = t[i].toString();
abbrev[i] = t[i].abbrev;
descr[i] = t[i].descr;
}
Option list = new Option.ObjectList(opOptionsRoot,
listType.name, listType.description,
names, t, abbrev, descr, 1);
return list;
}
protected static Group opConvRoot;
protected static Group opOptionsRoot;
protected static Option sizeList;
protected static Option contentList;
protected static Option sourceType;
protected static Option destinationType;
public static void init() {
opConvRoot = new Group(colorConvRoot, "ccop", "ColorConvertOp Tests");
opOptionsRoot = new Group(opConvRoot, "ccopOptions", "Options");
// size list
int[] sizes = new int[] {1, 20, 250, 1000, 4000};
String[] sizeStrs = new String[] {
"1x1", "20x20", "250x250", "1000x1000", "4000x4000"
};
String[] sizeDescs = new String[] {
"Tiny Images (1x1)",
"Small Images (20x20)",
"Medium Images (250x250)",
"Large Images (1000x1000)",
"Huge Images (4000x4000)",
};
sizeList = new Option.IntList(opOptionsRoot,
"size", "Image Size",
sizes, sizeStrs, sizeDescs, 0x4);
((Option.ObjectList) sizeList).setNumRows(5);
// image content
ImageContent[] c = ImageContent.values();
String[] contentStrs = new String[c.length];
String[] contentDescs = new String[c.length];
for (int i = 0; i < c.length; i++) {
contentStrs[i] = c[i].name;
contentDescs[i] = c[i].descr;
};
contentList = new Option.ObjectList(opOptionsRoot,
"content", "Image Content",
contentStrs, c,
contentStrs, contentDescs,
0x8);
sourceType = createImageTypeList(ListType.SRC);
destinationType = createImageTypeList(ListType.DST);
new ConvertImageTest();
new ConvertRasterTest();
new DrawImageTest();
}
public ColorConvertOpTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
addDependencies(opOptionsRoot, true);
}
public Object initTest(TestEnvironment env, Result res) {
return new Context(env, res);
}
public void cleanupTest(TestEnvironment env, Object o) {
Context ctx = (Context)o;
ctx.cs = null;
ctx.op_img = null;
ctx.op_rst = null;
ctx.dst = null;
ctx.src = null;
ctx.graphics = null;
}
private static class Context {
ColorSpace cs;
Graphics2D graphics;
ColorConvertOp op_img;
ColorConvertOp op_rst;
BufferedImage src;
BufferedImage dst;
WritableRaster rsrc;
WritableRaster rdst;
public Context(TestEnvironment env, Result res) {
graphics = (Graphics2D)env.getGraphics();
cs = getColorSpace(env);
// TODO: provide rendering hints
op_img = new ColorConvertOp(cs, null);
ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);
op_rst = new ColorConvertOp(sRGB, cs, null);
int size = env.getIntValue(sizeList);
ImageContent content = (ImageContent)env.getModifier(contentList);
ImageType srcType = (ImageType)env.getModifier(sourceType);
src = createBufferedImage(size, size, content, srcType.type);
rsrc = src.getRaster();
ImageType dstType = (ImageType)env.getModifier(destinationType);
if (dstType == ImageType.COMPATIBLE_DST) {
dst = op_img.createCompatibleDestImage(src, null);
} else {
dst = createBufferedImage(size, size, content, dstType.type);
}
// raster always has to be comatible
rdst = op_rst.createCompatibleDestRaster(rsrc);
}
}
private static class ConvertImageTest extends ColorConvertOpTests {
public ConvertImageTest() {
super(opConvRoot, "op_img", "op.filetr(BufferedImage)");
}
public void runTest(Object octx, int numReps) {
final Context ctx = (Context)octx;
final ColorConvertOp op = ctx.op_img;
final BufferedImage src = ctx.src;
BufferedImage dst = ctx.dst;
do {
try {
dst = op.filter(src, dst);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
private static class ConvertRasterTest extends ColorConvertOpTests {
public ConvertRasterTest() {
super(opConvRoot, "op_rst", "op.filetr(Raster)");
}
public void runTest(Object octx, int numReps) {
final Context ctx = (Context)octx;
final ColorConvertOp op = ctx.op_rst;
final Raster src = ctx.rsrc;
WritableRaster dst = ctx.rdst;
do {
try {
dst = op.filter(src, dst);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
private static class DrawImageTest extends ColorConvertOpTests {
public DrawImageTest() {
super(opConvRoot, "op_draw", "drawImage(ColorConvertOp)");
}
public void runTest(Object octx, int numReps) {
final Context ctx = (Context)octx;
final ColorConvertOp op = ctx.op_img;
final Graphics2D g = ctx.graphics;
final BufferedImage src = ctx.src;
do {
g.drawImage(src, op, 0, 0);
} while (--numReps >= 0);
}
}
/**************************************************************************
****** Helper routines
*************************************************************************/
protected static BufferedImage createBufferedImage(int width,
int height,
ImageContent contentType,
int type)
{
BufferedImage image;
image = new BufferedImage(width, height, type);
boolean hasAlpha = image.getColorModel().hasAlpha();
switch (contentType) {
case RANDOM:
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int rgb = (int)(Math.random() * 0xffffff);
if (hasAlpha) {
rgb |= 0x7f000000;
}
image.setRGB(x, y, rgb);
}
}
break;
case VECTOR:
{
Graphics2D g = image.createGraphics();
if (hasAlpha) {
// fill background with a translucent color
g.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC, 0.5f));
}
g.setColor(Color.blue);
g.fillRect(0, 0, width, height);
g.setComposite(AlphaComposite.Src);
g.setColor(Color.yellow);
g.fillOval(2, 2, width-4, height-4);
g.setColor(Color.red);
g.fillOval(4, 4, width-8, height-8);
g.setColor(Color.green);
g.fillRect(8, 8, width-16, height-16);
g.setColor(Color.white);
g.drawLine(0, 0, width, height);
g.drawLine(0, height, width, 0);
g.dispose();
break;
}
case PHOTO:
{
Image photo = null;
try {
photo = ImageIO.read(
IIOTests.class.getResourceAsStream("images/photo.jpg"));
} catch (Exception e) {
System.err.println("error loading photo");
e.printStackTrace();
}
Graphics2D g = image.createGraphics();
if (hasAlpha) {
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC,
0.5f));
}
g.drawImage(photo, 0, 0, width, height, null);
g.dispose();
break;
}
default:
break;
}
return image;
}
}
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
package j2dbench.tests.cmm;
import j2dbench.Group;
import j2dbench.Result;
import j2dbench.TestEnvironment;
import java.awt.color.ColorSpace;
public class DataConversionTests extends ColorConversionTests {
protected static Group dataConvRoot;
public static void init() {
dataConvRoot = new Group(colorConvRoot, "data", "Data Conversoion Tests");
new FromRGBTest();
new ToRGBTest();
new FromCIEXYZTest();
new ToCIEXYZTest();
}
public DataConversionTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
}
protected static class Context {
ColorSpace cs;
int numComponents;
float[] val;
float[] rgb;
float[] cie;
TestEnvironment env;
Result res;
public Context(TestEnvironment env, Result result, ColorSpace cs) {
this.cs = cs;
this.env = env;
this.res = result;
numComponents = cs.getNumComponents();
val = new float[numComponents];
for (int i = 0; i < numComponents; i++) {
float min = cs.getMinValue(i);
float max = cs.getMaxValue(i);
val[i] = 0.5f * (max - min);
}
rgb = new float[]{0.5f, 0.5f, 0.5f};
cie = new float[]{0.5f, 0.5f, 0.5f};
}
}
@Override
public Object initTest(TestEnvironment env, Result result) {
ColorSpace cs = getColorSpace(env);
return new Context(env, result, cs);
}
@Override
public void cleanupTest(TestEnvironment te, Object o) {
}
private static class FromRGBTest extends DataConversionTests {
public FromRGBTest() {
super(dataConvRoot,
"fromRGB",
"ColorSpace.fromRGB()");
}
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ColorSpace cs = ictx.cs;
final float[] rgb = ictx.rgb;
do {
try {
cs.fromRGB(rgb);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
private static class FromCIEXYZTest extends DataConversionTests {
public FromCIEXYZTest() {
super(dataConvRoot,
"fromCIEXYZ",
"ColorSpace.fromCIEXYZ()");
}
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ColorSpace cs = ictx.cs;
final float[] val = ictx.cie;
do {
try {
cs.fromCIEXYZ(val);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
private static class ToCIEXYZTest extends DataConversionTests {
public ToCIEXYZTest() {
super(dataConvRoot,
"toCIEXYZ",
"ColorSpace.toCIEXYZ()");
}
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ColorSpace cs = ictx.cs;
final float[] val = ictx.val;
do {
try {
cs.toCIEXYZ(val);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
private static class ToRGBTest extends DataConversionTests {
public ToRGBTest() {
super(dataConvRoot,
"toRGB",
"ColorSpace.toRGB()");
}
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ColorSpace cs = ictx.cs;
final float[] val = ictx.val;
do {
try {
cs.toRGB(val);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
}
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
package j2dbench.tests.cmm;
import j2dbench.Group;
import j2dbench.Result;
import j2dbench.TestEnvironment;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
public class ProfileTests extends CMMTests {
protected static Group profileRoot;
public static void init() {
profileRoot = new Group(cmmRoot, "profiles", "Profile Handling Benchmarks");
new ReadHeaderTest();
new GetNumComponentsTest();
}
protected ProfileTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
}
protected static class Context {
ICC_Profile profile;
TestEnvironment env;
Result res;
public Context(ICC_Profile profile, TestEnvironment env, Result res) {
this.profile = profile;
this.env = env;
this.res = res;
}
}
@Override
public Object initTest(TestEnvironment env, Result res) {
ICC_ColorSpace cs = (ICC_ColorSpace) getColorSpace(env);
return new Context(cs.getProfile(), env, res);
}
@Override
public void cleanupTest(TestEnvironment env, Object o) {
}
private static class ReadHeaderTest extends ProfileTests {
public ReadHeaderTest() {
super(profileRoot,
"getHeader",
"getData(icSigHead)");
}
@Override
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ICC_Profile profile = ictx.profile;
byte[] data = null;
do {
try {
data = profile.getData(ICC_Profile.icSigHead);
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
private static class GetNumComponentsTest extends ProfileTests {
public GetNumComponentsTest() {
super(profileRoot,
"getNumComponents",
"getNumComponents");
}
@Override
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ICC_Profile profile = ictx.profile;
do {
try {
int num = profile.getNumComponents();
} catch (Exception e) {
e.printStackTrace();
}
} while (--numReps >= 0);
}
}
}
/* 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
* under the terms of the GNU General Public License version 2 only, as
......
......@@ -159,7 +159,8 @@ void LCMS_freeTransform(JNIEnv *env, jlong ID)
*/
JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
(JNIEnv *env, jclass cls, jlongArray profileIDs, jint renderType,
jint inFormatter, jint outFormatter, jobject disposerRef)
jint inFormatter, jboolean isInIntPacked,
jint outFormatter, jboolean isOutIntPacked, jobject disposerRef)
{
cmsHPROFILE _iccArray[DF_ICC_BUF_SIZE];
cmsHPROFILE *iccArray = &_iccArray[0];
......@@ -170,6 +171,16 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
size = (*env)->GetArrayLength (env, profileIDs);
ids = (*env)->GetPrimitiveArrayCritical(env, profileIDs, 0);
#ifdef _LITTLE_ENDIAN
/* Reversing data packed into int for LE archs */
if (isInIntPacked) {
inFormatter ^= DOSWAP_SH(1);
}
if (isOutIntPacked) {
outFormatter ^= DOSWAP_SH(1);
}
#endif
if (DF_ICC_BUF_SIZE < size*2) {
iccArray = (cmsHPROFILE*) malloc(
size*2*sizeof(cmsHPROFILE));
......@@ -567,7 +578,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
(JNIEnv *env, jclass obj, jobject trans, jobject src, jobject dst)
{
storeID_t sTrans;
int inFmt, outFmt, srcDType, dstDType;
int srcDType, dstDType;
int srcOffset, srcNextRowOffset, dstOffset, dstNextRowOffset;
int width, height, i;
void* inputBuffer;
......@@ -576,23 +587,13 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
char* outputRow;
jobject srcData, dstData;
inFmt = (*env)->GetIntField (env, src, IL_pixelType_fID);
outFmt = (*env)->GetIntField (env, dst, IL_pixelType_fID);
srcOffset = (*env)->GetIntField (env, src, IL_offset_fID);
srcNextRowOffset = (*env)->GetIntField (env, src, IL_nextRowOffset_fID);
dstOffset = (*env)->GetIntField (env, dst, IL_offset_fID);
dstNextRowOffset = (*env)->GetIntField (env, dst, IL_nextRowOffset_fID);
width = (*env)->GetIntField (env, src, IL_width_fID);
height = (*env)->GetIntField (env, src, IL_height_fID);
#ifdef _LITTLE_ENDIAN
/* Reversing data packed into int for LE archs */
if ((*env)->GetBooleanField (env, src, IL_isIntPacked_fID) == JNI_TRUE) {
inFmt ^= DOSWAP_SH(1);
}
if ((*env)->GetBooleanField (env, dst, IL_isIntPacked_fID) == JNI_TRUE) {
outFmt ^= DOSWAP_SH(1);
}
#endif
sTrans.j = (*env)->GetLongField (env, trans, Trans_ID_fID);
if (sTrans.xf == NULL) {
......
......@@ -994,10 +994,7 @@ public class XBaseWindow {
return;
}
int buttonState = 0;
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i<buttonsNumber; i++){
buttonState |= (xbe.get_state() & XConstants.buttonsMask[i]);
}
buttonState = xbe.get_state() & XConstants.ALL_BUTTONS_MASK;
switch (xev.get_type()) {
case XConstants.ButtonPress:
if (buttonState == 0) {
......@@ -1034,12 +1031,12 @@ public class XBaseWindow {
* Checks ButtonRelease released all Mouse buttons
*/
static boolean isFullRelease(int buttonState, int button) {
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
final int buttonsNumber = XToolkit.getNumberOfButtonsForMask();
if (button < 0 || button > buttonsNumber) {
return buttonState == 0;
} else {
return buttonState == XConstants.buttonsMask[button - 1];
return buttonState == XlibUtil.getButtonMask(button);
}
}
......
......@@ -130,6 +130,9 @@ final public class XConstants {
public static final long ColormapChangeMask = (1L<<23) ;
public static final long OwnerGrabButtonMask = (1L<<24) ;
public static final int MAX_BUTTONS = 5;
public static final int ALL_BUTTONS_MASK = (int) (Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask);
/* Event names. Used in "type" field in XEvent structures. Not to be
confused with event masks above. They start from 2 because 0 and 1
are reserved in the protocol for errors and replies. */
......@@ -194,34 +197,6 @@ final public class XConstants {
public static final int Mod4MapIndex = 6 ;
public static final int Mod5MapIndex = 7 ;
/* button masks. Used in same manner as Key masks above. Not to be confused
with button names below. */
public static final int [] buttonsMask = new int []{ 1<<8,
1<<9,
1<<10,
1<<11,
1<<12,
1<<13,
1<<14,
1<<15,
1<<16,
1<<17,
1<<18,
1<<19,
1<<20,
1<<21,
1<<22,
1<<23,
1<<24,
1<<25,
1<<26,
1<<27,
1<<28,
1<<29,
1<<30,
1<<31 };
public static final int AnyModifier = (1<<15) ; /* used in GrabButton, GrabKey */
......
......@@ -1543,6 +1543,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
}
}
static int getNumberOfButtonsForMask() {
return Math.min(XConstants.MAX_BUTTONS, ((SunToolkit) (Toolkit.getDefaultToolkit())).getNumberOfButtons());
}
private final static String prefix = "DnD.Cursor.";
private final static String postfix = ".32x32";
private static final String dndPrefix = "DnD.";
......
......@@ -596,12 +596,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
/* this is an attempt to refactor button IDs in : MouseEvent, InputEvent, XlibWrapper and XWindow.*/
//reflects a button number similar to MouseEvent.BUTTON1, 2, 3 etc.
for (int i = 0; i < XConstants.buttonsMask.length; i ++){
for (int i = 0; i < XConstants.buttons.length; i ++){
//modifier should be added if :
// 1) current button is now still in PRESSED state (means that user just pressed mouse but not released yet) or
// 2) if Xsystem reports that "state" represents that button was just released. This only happens on RELEASE with 1,2,3 buttons.
// ONLY one of these conditions should be TRUE to add that modifier.
if (((state & XConstants.buttonsMask[i]) != 0) != (button == XConstants.buttons[i])){
if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){
//exclude wheel buttons from adding their numbers as modifiers
if (!wheel_mouse) {
modifiers |= InputEvent.getMaskForButton(i+1);
......@@ -689,7 +689,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
if (type == XConstants.ButtonPress) {
//Allow this mouse button to generate CLICK event on next ButtonRelease
mouseButtonClickAllowed |= XConstants.buttonsMask[lbutton];
mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton);
XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
/*
multiclick checking
......@@ -747,7 +747,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
postEventToEventQueue(me);
if ((type == XConstants.ButtonRelease) &&
((mouseButtonClickAllowed & XConstants.buttonsMask[lbutton]) != 0) ) // No up-button in the drag-state
((mouseButtonClickAllowed & XlibUtil.getButtonMask(lbutton)) != 0) ) // No up-button in the drag-state
{
postEventToEventQueue(me = new MouseEvent((Component)getEventSource(),
MouseEvent.MOUSE_CLICKED,
......@@ -777,7 +777,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
/* Update the state variable AFTER the CLICKED event post. */
if (type == XConstants.ButtonRelease) {
/* Exclude this mouse button from allowed list.*/
mouseButtonClickAllowed &= ~XConstants.buttonsMask[lbutton];
mouseButtonClickAllowed &= ~ XlibUtil.getButtonMask(lbutton);
}
}
......@@ -793,12 +793,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
//this doesn't work for extra buttons because Xsystem is sending state==0 for every extra button event.
// we can't correct it in MouseEvent class as we done it with modifiers, because exact type (DRAG|MOVE)
// should be passed from XWindow.
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
final int buttonsNumber = XToolkit.getNumberOfButtonsForMask();
for (int i = 0; i < buttonsNumber; i++){
// TODO : here is the bug in WM: extra buttons doesn't have state!=0 as they should.
if ((i != 4) && (i != 5)) {
mouseKeyState = mouseKeyState | (xme.get_state() & XConstants.buttonsMask[i]);
mouseKeyState = mouseKeyState | (xme.get_state() & XlibUtil.getButtonMask(i + 1));
}
}
......
......@@ -2070,12 +2070,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
if (isGrabbed()) {
boolean dragging = false;
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
final int buttonsNumber = XToolkit.getNumberOfButtonsForMask();
for (int i = 0; i < buttonsNumber; i++){
// here is the bug in WM: extra buttons doesn't have state!=0 as they should.
if ((i != 4) && (i != 5)){
dragging = dragging || ((xme.get_state() & XConstants.buttonsMask[i]) != 0);
dragging = dragging || ((xme.get_state() & XlibUtil.getButtonMask(i + 1)) != 0);
}
}
// When window is grabbed, all events are dispatched to
......
......@@ -396,4 +396,14 @@ public class XlibUtil
return isShapingSupported.booleanValue();
}
static int getButtonMask(int button) {
// Button indices start with 1. The first bit in the button mask is the 8th.
// The state mask does not support button indicies > 5, so we need to
// cut there.
if (button <= 0 || button > XConstants.MAX_BUTTONS) {
return 0;
} else {
return 1 << (7 + button);
}
}
}
/*
* Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
......
/*
* Copyright 2005, 2012, Oracle and/or its affiliates. All Rights Reserved.
* Copyright (c) 2005, 2012, 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. Sun designates this
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
* 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
......@@ -18,9 +18,9 @@
* 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.
* 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.
*/
#include "jni.h"
......
/*
* Copyright (c) 2007,2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2011, 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
......
/*
* Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
......
......@@ -147,6 +147,24 @@ AwtDebugSupport::~AwtDebugSupport() {
DTrace_Shutdown();
}
static jboolean isHeadless() {
jmethodID headlessFn;
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jclass graphicsEnvClass = env->FindClass(
"java/awt/GraphicsEnvironment");
if (graphicsEnvClass != NULL) {
headlessFn = env->GetStaticMethodID(
graphicsEnvClass, "isHeadless", "()Z");
if (headlessFn != NULL) {
return env->CallStaticBooleanMethod(graphicsEnvClass,
headlessFn);
}
}
return true;
}
void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int line) {
static const int ASSERT_MSG_SIZE = 1024;
static const char * AssertFmt =
......@@ -158,7 +176,8 @@ void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int l
static char assertMsg[ASSERT_MSG_SIZE+1];
DWORD lastError = GetLastError();
LPSTR msgBuffer = NULL;
int ret;
int ret = IDNO;
static jboolean headless = isHeadless();
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
......@@ -183,8 +202,11 @@ void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int l
fprintf(stderr, "*********************\n");
fprintf(stderr, "%s\n", assertMsg);
fprintf(stderr, "*********************\n");
ret = MessageBoxA(NULL, assertMsg, "AWT Assertion Failure",
MB_YESNO|MB_ICONSTOP|MB_TASKMODAL);
if (!headless) {
ret = MessageBoxA(NULL, assertMsg, "AWT Assertion Failure",
MB_YESNO|MB_ICONSTOP|MB_TASKMODAL);
}
// if clicked Yes, break into the debugger
if ( ret == IDYES ) {
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
#!/bin/sh
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 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
......
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 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
......
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 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
......
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 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
......
/**
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012, 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 8005065
* @summary Tests that all arrays in JavaBeans are guarded
* @author Sergey Malenkov
*/
import java.beans.DefaultPersistenceDelegate;
import java.beans.Encoder;
import java.beans.EventSetDescriptor;
import java.beans.ExceptionListener;
import java.beans.Expression;
import java.beans.Statement;
import java.beans.MethodDescriptor;
import java.beans.ParameterDescriptor;
public class Test8005065 {
public static void main(String[] args) {
testDefaultPersistenceDelegate();
testEventSetDescriptor();
testMethodDescriptor();
testStatement();
}
private static void testDefaultPersistenceDelegate() {
Encoder encoder = new Encoder();
String[] array = { "array" };
MyDPD dpd = new MyDPD(array);
dpd.instantiate(dpd, encoder);
array[0] = null;
dpd.instantiate(dpd, encoder);
}
private static void testEventSetDescriptor() {
try {
MethodDescriptor[] array = { new MethodDescriptor(MyDPD.class.getMethod("getArray")) };
EventSetDescriptor descriptor = new EventSetDescriptor(null, null, array, null, null);
test(descriptor.getListenerMethodDescriptors());
array[0] = null;
test(descriptor.getListenerMethodDescriptors());
descriptor.getListenerMethodDescriptors()[0] = null;
test(descriptor.getListenerMethodDescriptors());
}
catch (Exception exception) {
throw new Error("unexpected error", exception);
}
}
private static void testMethodDescriptor() {
try {
ParameterDescriptor[] array = { new ParameterDescriptor() };
MethodDescriptor descriptor = new MethodDescriptor(MyDPD.class.getMethod("getArray"), array);
test(descriptor.getParameterDescriptors());
array[0] = null;
test(descriptor.getParameterDescriptors());
descriptor.getParameterDescriptors()[0] = null;
test(descriptor.getParameterDescriptors());
}
catch (Exception exception) {
throw new Error("unexpected error", exception);
}
}
private static void testStatement() {
Object[] array = { new Object() };
Statement statement = new Statement(null, null, array);
test(statement.getArguments());
array[0] = null;
test(statement.getArguments());
statement.getArguments()[0] = null;
test(statement.getArguments());
}
private static <T> void test(T[] array) {
if (array.length != 1) {
throw new Error("unexpected array length");
}
if (array[0] == null) {
throw new Error("unexpected array content");
}
}
public static class MyDPD
extends DefaultPersistenceDelegate
implements ExceptionListener {
private final String[] array;
public MyDPD(String[] array) {
super(array);
this.array = array;
}
public Expression instantiate(Object instance, Encoder encoder) {
encoder.setExceptionListener(this);
return super.instantiate(instance, encoder);
}
public String[] getArray() {
return this.array;
}
public void exceptionThrown(Exception exception) {
throw new Error("unexpected error", exception);
}
}
}
......@@ -16,9 +16,9 @@
* 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.
* 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.
*/
/*
......
......@@ -16,9 +16,9 @@
* 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.
* 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.
*/
/*
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright 2009-2010 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2009, 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. Sun designates this
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
* 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
......@@ -18,9 +18,9 @@
* 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.
* 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 test.java.lang.invoke.remote;
......
/*
* Copyright (c) 2005, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2011, 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
......
/*
* Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2012, 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
......@@ -22,7 +22,7 @@
*/
/*
* @test
* @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203
* @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
* @summary Validate ISO 4217 data for Currency class.
*/
......@@ -92,7 +92,7 @@ public class ValidateISO4217 {
/* Codes that are obsolete, do not have related country */
static final String otherCodes =
"ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZWD-ZWN-ZWR";
"ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZMK-ZWD-ZWN-ZWR";
static boolean err = false;
......
#
#
# Amendments up until ISO 4217 AMENDMENT NUMBER 153
# (As of 12 January 2012)
# Amendments up until ISO 4217 AMENDMENT NUMBER 154
# (As of 31 August 2012)
#
# Version
FILEVERSION=1
DATAVERSION=153
DATAVERSION=154
# ISO 4217 currency data
AF AFN 971 2
......@@ -274,7 +274,7 @@ VI USD 840 2
WF XPF 953 0
EH MAD 504 2
YE YER 886 2
ZM ZMK 894 2
ZM ZMW 967 2
ZW ZWL 932 2
#XAU XAU 959
#XBA XBA 955
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2012, 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
......
/*
* Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2012, 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
......
/*
* Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2012, 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
......
/*
* Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2012, 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
......
......@@ -5,13 +5,13 @@
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
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
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).
......
......@@ -5,13 +5,13 @@
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
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
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).
......
......@@ -30,6 +30,7 @@
import java.io.*;
import javax.swing.*;
import javax.swing.plaf.metal.*;
public class bug7193219 {
private static byte[] serializeGUI() {
......@@ -73,6 +74,7 @@ public class bug7193219 {
}
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new MetalLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
<html>
<!--
Copyright (c) 2012, 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 4962534
@summary JFrame dances very badly
@author dav@sparc.spb.su area=
@run applet bug4962534.html
-->
<head>
<title> </title>
</head>
<body>
<h1>bug4962534<br>Bug ID: 4962534 </h1>
<p> This is an AUTOMATIC test, simply wait for completion </p>
<APPLET CODE="bug4962534.class" WIDTH=200 HEIGHT=200></APPLET>
</body>
</html>
/*
* Copyright (c) 2012, 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 4962534 7104594
@summary JFrame dances very badly
@author dav@sparc.spb.su area=
@run applet bug4962534.html
*/
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
import sun.awt.SunToolkit;
public class bug4962534 extends Applet {
Robot robot;
volatile Point framePosition;
volatile Point newFrameLocation;
JFrame frame;
Rectangle gcBounds;
Component titleComponent;
JLayeredPane lPane;
volatile boolean titleFound = false;
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
public static Object LOCK = new Object();
@Override
public void init() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
createAndShowGUI();
}
});
} catch (Exception ex) {
throw new RuntimeException("Init failed. " + ex.getMessage());
}
}//End init()
@Override
public void start() {
validate();
try {
setJLayeredPaneEDT();
setTitleComponentEDT();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException("Test failed. " + ex.getMessage());
}
if (!titleFound) {
throw new RuntimeException("Test Failed. Unable to determine title's size.");
}
Random r = new Random();
for (int iteration = 0; iteration < 10; iteration++) {
try {
setFramePosEDT();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException("Test failed.");
}
try {
robot = new Robot();
robot.setAutoDelay(70);
toolkit.realSync();
robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2,
framePosition.y + titleComponent.getHeight() / 2);
robot.mousePress(InputEvent.BUTTON1_MASK);
toolkit.realSync();
gcBounds =
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0].getConfigurations()[0].getBounds();
robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2,
framePosition.y + titleComponent.getHeight() / 2);
toolkit.realSync();
int multier = gcBounds.height / 2 - 10; //we will not go out the borders
for (int i = 0; i < 10; i++) {
robot.mouseMove(gcBounds.width / 2 - (int) (r.nextDouble() * multier), gcBounds.height / 2 - (int) (r.nextDouble() * multier));
}
robot.mouseRelease(InputEvent.BUTTON1_MASK);
toolkit.realSync();
} catch (AWTException e) {
throw new RuntimeException("Test Failed. AWTException thrown." + e.getMessage());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Test Failed.");
}
System.out.println("Mouse lies in " + MouseInfo.getPointerInfo().getLocation());
boolean frameIsOutOfScreen = false;
try {
setNewFrameLocationEDT();
System.out.println("Now Frame lies in " + newFrameLocation);
frameIsOutOfScreen = checkFrameIsOutOfScreenEDT();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException("Test Failed.");
}
if (frameIsOutOfScreen) {
throw new RuntimeException("Test failed. JFrame is out of screen.");
}
} //for iteration
System.out.println("Test passed.");
}// start()
private void createAndShowGUI() {
try {
UIManager.setLookAndFeel(
"javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage());
}
JFrame.setDefaultLookAndFeelDecorated(true);
frame = new JFrame("JFrame Dance Test");
frame.pack();
frame.setSize(450, 260);
frame.setVisible(true);
}
private void setJLayeredPaneEDT() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
lPane = frame.getLayeredPane();
System.out.println("JFrame's LayeredPane " + lPane);
}
});
}
private void setTitleComponentEDT() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
for (int j = 0; j < lPane.getComponentsInLayer(JLayeredPane.FRAME_CONTENT_LAYER.intValue()).length; j++) {
titleComponent = lPane.getComponentsInLayer(JLayeredPane.FRAME_CONTENT_LAYER.intValue())[j];
if (titleComponent.getClass().getName().equals("javax.swing.plaf.metal.MetalTitlePane")) {
titleFound = true;
break;
}
}
}
});
}
private void setFramePosEDT() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
framePosition = frame.getLocationOnScreen();
}
});
}
private boolean checkFrameIsOutOfScreenEDT() throws Exception {
final boolean[] result = new boolean[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (newFrameLocation.x > gcBounds.width || newFrameLocation.x < 0
|| newFrameLocation.y > gcBounds.height || newFrameLocation.y
< 0) {
result[0] = true;
}
}
});
return result[0];
}
private void setNewFrameLocationEDT() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
newFrameLocation = new Point(frame.getLocationOnScreen().x
+ frame.getWidth() / 2, frame.getLocationOnScreen().y + titleComponent.getHeight() / 2);
}
});
}
private int getJFrameWidthEDT() throws Exception {
final int[] result = new int[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
result[0] = frame.getWidth();
}
});
return result[0];
}
}// class
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2011, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册