01: /*
02: * The contents of this file are subject to the Mozilla Public License
03: * Version 1.1 (the "License"); you may not use this file except in
04: * compliance with the License. You may obtain a copy of the License at
05: * http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
09: * License for the specific language governing rights and limitations
10: * under the License.
11: *
12: * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
13: *
14: * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
15: * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
16: *
17: * Contributor(s):
18: * Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
19: *
20: * If you didn't download this code from the following link, you should check
21: * if you aren't using an obsolete version: http://www.isqlviewer.com
22: */
23: package org.isqlviewer.ui.laf;
24:
25: import java.awt.Component;
26: import java.awt.Dimension;
27: import java.awt.Graphics;
28: import java.awt.Graphics2D;
29: import java.awt.Rectangle;
30:
31: import javax.swing.UIManager;
32:
33: /**
34: * Default Icon to use when no icon is available.
35: * <p>
36: * Does a color LED thing with a ? in the center.
37: *
38: * @author Mark A. Kobold <mkobold at isqlviewer dot com>
39: * @version 1.0
40: */
41: public class NullIcon extends ColorLedIcon {
42:
43: public NullIcon() {
44:
45: super (UIManager.getColor("textHighlight"), 0, 0);
46: }
47:
48: @Override
49: public void paintIcon(Component c, Graphics g1, int x, int y) {
50:
51: super .paintIcon(c, g1, x, y);
52: Graphics2D g = (Graphics2D) g1;
53:
54: Dimension size = new Dimension(getIconWidth(), getIconHeight());
55: int sphereSize = size.width <= size.height ? size.width
56: : size.height;
57: Rectangle gradientRect = new Rectangle(-sphereSize / 2,
58: -sphereSize / 2, 3 * sphereSize / 2, 3 * sphereSize / 2);
59: float x1 = gradientRect.width / 2f;
60: float y1 = gradientRect.height / 2f;
61: g.setColor(UIManager.getColor("textHighlightText"));
62: g.drawString("?", x1 / 2, y1);
63: }
64: }
|