93 private static GraphicsEnvironment createGE() {
94 GraphicsEnvironment ge;
95 String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
96 try {
97 // long t0 = System.currentTimeMillis();
98 Class geCls;
99 try {
100 // First we try if the bootclassloader finds the requested
101 // class. This way we can avoid to run in a privileged block.
102 geCls = Class.forName(nm);
103 } catch (ClassNotFoundException ex) {
104 // If the bootclassloader fails, we try again with the
105 // application classloader.
106 ClassLoader cl = ClassLoader.getSystemClassLoader();
107 geCls = Class.forName(nm, true, cl);
108 }
109 ge = (GraphicsEnvironment) geCls.newInstance();
110 // long t1 = System.currentTimeMillis();
111 // System.out.println("GE creation took " + (t1-t0)+ "ms.");
112 if (isHeadless()) {
113 localEnv = new HeadlessGraphicsEnvironment(localEnv);
114 }
115 } catch (ClassNotFoundException e) {
116 throw new Error("Could not find class: "+nm);
117 } catch (InstantiationException e) {
118 throw new Error("Could not instantiate Graphics Environment: "
119 + nm);
120 } catch (IllegalAccessException e) {
121 throw new Error ("Could not access Graphics Environment: "
122 + nm);
123 }
124 return ge;
125 }
126
127 /**
128 * Tests whether or not a display, keyboard, and mouse can be
129 * supported in this environment. If this method returns true,
130 * a HeadlessException is thrown from areas of the Toolkit
131 * and GraphicsEnvironment that are dependent on a display,
132 * keyboard, or mouse.
133 * @return <code>true</code> if this environment cannot support
|
93 private static GraphicsEnvironment createGE() {
94 GraphicsEnvironment ge;
95 String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
96 try {
97 // long t0 = System.currentTimeMillis();
98 Class geCls;
99 try {
100 // First we try if the bootclassloader finds the requested
101 // class. This way we can avoid to run in a privileged block.
102 geCls = Class.forName(nm);
103 } catch (ClassNotFoundException ex) {
104 // If the bootclassloader fails, we try again with the
105 // application classloader.
106 ClassLoader cl = ClassLoader.getSystemClassLoader();
107 geCls = Class.forName(nm, true, cl);
108 }
109 ge = (GraphicsEnvironment) geCls.newInstance();
110 // long t1 = System.currentTimeMillis();
111 // System.out.println("GE creation took " + (t1-t0)+ "ms.");
112 if (isHeadless()) {
113 ge = new HeadlessGraphicsEnvironment(ge);
114 }
115 } catch (ClassNotFoundException e) {
116 throw new Error("Could not find class: "+nm);
117 } catch (InstantiationException e) {
118 throw new Error("Could not instantiate Graphics Environment: "
119 + nm);
120 } catch (IllegalAccessException e) {
121 throw new Error ("Could not access Graphics Environment: "
122 + nm);
123 }
124 return ge;
125 }
126
127 /**
128 * Tests whether or not a display, keyboard, and mouse can be
129 * supported in this environment. If this method returns true,
130 * a HeadlessException is thrown from areas of the Toolkit
131 * and GraphicsEnvironment that are dependent on a display,
132 * keyboard, or mouse.
133 * @return <code>true</code> if this environment cannot support
|