Source Code Cross Referenced for QuaquaIconFactory.java in  » Swing-Library » substance-look-feel » contrib » ch » randelshofer » quaqua » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » substance look feel » contrib.ch.randelshofer.quaqua 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)QuaquaIconFactory.java  3.2 2007-01-05
003:         *
004:         * Copyright (c) 2005-2006 Werner Randelshofer
005:         * Staldenmattweg 2, Immensee, CH-6405, Switzerland.
006:         * All rights reserved.
007:         *
008:         * This software is the confidential and proprietary information of
009:         * Werner Randelshofer. ("Confidential Information").  You shall not
010:         * disclose such Confidential Information and shall use it only in
011:         * accordance with the terms of the license agreement you entered into
012:         * with Werner Randelshofer.
013:         */
014:
015:        package contrib.ch.randelshofer.quaqua;
016:
017:        import java.net.*;
018:        import java.awt.*;
019:        import java.awt.image.*;
020:        import javax.swing.*;
021:        import javax.swing.plaf.*;
022:
023:        import contrib.ch.randelshofer.quaqua.util.*; //import javax.imageio.*;
024:        //import javax.imageio.stream.*;
025:        import java.io.*;
026:        import java.util.*;
027:
028:        /**
029:         * QuaquaIconFactory.
030:         *
031:         * @author  Werner Randelshofer, Christopher Atlan
032:         * @version 3.2 2007-01-05 Issue #1: Changed LazyOptionPaneIcon to load image
033:         * asynchronously before paintIcon is invoked.
034:         * <br>3.1 2006-12-24 by Karl von Randow: Use Images class to create artwork.
035:         * <br>3.0.2 2006-11-01 Use Graphics2D.drawImage() to scale application
036:         * image icon instead of using Image.getScaledInstance(). 
037:         * <br>3.0.1 2006-05-14 Application icon was unnecessarily created multiple
038:         * times. 
039:         * <br>3.0 2006-05-12 Added support for file icon images. Renamed some
040:         * methods.
041:         * <br>2.1 2006-02-14 Added method createFrameButtonStateIcon.
042:         * <br>2.0 2006-02-12 Added methods createApplicationIcon, compose,
043:         * createOptionPaneIcon. These methods were contributed by Christopher Atlan.
044:         * <br>1.0 December 4, 2005 Created.
045:         */
046:        public class QuaquaIconFactory {
047:            private static BufferedImage applicationImage;
048:
049:            /**
050:             * Prevent instance creation.
051:             */
052:            private QuaquaIconFactory() {
053:            }
054:
055:            public static URL getResource(String location) {
056:                URL url = QuaquaIconFactory.class.getResource(location);
057:                if (url == null) {
058:                    throw new InternalError("image resource missing: "
059:                            + location);
060:                }
061:                return url;
062:            }
063:
064:            public static Image createImage(String location) {
065:                return createImage(QuaquaIconFactory.class, location);
066:            }
067:
068:            public static Image createImage(Class baseClass, String location) {
069:                return Images.createImage(baseClass.getResource(location));
070:            }
071:
072:            public static Image createBufferedImage(String location) {
073:                return Images.toBufferedImage(createImage(location));
074:            }
075:
076:            public static Icon[] createIcons(String location, int count,
077:                    boolean horizontal) {
078:                Icon[] icons = new Icon[count];
079:
080:                BufferedImage[] images = Images.split(
081:                        (Image) createImage(location), count, horizontal);
082:
083:                for (int i = 0; i < count; i++) {
084:                    icons[i] = new IconUIResource(new ImageIcon(images[i]));
085:                }
086:                return icons;
087:            }
088:
089:            public static Icon createIcon(String location, int count,
090:                    boolean horizontal, int index) {
091:                return createIcons(location, count, horizontal)[index];
092:            }
093:
094:            public static Icon createButtonStateIcon(String location, int states) {
095:                return new ButtonStateIcon((Image) createImage(location),
096:                        states, true);
097:            }
098:
099:            public static Icon createButtonStateIcon(String location,
100:                    int states, Point shift) {
101:                return new ShiftedIcon(new ButtonStateIcon(
102:                        (Image) createImage(location), states, true), shift);
103:            }
104:
105:            public static Icon createButtonStateIcon(String location,
106:                    int states, Rectangle shift) {
107:                return new ShiftedIcon(new ButtonStateIcon(
108:                        (Image) createImage(location), states, true), shift);
109:            }
110:
111:            public static Icon createIcon(Class baseClass, String location) {
112:                return new ImageIcon(createImage(baseClass, location));
113:            }
114:
115:            public static Icon createIcon(Class baseClass, String location,
116:                    Point shift) {
117:                return new ShiftedIcon(new ImageIcon(createImage(baseClass,
118:                        location)), shift);
119:            }
120:
121:            public static Icon createIcon(Class baseClass, String location,
122:                    Rectangle shiftAndSize) {
123:                return new ShiftedIcon(new ImageIcon(createImage(baseClass,
124:                        location)), shiftAndSize);
125:            }
126:
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.