Source Code Cross Referenced for XImage.java in  » XML-UI » XUI » net » xoetrope » swing » 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 » XML UI » XUI » net.xoetrope.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.swing;
002:
003:        import java.awt.Graphics;
004:        import java.awt.Image;
005:        import java.awt.image.ImageObserver;
006:        import javax.swing.JComponent;
007:
008:        import net.xoetrope.xui.XImageHolder;
009:        import net.xoetrope.xui.XAttributedComponent;
010:        import net.xoetrope.xui.XResourceManager;
011:
012:        /**
013:         * <p>Draws an image</p>
014:         * <p>Copyright (c) Xoetrope Ltd., 1998-2003</p>
015:         * License:      see license.txt
016:         * $Revision: 1.10 $
017:         */
018:        public class XImage extends JComponent implements  XImageHolder,
019:                XAttributedComponent {
020:            private Image image = null;
021:            private String imageName;
022:
023:            /**
024:             * Constructs a blank image control.
025:             */
026:            public XImage() {
027:            }
028:
029:            /**
030:             * Requests a repaint of the control once it has been created
031:             */
032:            public void addNotify() {
033:                super .addNotify();
034:                repaint(0);
035:            }
036:
037:            /**
038:             * Sets the image to display.
039:             * @param img the image
040:             */
041:            public void setImage(Image img) {
042:                image = img;
043:                repaint();
044:                prepareImage(img, this );
045:            }
046:
047:            /**
048:             * Gets the name of the image being displayed.
049:             * @return the image name
050:             */
051:            public String getImageName() {
052:                return imageName;
053:            }
054:
055:            /**
056:             * Renders the component
057:             * @param g the graphics context
058:             */
059:            public void paintComponent(Graphics g) {
060:                if (image != null)
061:                    g.drawImage(image, 0, 0, (int) getSize().width,
062:                            (int) getSize().height, null);
063:            }
064:
065:            /**
066:             * Update the image as it is loaded.
067:             * @param img the image
068:             * @param infoflags the flags
069:             * @param x
070:             * @param y
071:             * @param width
072:             * @param height
073:             * @return super.imageUpdate(...)
074:             */
075:            public boolean imageUpdate(Image img, int infoflags, int x, int y,
076:                    int width, int height) {
077:                repaint(100, x, y, width, height);
078:                if (infoflags == ImageObserver.ALLBITS)
079:                    return false;
080:
081:                return true;
082:            }
083:
084:            /**
085:             * Set one or more attributes of the component.
086:             * <OL>
087:             * <LI>content, value=the image file name</LI>
088:             * <LI>imagename, value=the image file name</LI>
089:             * </OL>
090:             * @param attribName the attribute name
091:             * @param attribValue the attribute value
092:             */
093:            public void setAttribute(String attribName, String attribValue) {
094:                if (attribName.equals("content")
095:                        || attribName.equals("imagename")) {
096:                    imageName = attribValue;
097:                    setImage(XResourceManager.getImage(imageName));
098:                }
099:            }
100:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.