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


001:        package org.acm.seguin.completer.popup;
002:
003:        import org.acm.seguin.ide.jedit.Navigator;
004:        import org.acm.seguin.completer.Completer;
005:        import org.acm.seguin.completer.Completer;
006:        import java.awt.*;
007:        import java.awt.event.*;
008:        import javax.swing.*;
009:        import javax.swing.BoxLayout;
010:        import javax.swing.Timer;
011:        import javax.swing.border.*;
012:        import javax.swing.event.*;
013:        import org.gjt.sp.jedit.*;
014:        import org.gjt.sp.jedit.gui.KeyEventWorkaround;
015:        import org.gjt.sp.jedit.textarea.*;
016:
017:        /**
018:         * A message popup that will kill itself in a given time frame
019:         *
020:         * @author    btateyama@yahoo.com
021:         * @created   December 10, 2002
022:         */
023:        public class SuicidalMsgPopup extends BasePopup {
024:            final static Navigator.NavigatorLogger logger = Completer
025:                    .getLogger(SuicidalMsgPopup.class);
026:
027:            String _strMsg = null;
028:            int _iTimeToLiveMs = 1000;
029:            Timer _timer = null;
030:
031:            /**
032:             * Constructor for the CodePopup object
033:             */
034:            public SuicidalMsgPopup(View argView, String argMsg,
035:                    int argTimeToLiveMs) {
036:                this (argView, argMsg, argTimeToLiveMs, Color.yellow,
037:                        Color.black);
038:            }
039:
040:            /**
041:             * Constructor for the CodePopup object
042:             */
043:            public SuicidalMsgPopup(View argView, String argMsg,
044:                    int argTimeToLiveMs, Color argBGColor, Color argFGColor) {
045:
046:                super (argView);
047:
048:                _view = argView;
049:                _buffer = argView.getBuffer();
050:                _textArea = argView.getTextArea();
051:                _iTimeToLiveMs = argTimeToLiveMs;
052:                _strMsg = argMsg;
053:                _timer = new Timer(_iTimeToLiveMs, new ActionListener() {
054:                    public void actionPerformed(ActionEvent argEvent) {
055:                        dispose();
056:                    }
057:                });
058:
059:                setContentPane(createMainPanel());
060:                getContentPane().add(
061:                        createLabel(argMsg, argBGColor, argFGColor),
062:                        BorderLayout.CENTER);
063:                pack();
064:
065:                Point point = PopupUtils.getPointOnTextArea(argView, "");
066:                //point.x += 2;
067:                point.y += 2;
068:                setLocation(point);
069:            }
070:
071:            protected void postShow() {
072:                KeyHandler keyHandler = new KeyHandler();
073:                addKeyListener(keyHandler);
074:                _view.setKeyEventInterceptor(keyHandler);
075:                _timer.start();
076:            }
077:
078:            public void dispose() {
079:                super .dispose();
080:                _timer.stop();
081:            }
082:
083:            Component createLabel(String argText, Color argBGColor,
084:                    Color argFGColor) {
085:
086:                JPanel panel = new JPanel();
087:                panel.setLayout(new GridBagLayout());
088:                panel.setBorder(BorderFactory.createLineBorder(argFGColor, 1));
089:                panel.setBackground(argBGColor);
090:
091:                //panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
092:                GridBagConstraints c = new GridBagConstraints();
093:                c.insets = new Insets(5, 5, 5, 5);
094:                JLabel label = new JLabel(argText);
095:                label.setForeground(argFGColor);
096:                label.addMouseListener(new MouseHandler());
097:                panel.add(label, c);
098:                return panel;
099:            }
100:
101:            class KeyHandler extends KeyAdapter {
102:                /**
103:                 * Description of the Method
104:                 *
105:                 * @param evt  Description of the Parameter
106:                 */
107:                public void keyPressed(KeyEvent evt) {
108:                    // spoof keycodes to extend functionality
109:                    int iKeyCode = evt.getKeyCode();
110:                    if (PopupUtils.isCompleteWord(evt)) {
111:                        // this is a hack to execute complete word
112:                        iKeyCode = KeyEvent.VK_A;
113:                    }
114:
115:                    /*
116:                    if (evt.isControlDown() || evt.isAltDown() ){
117:                        iKeyCode = KeyEvent.VK_ESCAPE;
118:                    }
119:                     */
120:                    switch (iKeyCode) {
121:                    case KeyEvent.VK_TAB:
122:                    case KeyEvent.VK_ESCAPE:
123:                    case KeyEvent.VK_UP:
124:                    case KeyEvent.VK_DOWN:
125:                    case KeyEvent.VK_ENTER:
126:                        dispose();
127:                        evt.consume();
128:                        break;
129:                    case KeyEvent.VK_BACK_SPACE:
130:                        _textArea.backspace();
131:                        dispose();
132:                        evt.consume();
133:                        break;
134:                    default:
135:                        /*
136:                            if (PopupUtils.processJEditCommand(_view, evt)){
137:                                dispose();
138:                            } else if (evt.isActionKey()) {
139:                                dispose();
140:                                _view.processKeyEvent(evt);
141:                            }
142:                         */
143:                        PopupUtils.processJEditCommand(_view,
144:                                SuicidalMsgPopup.this , evt);
145:                        break;
146:                    }
147:                }
148:
149:                /**
150:                 * Description of the Method
151:                 *
152:                 * @param evt  Description of the Parameter
153:                 */
154:                public void keyTyped(KeyEvent evt) {
155:                    char ch = evt.getKeyChar();
156:                    evt = KeyEventWorkaround.processKeyEvent(evt);
157:                    if (evt == null) {
158:                        return;
159:                    } else if (ch != '\b') {
160:                        // if char is not control character
161:                        _textArea.userInput(ch);
162:                    }
163:                    dispose();
164:                }
165:            }
166:
167:            class MouseHandler extends MouseAdapter {
168:                /**
169:                 * Description of the Method
170:                 *
171:                 * @param evt  Description of the Parameter
172:                 */
173:                public void mouseClicked(MouseEvent evt) {
174:                    dispose();
175:                }
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.