138 if (ret == null) {
139 int num = getNumScreens();
140 ret = new GraphicsDevice[num];
141 for (int i = 0; i < num; i++) {
142 ret[i] = makeScreenDevice(i);
143 }
144 screens = ret;
145 }
146 return ret;
147 }
148
149 /**
150 * Returns the number of screen devices of this graphics environment.
151 *
152 * @return the number of screen devices of this graphics environment
153 */
154 protected abstract int getNumScreens();
155
156 /**
157 * Create and return the screen device with the specified number. The
158 * device with number <code>0</code> will be the default device (returned
159 * by {@link #getDefaultScreenDevice()}.
160 *
161 * @param screennum the number of the screen to create
162 *
163 * @return the created screen device
164 */
165 protected abstract GraphicsDevice makeScreenDevice(int screennum);
166
167 /**
168 * Returns the default screen graphics device.
169 */
170 public GraphicsDevice getDefaultScreenDevice() {
171 GraphicsDevice[] screens = getScreenDevices();
172 if (screens.length == 0) {
173 throw new AWTError("no screen devices");
174 }
175 return screens[0];
176 }
177
178 /**
|
138 if (ret == null) {
139 int num = getNumScreens();
140 ret = new GraphicsDevice[num];
141 for (int i = 0; i < num; i++) {
142 ret[i] = makeScreenDevice(i);
143 }
144 screens = ret;
145 }
146 return ret;
147 }
148
149 /**
150 * Returns the number of screen devices of this graphics environment.
151 *
152 * @return the number of screen devices of this graphics environment
153 */
154 protected abstract int getNumScreens();
155
156 /**
157 * Create and return the screen device with the specified number. The
158 * device with number {@code 0} will be the default device (returned
159 * by {@link #getDefaultScreenDevice()}.
160 *
161 * @param screennum the number of the screen to create
162 *
163 * @return the created screen device
164 */
165 protected abstract GraphicsDevice makeScreenDevice(int screennum);
166
167 /**
168 * Returns the default screen graphics device.
169 */
170 public GraphicsDevice getDefaultScreenDevice() {
171 GraphicsDevice[] screens = getScreenDevices();
172 if (screens.length == 0) {
173 throw new AWTError("no screen devices");
174 }
175 return screens[0];
176 }
177
178 /**
|