Source Code Cross Referenced for JMouseComboBox.java in  » UML » jrefactory » org » acm » seguin » ide » common » options » 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 » UML » jrefactory » org.acm.seguin.ide.common.options 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  JMouseComboBox.java - bugfix class for JComboBox
003:         *  Copyright (C) 2001 Dirk Moebius
004:         *
005:         *  jEdit buffer options:
006:         *  :tabSize=4:indentSize=4:noTabs=false:maxLineLen=0:
007:         *
008:         *  This program is free software; you can redistribute it and/or
009:         *  modify it under the terms of the GNU General Public License
010:         *  as published by the Free Software Foundation; either version 2
011:         *  of the License, or any later version.
012:         *
013:         *  This program is distributed in the hope that it will be useful,
014:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         *  GNU General Public License for more details.
017:         *
018:         *  You should have received a copy of the GNU General Public License
019:         *  along with this program; if not, write to the Free Software
020:         *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:        package org.acm.seguin.ide.common.options;
023:
024:        import java.awt.event.MouseEvent;
025:        import java.awt.event.MouseListener;
026:        import java.util.Vector;
027:        import javax.swing.ComboBoxModel;
028:        import javax.swing.JComboBox;
029:
030:        /**
031:         *  This is a combo-box that allows listeners to be informed of mouse entered and
032:         *  mouse exited events. Note that other mouse events besides MOUSE_ENTERED and
033:         *  MOUSE_EXITED still do <i>not</i> get delivered. This is because sending a MOUSE_PRESSED,
034:         *  MOUSE_CLICKED or MOUSE_RELEASED event would cause the combo box popup to be
035:         *  hidden immediately after it has been shown, resulting in that it would not be
036:         *  shown at all. This class was created as a fix/workaround for Swing bug #4144505.
037:         *
038:         *@author     Mike Atkinson (<a href="mailto:javastyle@ladyshot.demon.co.uk">Mike@ladyshot.demon.co.uk
039:         *      </a>)
040:         *@author     Dirk Moebius (<a href="mailto:dmoebius@gmx.net">dmoebius@gmx.net</a>
041:         *      )
042:         *@version    $Version: $
043:         *@since      1.0
044:         */
045:        public class JMouseComboBox extends JComboBox implements  MouseListener {
046:
047:            /**
048:             *  Creates a JMouseComboBox with a default data model. The default data model
049:             *  is an empty list of objects. Use <code>addItem</code> to add items.
050:             */
051:            public JMouseComboBox() {
052:                super ();
053:                initialize();
054:            }
055:
056:            /**
057:             *  Creates a JMouseComboBox that contains the elements in the specified array.
058:             *
059:             *@param  items  Description of Parameter
060:             */
061:            public JMouseComboBox(Object[] items) {
062:                super (items);
063:                initialize();
064:            }
065:
066:            /**
067:             *  Creates a JMouseComboBox that takes its items from an existing <code>ComboBoxModel</code>
068:             *  .
069:             *
070:             *@param  aModel  the ComboBoxModel that provides the displayed list of items
071:             */
072:            public JMouseComboBox(ComboBoxModel aModel) {
073:                super (aModel);
074:                initialize();
075:            }
076:
077:            /**
078:             *  Creates a JMouseComboBox that contains the elements in the specified Vector.
079:             *
080:             *@param  items  Description of Parameter
081:             */
082:            public JMouseComboBox(Vector items) {
083:                super (items);
084:                initialize();
085:            }
086:
087:            public void mouseClicked(MouseEvent e) {
088:                createMouseEvent(e);
089:            }
090:
091:            public void mouseEntered(MouseEvent e) {
092:                createMouseEvent(e);
093:            }
094:
095:            public void mouseExited(MouseEvent e) {
096:                createMouseEvent(e);
097:            }
098:
099:            public void mousePressed(MouseEvent e) {
100:                createMouseEvent(e);
101:            }
102:
103:            public void mouseReleased(MouseEvent e) {
104:                createMouseEvent(e);
105:            }
106:
107:            /**
108:             *  If something else (one of its children) created the mouse event
109:             *  then pretend it came from here.
110:             *
111:             *@param  e  The mouse event.
112:             */
113:            private void createMouseEvent(MouseEvent e) {
114:                if (e.getSource() != this ) {
115:                    int id = e.getID();
116:                    switch (id) {
117:                    case MouseEvent.MOUSE_PRESSED:
118:                    case MouseEvent.MOUSE_RELEASED:
119:                    case MouseEvent.MOUSE_CLICKED:
120:                        // cannot deliver these events, because it would cause the
121:                        // popup to be hidden.
122:                        break;
123:                    case MouseEvent.MOUSE_ENTERED:
124:                    case MouseEvent.MOUSE_EXITED:
125:                        // create new event from the old one, with this as source:
126:                        MouseEvent newEvt = new MouseEvent(this , e.getID(), e
127:                                .getWhen(), e.getModifiers(), e.getX(), e
128:                                .getY(), e.getClickCount(), e.isPopupTrigger());
129:                        // send the event to the event queue:
130:                        processMouseEvent(newEvt);
131:                        break;
132:                    }
133:                }
134:            }
135:
136:            /**
137:             *  Initialize the class.
138:             */
139:            private void initialize() {
140:                setName("JMouseComboBox");
141:                for (int i = 0; i < getComponentCount(); i++) {
142:                    getComponent(i).addMouseListener(this);
143:                }
144:            }
145:
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.