Source Code Cross Referenced for ClickThroughStyledLabel.java in  » Swing-Library » jide-common » com » jidesoft » 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 » Swing Library » jide common » com.jidesoft.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.jidesoft.swing;
002:
003:        import javax.swing.*;
004:        import javax.swing.event.MouseInputListener;
005:        import java.awt.*;
006:        import java.awt.event.MouseEvent;
007:
008:        /**
009:         * <tt>ClickThroughStyledLabel</tt> is a special ClickThroughStyledLabel that will retarget all mouse events to specified target component.
010:         * <p/>
011:         * For example, you need to paint some text on a JComponent. Usually you can call Java2D paint text method and paint
012:         * the text. However the other way to do it is to add JLabel to JComponent and JLabel will not only paint
013:         * the text but also an optional icon which is better. However if you had mouse listener added to JComponent, the mouse
014:         * listener will not receive any mouse events when mouse clicks on the JLabel. By using this <tt>ClickThroughLabel</tt>,
015:         * mouse event will be passed to underlying JComponent.
016:         * <p/>
017:         * Please note, we didn't pass all mouse events. In most cases, MOUSE_EXITED and MOUSE_ENTERED doesn't make sense to pass through.
018:         * However there are cases, for example when the JLabel is at the border of JComponent, you may expect MOUSE_ENTERED event
019:         * on JComponent but it will not happen. So please be aware of those cases so that you don't depend on it for important
020:         * decision in your code.
021:         */
022:        public class ClickThroughStyledLabel extends StyledLabel implements 
023:                MouseInputListener {
024:
025:            private Component _target;
026:
027:            public ClickThroughStyledLabel() {
028:                installListeners();
029:            }
030:
031:            public ClickThroughStyledLabel(Icon image) {
032:                super (image);
033:                installListeners();
034:            }
035:
036:            public ClickThroughStyledLabel(Icon image, int horizontalAlignment) {
037:                super (image, horizontalAlignment);
038:                installListeners();
039:            }
040:
041:            public ClickThroughStyledLabel(String text) {
042:                super (text);
043:                installListeners();
044:            }
045:
046:            public ClickThroughStyledLabel(String text, int horizontalAlignment) {
047:                super (text, horizontalAlignment);
048:                installListeners();
049:            }
050:
051:            public ClickThroughStyledLabel(String text, Icon icon,
052:                    int horizontalAlignment) {
053:                super (text, icon, horizontalAlignment);
054:                installListeners();
055:            }
056:
057:            public Component getTarget() {
058:                return _target;
059:            }
060:
061:            public void setTarget(Component target) {
062:                _target = target;
063:            }
064:
065:            protected void installListeners() {
066:                addMouseListener(this );
067:                addMouseMotionListener(this );
068:            }
069:
070:            protected void uninstallListeners() {
071:                removeMouseListener(this );
072:                removeMouseMotionListener(this );
073:            }
074:
075:            public void mouseClicked(MouseEvent e) {
076:                JideSwingUtilities
077:                        .retargetMouseEvent(e.getID(), e, getTarget());
078:            }
079:
080:            public void mousePressed(MouseEvent e) {
081:                JideSwingUtilities
082:                        .retargetMouseEvent(e.getID(), e, getTarget());
083:            }
084:
085:            public void mouseReleased(MouseEvent e) {
086:                JideSwingUtilities
087:                        .retargetMouseEvent(e.getID(), e, getTarget());
088:            }
089:
090:            public void mouseEntered(MouseEvent e) {
091:                JideSwingUtilities
092:                        .retargetMouseEvent(e.getID(), e, getTarget());
093:            }
094:
095:            public void mouseExited(MouseEvent e) {
096:                JideSwingUtilities
097:                        .retargetMouseEvent(e.getID(), e, getTarget());
098:            }
099:
100:            public void mouseDragged(MouseEvent e) {
101:                JideSwingUtilities
102:                        .retargetMouseEvent(e.getID(), e, getTarget());
103:            }
104:
105:            public void mouseMoved(MouseEvent e) {
106:                JideSwingUtilities
107:                        .retargetMouseEvent(e.getID(), e, getTarget());
108:            }
109:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.