下面列出了怎么用sun.awt.X11GraphicsEnvironment的API类实例代码及写法,或者点击链接到github查看源代码。
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public Boolean run() {
boolean loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderAvailable()) {
try {
System.loadLibrary("jules");
loadSuccess = true;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library loaded");
}
} catch (UnsatisfiedLinkError ex) {
loadSuccess = false;
if (X11GraphicsEnvironment.isXRenderVerbose()) {
System.out.println(
"Xrender: INFO: Jules library not installed.");
}
}
}
return Boolean.valueOf(loadSuccess);
}
/**
* Xinerama-aware version of XlibWrapper.RootWindow method.
*/
public static long getRootWindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.RootWindow(XToolkit.getDisplay(), 0);
}
else
{
return XlibWrapper.RootWindow(XToolkit.getDisplay(), screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
public static GLXGraphicsConfig getConfig(X11GraphicsDevice device,
int visualnum)
{
if (!X11GraphicsEnvironment.isGLXAvailable()) {
return null;
}
long cfginfo = 0;
final String ids[] = new String[1];
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.lock();
try {
// getGLXConfigInfo() creates and destroys temporary
// surfaces/contexts, so we should first invalidate the current
// Java-level context and flush the queue...
OGLContext.invalidateCurrentContext();
GLXGetConfigInfo action =
new GLXGetConfigInfo(device.getScreen(), visualnum);
rq.flushAndInvokeNow(action);
cfginfo = action.getConfigInfo();
if (cfginfo != 0L) {
OGLContext.setScratchSurface(cfginfo);
rq.flushAndInvokeNow(new Runnable() {
public void run() {
ids[0] = OGLContext.getOGLIdString();
}
});
}
} finally {
rq.unlock();
}
if (cfginfo == 0) {
return null;
}
int oglCaps = getOGLCapabilities(cfginfo);
ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
return new GLXGraphicsConfig(device, visualnum, cfginfo, caps);
}
public static GLXGraphicsConfig getConfig(X11GraphicsDevice device,
int visualnum)
{
if (!X11GraphicsEnvironment.isGLXAvailable()) {
return null;
}
long cfginfo = 0;
final String ids[] = new String[1];
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.lock();
try {
// getGLXConfigInfo() creates and destroys temporary
// surfaces/contexts, so we should first invalidate the current
// Java-level context and flush the queue...
OGLContext.invalidateCurrentContext();
GLXGetConfigInfo action =
new GLXGetConfigInfo(device.getScreen(), visualnum);
rq.flushAndInvokeNow(action);
cfginfo = action.getConfigInfo();
if (cfginfo != 0L) {
OGLContext.setScratchSurface(cfginfo);
rq.flushAndInvokeNow(new Runnable() {
public void run() {
ids[0] = OGLContext.getOGLIdString();
}
});
}
} finally {
rq.unlock();
}
if (cfginfo == 0) {
return null;
}
int oglCaps = getOGLCapabilities(cfginfo);
ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
return new GLXGraphicsConfig(device, visualnum, cfginfo, caps);
}
public static GLXGraphicsConfig getConfig(X11GraphicsDevice device,
int visualnum)
{
if (!X11GraphicsEnvironment.isGLXAvailable()) {
return null;
}
long cfginfo = 0;
final String ids[] = new String[1];
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.lock();
try {
// getGLXConfigInfo() creates and destroys temporary
// surfaces/contexts, so we should first invalidate the current
// Java-level context and flush the queue...
OGLContext.invalidateCurrentContext();
GLXGetConfigInfo action =
new GLXGetConfigInfo(device.getScreen(), visualnum);
rq.flushAndInvokeNow(action);
cfginfo = action.getConfigInfo();
if (cfginfo != 0L) {
OGLContext.setScratchSurface(cfginfo);
rq.flushAndInvokeNow(new Runnable() {
public void run() {
ids[0] = OGLContext.getOGLIdString();
}
});
}
} finally {
rq.unlock();
}
if (cfginfo == 0) {
return null;
}
int oglCaps = getOGLCapabilities(cfginfo);
ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
return new GLXGraphicsConfig(device, visualnum, cfginfo, caps);
}
public static GLXGraphicsConfig getConfig(X11GraphicsDevice device,
int visualnum)
{
if (!X11GraphicsEnvironment.isGLXAvailable()) {
return null;
}
long cfginfo = 0;
final String ids[] = new String[1];
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.lock();
try {
// getGLXConfigInfo() creates and destroys temporary
// surfaces/contexts, so we should first invalidate the current
// Java-level context and flush the queue...
OGLContext.invalidateCurrentContext();
GLXGetConfigInfo action =
new GLXGetConfigInfo(device.getScreen(), visualnum);
rq.flushAndInvokeNow(action);
cfginfo = action.getConfigInfo();
if (cfginfo != 0L) {
OGLContext.setScratchSurface(cfginfo);
rq.flushAndInvokeNow(new Runnable() {
public void run() {
ids[0] = OGLContext.getOGLIdString();
}
});
}
} finally {
rq.unlock();
}
if (cfginfo == 0) {
return null;
}
int oglCaps = getOGLCapabilities(cfginfo);
ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
return new GLXGraphicsConfig(device, visualnum, cfginfo, caps);
}