1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1277 }
1278
1279 public void error(SAXParseException e) throws SAXException {
1280 if (isForwarding()) {
1281 getHandler().error(e);
1282 }
1283 }
1284
1285
1286 public void fatalError(SAXParseException e) throws SAXException {
1287 if (isForwarding()) {
1288 getHandler().fatalError(e);
1289 }
1290 throw e;
1291 }
1292
1293
1294 /**
1295 * ImageIcon that lazily loads the image until needed.
1296 */
1297 private static class LazyImageIcon extends ImageIcon implements UIResource {
1298 private URL location;
1299
1300 public LazyImageIcon(URL location) {
1301 super();
1302 this.location = location;
1303 }
1304
1305 public void paintIcon(Component c, Graphics g, int x, int y) {
1306 if (getImage() != null) {
1307 super.paintIcon(c, g, x, y);
1308 }
1309 }
1310
1311 public int getIconWidth() {
1312 if (getImage() != null) {
1313 return super.getIconWidth();
1314 }
1315 return 0;
1316 }
|
1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1277 }
1278
1279 public void error(SAXParseException e) throws SAXException {
1280 if (isForwarding()) {
1281 getHandler().error(e);
1282 }
1283 }
1284
1285
1286 public void fatalError(SAXParseException e) throws SAXException {
1287 if (isForwarding()) {
1288 getHandler().fatalError(e);
1289 }
1290 throw e;
1291 }
1292
1293
1294 /**
1295 * ImageIcon that lazily loads the image until needed.
1296 */
1297 @SuppressWarnings("serial") // Superclass is not serializable across versions
1298 private static class LazyImageIcon extends ImageIcon implements UIResource {
1299 private URL location;
1300
1301 public LazyImageIcon(URL location) {
1302 super();
1303 this.location = location;
1304 }
1305
1306 public void paintIcon(Component c, Graphics g, int x, int y) {
1307 if (getImage() != null) {
1308 super.paintIcon(c, g, x, y);
1309 }
1310 }
1311
1312 public int getIconWidth() {
1313 if (getImage() != null) {
1314 return super.getIconWidth();
1315 }
1316 return 0;
1317 }
|