Source Code Cross Referenced for AudioPanel.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » audio » 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 » ERP CRM Financial » sakai » org.sakaiproject.tool.assessment.audio 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL$
003:         * $Id$
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Sakai Foundation.
007:         *
008:         * Licensed under the Educational Community License, Version 1.0 (the"License");
009:         * you may not use this file except in compliance with the License.
010:         * You may obtain a copy of the License at
011:         *
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         *
014:         * Unless required by applicable law or agreed to in writing, software
015:         * distributed under the License is distributed on an "AS IS" BASIS,
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:         * See the License for the specific language governing permissions and
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.tool.assessment.audio;
021:
022:        import java.io.File;
023:        import java.util.Vector;
024:
025:        import java.awt.BorderLayout;
026:        import java.awt.Dimension;
027:        import java.awt.Toolkit;
028:        import java.awt.event.ActionEvent;
029:        import java.awt.event.ActionListener;
030:        import java.awt.event.WindowAdapter;
031:        import java.awt.event.WindowEvent;
032:        import javax.swing.JFrame;
033:        import javax.swing.JMenu;
034:        import javax.swing.JMenuBar;
035:        import javax.swing.JMenuItem;
036:        import javax.swing.JPanel;
037:        import javax.swing.JTabbedPane;
038:        import javax.swing.border.BevelBorder;
039:        import javax.swing.border.CompoundBorder;
040:        import javax.swing.border.EmptyBorder;
041:        import javax.swing.event.ChangeEvent;
042:        import javax.swing.event.ChangeListener;
043:        import java.util.ResourceBundle;
044:        import java.util.Locale;
045:        import javax.swing.Box;
046:        import java.awt.event.KeyEvent;
047:        import javax.swing.SwingUtilities;
048:        import javax.swing.UIManager;
049:
050:        /**
051:         * The Java Sound Samples : MidiSynth, Juke, CapturePlayback, Groove.
052:         *
053:         * @version @(#)JavaSound.java	1.15 00/01/31
054:         * @author Brian Lichtenwalter
055:         */
056:        public class AudioPanel extends JPanel implements  ChangeListener,
057:                Runnable {
058:            static ResourceBundle res = AudioUtil.getInstance()
059:                    .getResourceBundle();
060:
061:            Vector tabPanels = new Vector(4);
062:            JTabbedPane tabPane = new JTabbedPane();
063:            int width = 450, height = 350;
064:            int index;
065:            AudioRecorderParams params;
066:
067:            /**
068:             *
069:             * @param audioDirectory
070:             */
071:            public AudioPanel(String audioDirectory, AudioRecorderParams params) {
072:                this .params = params;
073:
074:                setLayout(new BorderLayout());
075:
076:                JMenuBar menuBar = new JMenuBar();
077:
078:                if (isStandalone()) {
079:                    configureFileMenu(menuBar);
080:                }
081:                configureHelpMenu(menuBar);
082:                add(menuBar, BorderLayout.NORTH);
083:
084:                tabPane.addChangeListener(this );
085:
086:                EmptyBorder eb = new EmptyBorder(5, 5, 5, 5);
087:                BevelBorder bb = new BevelBorder(BevelBorder.LOWERED);
088:                CompoundBorder cb = new CompoundBorder(eb, bb);
089:                JPanel p = new JPanel(new BorderLayout());
090:                //p.setBorder(new CompoundBorder(cb, new EmptyBorder(0, 0, 90, 0)));
091:                p
092:                        .setBorder(new CompoundBorder(cb, new EmptyBorder(0, 0,
093:                                0, 0)));
094:
095:                new Thread(this ).start();
096:
097:                add(tabPane, BorderLayout.CENTER);
098:            }
099:
100:            private boolean isStandalone() {
101:                if (AudioRecorderApplet.applet == null
102:                        || AudioRecorderApplet.applet.isStandalone) {
103:                    return true;
104:                }
105:
106:                return false;
107:            }
108:
109:            /**
110:             * Helper method.
111:             * @param menuBar
112:             */
113:            private void configureHelpMenu(JMenuBar menuBar) {
114:                // Move help menu to right side
115:                menuBar.add(Box.createHorizontalGlue());
116:
117:                // Help Menu, F1, H - Mnemonic
118:                JMenu options = (JMenu) menuBar.add(new JMenu(res
119:                        .getString("Help")));
120:                options.setMnemonic(KeyEvent.VK_H);
121:
122:                JMenuItem item = (JMenuItem) options.add(new JMenuItem(res
123:                        .getString("Configuration")));
124:                item.addActionListener(new ActionListener() {
125:                    public void actionPerformed(ActionEvent e) {
126:                        AudioConfigHelp help = new AudioConfigHelp();
127:                        help.configHelp();
128:                    }
129:                });
130:
131:                /* comment out - SAK-8436
132:                JMenuItem about = (JMenuItem) options.add(new JMenuItem(res.getString("About")));
133:                about.addActionListener(new ActionListener()
134:                {
135:                  public void actionPerformed(ActionEvent e)
136:                  {
137:                    AudioConfigHelp.infoHelp();
138:                  }
139:                });
140:                 */
141:            }
142:
143:            /**
144:             * Helper method.
145:             * @param menuBar
146:             */
147:            private void configureFileMenu(JMenuBar menuBar) {
148:                // File Menu, F - Mnemonic
149:                JMenu fileMenu = (JMenu) menuBar.add(new JMenu(res
150:                        .getString("File")));
151:                fileMenu.setMnemonic(KeyEvent.VK_F);
152:
153:                JMenuItem item = (JMenuItem) fileMenu.add(new JMenuItem(res
154:                        .getString("Exit")));
155:                item.addActionListener(new ActionListener() {
156:                    public void actionPerformed(ActionEvent e) {
157:                        System.exit(0);
158:                    }
159:                });
160:            }
161:
162:            /**
163:             * Handle state changes.
164:             * @param e the Cahnge Event
165:             */
166:            public void stateChanged(ChangeEvent e) {
167:                close();
168:                System.gc();
169:                index = tabPane.getSelectedIndex();
170:                open();
171:            }
172:
173:            public void close() {
174:                ((AudioControlContext) tabPanels.get(index)).close();
175:            }
176:
177:            public void open() {
178:                ((AudioControlContext) tabPanels.get(index)).open();
179:            }
180:
181:            public Dimension getPreferredSize() {
182:                return new Dimension(width, height);
183:            }
184:
185:            /**
186:             * Lazy load the tabbed pane
187:             */
188:            public void run() {
189:                EmptyBorder eb = new EmptyBorder(5, 5, 5, 5);
190:                BevelBorder bb = new BevelBorder(BevelBorder.LOWERED);
191:                CompoundBorder cb = new CompoundBorder(eb, bb);
192:                JPanel p = new JPanel(new BorderLayout());
193:                //p.setBorder(new CompoundBorder(cb, new EmptyBorder(0, 0, 90, 0)));
194:                p
195:                        .setBorder(new CompoundBorder(cb, new EmptyBorder(0, 0,
196:                                0, 0)));
197:                AudioRecorder recorder = new AudioRecorder(params);
198:                tabPanels.add(recorder);
199:                p.add(recorder);
200:                tabPane.addTab(res.getString("Audio_Recorder"), p);
201:
202:                /* samigo 2.2 did not asked for advnacd settings so commented it out 
203:                JPanel fp = new JPanel(new BorderLayout());
204:                fp.setBorder(new CompoundBorder(cb, new EmptyBorder(0, 0, 0, 0)));
205:                JPanel format = recorder.getFormatControlsPanel();
206:                tabPanels.add(format);
207:                fp.add(format);
208:                tabPane.addTab(res.getString("Advanced_Settings"), fp);
209:                 */
210:            }
211:
212:            /**
213:             *
214:             * @param args
215:             */
216:            public static void main(String[] args) {
217:                String media = res.getString("_audio");
218:                if (args.length > 0) {
219:                    File file = new File(args[0]);
220:                    if (file == null && !file.isDirectory()) {
221:                        System.out.println(res
222:                                .getString("usage_java_JavaSound"));
223:                    } else {
224:                        media = args[0];
225:                    }
226:                }
227:
228:                AudioRecorderParams params = new AudioRecorderParams();
229:
230:                final AudioPanel tabPanel = new AudioPanel(media, params);
231:                JFrame f = new JFrame(res.getString("Audio_Recorder"));
232:                f.addWindowListener(new WindowAdapter() {
233:                    public void windowClosing(WindowEvent e) {
234:                        System.exit(0);
235:                    }
236:
237:                    public void windowDeiconified(WindowEvent e) {
238:                        tabPanel.open();
239:                    }
240:
241:                    public void windowIconified(WindowEvent e) {
242:                        tabPanel.close();
243:                    }
244:                });
245:                f.getContentPane().add("Center", tabPanel);
246:                f.pack();
247:                Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
248:                f.setLocation(d.width / 2 - tabPanel.width / 2, d.height / 2
249:                        - tabPanel.height / 2);
250:                f.setSize(new Dimension(tabPanel.width, tabPanel.height));
251:                f.setVisible(true);
252:            }
253:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.