Source Code Cross Referenced for UIFrame.java in  » Science » Cougaar12_4 » org » cougaar » mlm » debug » ui » 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 » Science » Cougaar12_4 » org.cougaar.mlm.debug.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * <copyright>
003:         *  
004:         *  Copyright 1997-2004 BBNT Solutions, LLC
005:         *  under sponsorship of the Defense Advanced Research Projects
006:         *  Agency (DARPA).
007:         * 
008:         *  You can redistribute this software and/or modify it under the
009:         *  terms of the Cougaar Open Source License as published on the
010:         *  Cougaar Open Source Website (www.cougaar.org).
011:         * 
012:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015:         *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016:         *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017:         *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018:         *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019:         *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020:         *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021:         *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022:         *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023:         *  
024:         * </copyright>
025:         */
026:
027:        package org.cougaar.mlm.debug.ui;
028:
029:        import java.awt.Color;
030:        import java.awt.Component;
031:        import java.awt.FlowLayout;
032:        import java.awt.event.ActionListener;
033:        import java.awt.event.WindowAdapter;
034:        import java.awt.event.WindowEvent;
035:        import java.awt.event.WindowListener;
036:
037:        import javax.swing.JButton;
038:        import javax.swing.JFrame;
039:        import javax.swing.JPanel;
040:        import javax.swing.JScrollPane;
041:
042:        /** Create a JFrame to display information requested by the user.
043:         Used for all displays generated from the main display.
044:         */
045:
046:        public class UIFrame extends JFrame {
047:            private static int WIDTH = 500;// width and height of initial frame
048:            private static int HEIGHT = 300;
049:            public static String UPDATE_COMMAND = "Update";
050:            public static String SAVE_COMMAND = "Save";
051:            public static String EXPAND_COMMAND = "Expand";
052:
053:            /** Create a frame with the specified title and containing the
054:              specified component, which is either a tree or a bar graph.
055:              Optionally creates buttons for updating display (with info from
056:              a remote cluster), saving the display (for tree displays only),
057:              fully expanding the display (for tree displays only).
058:              @param title the string to display at the top of the frame
059:              @param component the component to put in the frame
060:              @param actionListener object to notify when buttons are pressed
061:              @param provideUpdateFunction true to provide update button
062:              @param provideSaveFunction true to provide save button
063:              @param provideExpandFunction true to provide expand button
064:             */
065:
066:            public UIFrame(String title, Component component,
067:                    ActionListener actionListener,
068:                    boolean provideUpdateFunction, boolean provideSaveFunction,
069:                    boolean provideExpandFunction) {
070:                super (title);
071:                setForeground(Color.black);
072:                setBackground(Color.lightGray);
073:
074:                // cleanup for this display only, for example
075:                // remove any listeners that we've set up!!!
076:                WindowListener windowListener = new WindowAdapter() {
077:                    public void windowClosing(WindowEvent e) {
078:                        e.getWindow().dispose();
079:                    }
080:                };
081:
082:                addWindowListener(windowListener);
083:                setSize(WIDTH, HEIGHT);
084:                JScrollPane scrollPane = new JScrollPane();
085:                scrollPane.setViewportView(component);
086:                getContentPane().add("Center", scrollPane);
087:
088:                // add buttons if needed to provide save function and
089:                // update display
090:                if (provideSaveFunction || provideUpdateFunction
091:                        || provideExpandFunction) {
092:                    JPanel buttonPanel = new JPanel(new FlowLayout(
093:                            FlowLayout.LEFT));
094:                    if (provideSaveFunction) {
095:                        JButton saveButton = new JButton(SAVE_COMMAND);
096:                        saveButton
097:                                .setToolTipText("Save displayed information to a file.");
098:                        saveButton.addActionListener(actionListener);
099:                        saveButton.setActionCommand(SAVE_COMMAND);
100:                        buttonPanel.add(saveButton);
101:                    }
102:                    if (provideUpdateFunction) {
103:                        buttonPanel.setBackground(Color.blue); // signifies remote cluster
104:                        JButton updateButton = new JButton(UPDATE_COMMAND);
105:                        updateButton
106:                                .setToolTipText("Retrieve new information from remote cluster.");
107:                        updateButton.addActionListener(actionListener);
108:                        updateButton.setActionCommand(UPDATE_COMMAND);
109:                        buttonPanel.add(updateButton);
110:                    }
111:                    if (provideExpandFunction) {
112:                        JButton expandButton = new JButton(EXPAND_COMMAND);
113:                        getContentPane().add("North", buttonPanel);
114:                        expandButton.setToolTipText("Expand information.");
115:                        expandButton.addActionListener(actionListener);
116:                        expandButton.setActionCommand(EXPAND_COMMAND);
117:                        buttonPanel.add(expandButton);
118:                    }
119:                }
120:                // create display at the upper left corner of the window
121:                setLocation(0, 0);
122:                // and display it
123:                setVisible(true);
124:            }
125:
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.