001: /*
002: * @(#)PreferencesJDialog.java 1.0, 1 April 2000
003: *
004: * Copyright (c) 2000 Silv?re Martin-Michiellot All Rights Reserved.
005: *
006: * Silv?re Martin-Michiellot grants you ("Licensee") a non-exclusive,
007: * royalty free, license to use, modify and redistribute this
008: * software in source and binary code form,
009: * provided that i) this copyright notice and license appear on all copies of
010: * the software; and ii) Licensee does not utilize the software in a manner
011: * which is disparaging to Silv?re Martin-Michiellot.
012: *
013: * This software is provided "AS IS," without a warranty of any kind. ALL
014: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
015: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
016: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silv?re Martin-Michiellot
017: * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
018: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
019: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
020: * Silv?re Martin-Michiellot OR ITS LICENSORS BE LIABLE
021: * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
022: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
023: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
024: * OR INABILITY TO USE SOFTWARE, EVEN IF Silv?re Martin-Michiellot HAS BEEN
025: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
026: *
027: * This software is not designed or intended for use in on-line control of
028: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
029: * the design, construction, operation or maintenance of any nuclear
030: * facility. Licensee represents and warrants that it will not use or
031: * redistribute the Software for such purposes.
032: *
033: * @Author: Silv?re Martin-Michiellot
034: *
035: */
036:
037: package com.db.client;
038:
039: import java.awt.*;
040: import java.awt.event.*;
041: import javax.swing.*;
042: import javax.media.j3d.*;
043: import com.sun.j3d.audioengines.javasound.*;
044: import java.util.*;
045:
046: class PreferencesJDialog extends JFrame implements ActionListener,
047: InputMethodListener {
048:
049: private View view;
050: private JavaSoundMixer javaSoundMixer;
051: private ResourceBundle resourceBundle;
052: private JTabbedPane TheTabbedPane;
053: private JPanel TheBottomPanel;
054: private JButton TheCloseButton;
055: private JPanel TheApplicationPreferencesPanel;
056: private JPanel TheAppCenterPanel;
057: private JComboBox TheAppLNFComboBox;
058: private UIManager.LookAndFeelInfo[] LNFInfos;
059: private java.util.Locale[] locales;
060: private JComboBox TheAppCLComboBox;
061: private JComboBox TheAppCCComboBox;
062: private JComboBox TheAppDBComboBox;
063: private JComboBox TheAppSComboBox;
064: private JTextField TheAppTTextField;
065: private JComboBox TheAppSAComboBox;
066: private JComboBox TheAppJSMComboBox;
067: private JPanel TheSystemPreferencesPanel;
068: private JPanel TheSysCenterPanel;
069: private JScrollPane TheScrollPane;
070: private JTextArea TheSysTextArea;
071: private ClassLoader classLoader;
072: private String information;
073:
074: protected java.util.Locale locale;
075: protected Canvas3D canvas3D;
076: protected Hashtable environmentProperties;
077:
078: public PreferencesJDialog(java.util.Locale locale,
079: Canvas3D canvas3D, Hashtable environmentProperties) {
080:
081: super ();
082:
083: this .locale = locale;
084: this .canvas3D = canvas3D;
085: this .environmentProperties = environmentProperties;
086:
087: view = canvas3D.getView();
088:
089: javaSoundMixer = (JavaSoundMixer) view.getPhysicalEnvironment()
090: .getAudioDevice();
091:
092: resourceBundle = ResourceBundle.getBundle("ResourceBundle",
093: locale);
094:
095: this .setTitle(resourceBundle.getString("PreferencesTitle"));
096:
097: this .setSize(370, 380);
098: this .setResizable(false);
099:
100: this .getContentPane().setLayout(new BorderLayout());
101:
102: TheTabbedPane = new JTabbedPane();
103: this .getContentPane().add(TheTabbedPane, "Center");
104:
105: TheApplicationPreferencesPanel = new JPanel();
106: TheApplicationPreferencesPanel.setLayout(new BorderLayout());
107:
108: TheAppCenterPanel = new JPanel();
109: TheAppCenterPanel.setLayout(new GridLayout(7, 2, 2, 4));
110:
111: TheAppCenterPanel.add(new JLabel(resourceBundle
112: .getString("PrefsAppLNFLabel")));
113:
114: TheAppLNFComboBox = new JComboBox();
115:
116: LNFInfos = UIManager.getInstalledLookAndFeels();
117: for (int i = 0; i < LNFInfos.length; i++) {
118: TheAppLNFComboBox.addItem(LNFInfos[i].getName());
119: if (LNFInfos[i].getName().equals(
120: UIManager.getLookAndFeel().getName())) {
121: TheAppLNFComboBox.setSelectedIndex(i);
122: }
123: }
124:
125: TheAppLNFComboBox.setEditable(false);
126: TheAppLNFComboBox.setEnabled(true);
127: TheAppLNFComboBox.addActionListener(this );
128: TheAppLNFComboBox.setToolTipText(resourceBundle
129: .getString("ToolTipAppLNFComboBoxDescription"));
130: TheAppLNFComboBox
131: .getAccessibleContext()
132: .setAccessibleDescription(
133: resourceBundle
134: .getString("AppLNFComboBoxDescription"));
135:
136: TheAppCenterPanel.add(TheAppLNFComboBox);
137:
138: locales = locale.getAvailableLocales();
139:
140: TheAppCenterPanel.add(new JLabel(resourceBundle
141: .getString("PrefsAppCLLabel")));
142: TheAppCLComboBox = new JComboBox();
143:
144: for (int i = 0; i < locales.length; i++) {
145: TheAppCLComboBox.addItem(locales[i].getDisplayLanguage());
146: if (locales[i].equals(locale)) {
147: TheAppCLComboBox.setSelectedIndex(i);
148: }
149: }
150:
151: TheAppCLComboBox.setEditable(false);
152: TheAppCLComboBox.setEnabled(true);
153: TheAppCLComboBox.addActionListener(this );
154: TheAppCLComboBox.setToolTipText(resourceBundle
155: .getString("ToolTipAppCLComboBoxDescription"));
156: TheAppCLComboBox.getAccessibleContext()
157: .setAccessibleDescription(
158: resourceBundle
159: .getString("AppCLComboBoxDescription"));
160: TheAppCenterPanel.add(TheAppCLComboBox);
161:
162: TheAppCenterPanel.add(new JLabel(resourceBundle
163: .getString("PrefsAppCCLabel")));
164: TheAppCCComboBox = new JComboBox();
165:
166: for (int i = 0; i < locales.length; i++) {
167: TheAppCCComboBox.addItem(locales[i].getDisplayCountry());
168: if (locales[i] == locales[i].getDefault()) {
169: TheAppCCComboBox.setSelectedIndex(i);
170: }
171: }
172:
173: TheAppCCComboBox.setEditable(false);
174: TheAppCCComboBox.setEnabled(true);
175: TheAppCCComboBox.addActionListener(this );
176: TheAppCCComboBox.setToolTipText(resourceBundle
177: .getString("ToolTipAppCCComboBoxDescription"));
178: TheAppCCComboBox.getAccessibleContext()
179: .setAccessibleDescription(
180: resourceBundle
181: .getString("AppCCComboBoxDescription"));
182: TheAppCenterPanel.add(TheAppCCComboBox);
183:
184: TheAppCenterPanel.add(new JLabel(resourceBundle
185: .getString("PrefsAppDBLabel")));
186: TheAppDBComboBox = new JComboBox();
187:
188: TheAppDBComboBox.addItem(resourceBundle
189: .getString("PrefsAppDBEnabled"));
190: TheAppDBComboBox.addItem(resourceBundle
191: .getString("PrefsAppDBDisabled"));
192:
193: if (canvas3D.getDoubleBufferAvailable()) {
194: if (canvas3D.getDoubleBufferEnable()) {
195: TheAppDBComboBox.setSelectedIndex(0);
196: } else {
197: TheAppDBComboBox.setSelectedIndex(1);
198: }
199: } else {
200: TheAppDBComboBox.setSelectedIndex(1);
201: }
202:
203: TheAppDBComboBox.setEditable(false);
204: TheAppDBComboBox
205: .setEnabled(canvas3D.getDoubleBufferAvailable());
206: TheAppDBComboBox.addActionListener(this );
207: TheAppDBComboBox.setToolTipText(resourceBundle
208: .getString("ToolTipAppDBComboBoxDescription"));
209: TheAppDBComboBox.getAccessibleContext()
210: .setAccessibleDescription(
211: resourceBundle
212: .getString("AppDBComboBoxDescription"));
213: TheAppCenterPanel.add(TheAppDBComboBox);
214:
215: TheAppCenterPanel.add(new JLabel(resourceBundle
216: .getString("PrefsAppSLabel")));
217: TheAppSComboBox = new JComboBox();
218:
219: TheAppSComboBox.addItem(resourceBundle
220: .getString("PrefsAppSEnabled"));
221: TheAppSComboBox.addItem(resourceBundle
222: .getString("PrefsAppSDisabled"));
223:
224: if (canvas3D.getStereoAvailable()) {
225: if (canvas3D.getStereoEnable()) {
226: TheAppSComboBox.setSelectedIndex(0);
227: } else {
228: TheAppSComboBox.setSelectedIndex(1);
229: }
230: } else {
231: TheAppSComboBox.setSelectedIndex(1);
232: }
233:
234: TheAppSComboBox.setEditable(false);
235: TheAppSComboBox.setEnabled(canvas3D.getStereoAvailable());
236: TheAppSComboBox.addActionListener(this );
237: TheAppSComboBox.setToolTipText(resourceBundle
238: .getString("ToolTipAppSComboBoxDescription"));
239: TheAppSComboBox.getAccessibleContext()
240: .setAccessibleDescription(
241: resourceBundle
242: .getString("AppSComboBoxDescription"));
243: TheAppCenterPanel.add(TheAppSComboBox);
244:
245: TheAppCenterPanel.add(new JLabel(resourceBundle
246: .getString("PrefsAppTLabel")));
247: TheAppTTextField = new JTextField(10);
248:
249: TheAppTTextField.setText(((Integer) canvas3D.queryProperties()
250: .get("textureColorTableSize")).toString());
251:
252: //TheAppTTextField.setEditable(((Boolean)canvas3D.queryProperties().get("texture3DAvailable")).booleanValue());
253: TheAppTTextField.setEditable(false);
254: TheAppTTextField.setEnabled(((Boolean) canvas3D
255: .queryProperties().get("texture3DAvailable"))
256: .booleanValue());
257: TheAppTTextField.addInputMethodListener(this );
258: TheAppTTextField.setToolTipText(resourceBundle
259: .getString("ToolTipAppTTextFieldDescription"));
260: TheAppTTextField.getAccessibleContext()
261: .setAccessibleDescription(
262: resourceBundle
263: .getString("AppTTextFieldDescription"));
264: TheAppCenterPanel.add(TheAppTTextField);
265:
266: TheAppCenterPanel.add(new JLabel(resourceBundle
267: .getString("PrefsAppSALabel")));
268: TheAppSAComboBox = new JComboBox();
269:
270: TheAppSAComboBox.addItem(resourceBundle
271: .getString("PrefsAppSAEnabled"));
272: TheAppSAComboBox.addItem(resourceBundle
273: .getString("PrefsAppSADisabled"));
274:
275: if (view.getSceneAntialiasingEnable()) {
276: TheAppSAComboBox.setSelectedIndex(0);
277: } else {
278: TheAppSAComboBox.setSelectedIndex(1);
279: }
280:
281: TheAppSAComboBox.setEditable(false);
282: TheAppSAComboBox.setEnabled(true);
283: TheAppSAComboBox.addActionListener(this );
284: TheAppSAComboBox.setToolTipText(resourceBundle
285: .getString("ToolTipAppSAComboBoxDescription"));
286: TheAppSAComboBox.getAccessibleContext()
287: .setAccessibleDescription(
288: resourceBundle
289: .getString("AppSAComboBoxDescription"));
290: TheAppCenterPanel.add(TheAppSAComboBox);
291:
292: TheAppCenterPanel.add(new JLabel(resourceBundle
293: .getString("PrefsAppJSMLabel")));
294: TheAppJSMComboBox = new JComboBox();
295:
296: TheAppJSMComboBox.addItem(resourceBundle
297: .getString("PrefsAppJSMNone"));
298: TheAppJSMComboBox.addItem(resourceBundle
299: .getString("PrefsAppJSMHeadphones"));
300: TheAppJSMComboBox.addItem(resourceBundle
301: .getString("PrefsAppJSMMono"));
302: TheAppJSMComboBox.addItem(resourceBundle
303: .getString("PrefsAppJSMStereo"));
304:
305: TheAppJSMComboBox.setEnabled(true);
306:
307: if (javaSoundMixer.getAudioPlaybackType() == AudioDevice.HEADPHONES) {
308: TheAppJSMComboBox.setSelectedIndex(1);
309: } else if (javaSoundMixer.getAudioPlaybackType() == AudioDevice.MONO_SPEAKER) {
310: TheAppJSMComboBox.setSelectedIndex(2);
311: } else if (javaSoundMixer.getAudioPlaybackType() == AudioDevice.STEREO_SPEAKERS) {
312: TheAppJSMComboBox.setSelectedIndex(3);
313: } else {
314: TheAppJSMComboBox.setSelectedIndex(0);
315: TheAppJSMComboBox.setEnabled(false);
316: }
317:
318: TheAppJSMComboBox.setEditable(false);
319: TheAppJSMComboBox.addActionListener(this );
320: TheAppJSMComboBox.setToolTipText(resourceBundle
321: .getString("ToolTipAppJSMComboBoxDescription"));
322: TheAppJSMComboBox
323: .getAccessibleContext()
324: .setAccessibleDescription(
325: resourceBundle
326: .getString("AppJSMComboBoxDescription"));
327: TheAppCenterPanel.add(TheAppJSMComboBox);
328:
329: TheApplicationPreferencesPanel.add(TheAppCenterPanel, "Center");
330:
331: TheSystemPreferencesPanel = new JPanel();
332: TheSystemPreferencesPanel.setLayout(new BorderLayout());
333:
334: TheSysCenterPanel = new JPanel();
335:
336: classLoader = getClass().getClassLoader();
337:
338: information = new String(resourceBundle
339: .getString("PrefsSysPackageInformation"));
340:
341: information.concat(packageInformation(classLoader,
342: "javax.vecmath", "Point3d", resourceBundle));
343: information.concat(packageInformation(classLoader,
344: "javax.media.j3d", "SceneGraphObject", resourceBundle));
345: information.concat(packageInformation(classLoader,
346: "javax.media.volumeimage", "RenderedVolumeImage",
347: resourceBundle));
348: information.concat(packageInformation(classLoader,
349: "com.sun.j3d.utils.universe", "SimpleUniverse",
350: resourceBundle));
351:
352: information.concat(resourceBundle
353: .getString("PrefsSysOSInformation"));
354:
355: information.concat(javaInformation("file.separator",
356: resourceBundle));
357: information.concat(javaInformation("line.separator",
358: resourceBundle));
359: information.concat(javaInformation("path.separator",
360: resourceBundle));
361: information.concat(javaInformation("java.version",
362: resourceBundle));
363: information.concat(javaInformation("java.vendor",
364: resourceBundle));
365: information.concat(javaInformation("java.vendor.url",
366: resourceBundle));
367: information.concat(javaInformation(
368: "java.vm.specification.version", resourceBundle));
369: information.concat(javaInformation(
370: "java.vm.specification.vendor", resourceBundle));
371: information.concat(javaInformation(
372: "java.vm.specification.name", resourceBundle));
373: information.concat(javaInformation("java.vm.version",
374: resourceBundle));
375: information.concat(javaInformation("java.vm.vendor",
376: resourceBundle));
377: information.concat(javaInformation("java.vm.name",
378: resourceBundle));
379: information.concat(javaInformation(
380: "java.specification.version", resourceBundle));
381: information.concat(javaInformation("java.specification.vendor",
382: resourceBundle));
383: information.concat(javaInformation("java.specification.name",
384: resourceBundle));
385: information.concat(javaInformation("os.name", resourceBundle));
386: information.concat(javaInformation("os.arch", resourceBundle));
387: information
388: .concat(javaInformation("os.version", resourceBundle));
389: information.concat(javaInformation("java.class.version",
390: resourceBundle));
391:
392: TheSysTextArea = new JTextArea(information, 15, 45);
393: TheSysTextArea.setEditable(false);
394: TheSysTextArea.setToolTipText(resourceBundle
395: .getString("PrefsSysToolTipTextAreaDescription"));
396: TheSysTextArea
397: .getAccessibleContext()
398: .setAccessibleDescription(
399: resourceBundle
400: .getString("PrefsSysTextAreaDescription"));
401:
402: TheScrollPane = new JScrollPane(TheSysTextArea,
403: JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
404: JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
405: TheScrollPane.setToolTipText(resourceBundle
406: .getString("PrefsSysToolTipScrollPaneDescription"));
407: TheScrollPane.getAccessibleContext().setAccessibleDescription(
408: resourceBundle
409: .getString("PrefsSysScrollPaneDescription"));
410:
411: TheSysCenterPanel.add(TheScrollPane);
412:
413: TheSystemPreferencesPanel.add(TheSysCenterPanel, "Center");
414:
415: TheTabbedPane.addTab(resourceBundle
416: .getString("PrefsAppTabDescription"),
417: TheApplicationPreferencesPanel);
418: TheTabbedPane.addTab(resourceBundle
419: .getString("PrefsSysTabDescription"),
420: TheSystemPreferencesPanel);
421: TheTabbedPane.setToolTipTextAt(0, resourceBundle
422: .getString("PrefsToolTipAppDescription"));
423: TheTabbedPane.setToolTipTextAt(1, resourceBundle
424: .getString("PrefsToolTipSysDescription"));
425:
426: TheTabbedPane.getAccessibleContext().setAccessibleDescription(
427: resourceBundle.getString("PrefsTabbedPaneDescription"));
428:
429: TheBottomPanel = new JPanel();
430:
431: TheCloseButton = new JButton(resourceBundle
432: .getString("PrefsCloseButton"));
433:
434: TheBottomPanel.add(TheCloseButton);
435: TheCloseButton.addActionListener(this );
436: TheCloseButton.setToolTipText(resourceBundle
437: .getString("PrefsToolTipCloseButtonDescription"));
438: TheCloseButton
439: .getAccessibleContext()
440: .setAccessibleDescription(
441: resourceBundle
442: .getString("PrefsCloseButtonDescription"));
443:
444: this .getContentPane().add(TheBottomPanel, "South");
445:
446: /* The following code is to close the windows. */
447:
448: this .addWindowListener(new WindowAdapter() {
449:
450: public void windowClosing(WindowEvent e) {
451:
452: setVisible(false);
453: dispose();
454:
455: }
456:
457: });
458:
459: this .addWindowListener(new WindowAdapter() {
460:
461: public void windowIconified(WindowEvent e) {
462:
463: setVisible(false);
464: dispose();
465:
466: }
467:
468: });
469:
470: }
471:
472: public void actionPerformed(ActionEvent TheActionEvent) {
473:
474: Object TheObject;
475:
476: TheObject = TheActionEvent.getSource();
477:
478: if (TheObject instanceof JButton) {
479: if (TheObject == TheCloseButton) {
480: this .TheCloseCommand();
481: }
482: } else if (TheObject instanceof JComboBox) {
483: if (TheObject == TheAppLNFComboBox) {
484: try {
485: UIManager.setLookAndFeel(LNFInfos[TheAppCLComboBox
486: .getSelectedIndex()].getClassName());
487: SwingUtilities.updateComponentTreeUI(this );
488: environmentProperties.put("currentlookandfeel",
489: LNFInfos[TheAppCLComboBox
490: .getSelectedIndex()].getName());
491: } catch (Exception exception) {
492: for (int i = 0; i < LNFInfos.length; i++) {
493: if (LNFInfos[i].getName().equals(
494: UIManager.getLookAndFeel().getName())) {
495: environmentProperties.put(
496: "currentlookandfeel", LNFInfos[i]
497: .getName());
498: TheAppLNFComboBox.setSelectedIndex(i);
499: }
500: }
501: }
502: } else if (TheObject == TheAppCLComboBox) {
503: try {
504: java.util.Locale newlocale = new java.util.Locale(
505: locales[TheAppCLComboBox.getSelectedIndex()]
506: .getLanguage(),
507: locales[TheAppCCComboBox.getSelectedIndex()]
508: .getCountry());
509: resourceBundle = ResourceBundle.getBundle(
510: "ResourceBundle", newlocale);
511: //force every component to be laid out again
512: invalidate();
513: validate();
514: repaint();
515: environmentProperties
516: .put("currentlanguage",
517: locales[TheAppCLComboBox
518: .getSelectedIndex()]
519: .getLanguage());
520: } catch (MissingResourceException exception) {
521: //may be we sould not set values back to default since user also has to change the country to define a new locale
522: for (int i = 0; i < locales.length; i++) {
523: if (locales[i].equals(locale)) {
524: TheAppCLComboBox.setSelectedIndex(i);
525: }
526: }
527: environmentProperties.put("currentlanguage", locale
528: .getLanguage());
529: }
530: } else if (TheObject == TheAppCCComboBox) {
531: try {
532: java.util.Locale newlocale = new java.util.Locale(
533: locales[TheAppCLComboBox.getSelectedIndex()]
534: .getLanguage(),
535: locales[TheAppCCComboBox.getSelectedIndex()]
536: .getCountry());
537: resourceBundle = ResourceBundle.getBundle(
538: "ResourceBundle", newlocale);
539: //force every component to be laid out again
540: invalidate();
541: validate();
542: repaint();
543: environmentProperties
544: .put("currentcountry",
545: locales[TheAppCCComboBox
546: .getSelectedIndex()]
547: .getCountry());
548: } catch (MissingResourceException exception) {
549: //may be we sould not set values back to default since user also has to change the language to define a new locale
550: for (int i = 0; i < locales.length; i++) {
551: if (locales[i].equals(locale)) {
552: TheAppCCComboBox.setSelectedIndex(i);
553: }
554: }
555: environmentProperties.put("currentcountry", locale
556: .getCountry());
557: }
558: } else if (TheObject == TheAppDBComboBox) {
559: if (TheAppDBComboBox.getSelectedIndex() == 0) {
560: canvas3D.setDoubleBufferEnable(true);
561: environmentProperties.put("doublebufferenable",
562: new Boolean(true));
563: } else {
564: canvas3D.setDoubleBufferEnable(false);
565: environmentProperties.put("doublebufferenable",
566: new Boolean(false));
567: }
568: } else if (TheObject == TheAppSComboBox) {
569: if (TheAppSComboBox.getSelectedIndex() == 0) {
570: canvas3D.setStereoEnable(true);
571: environmentProperties.put("stereoenable",
572: new Boolean(true));
573: } else {
574: canvas3D.setStereoEnable(false);
575: environmentProperties.put("stereoenable",
576: new Boolean(false));
577: }
578: } else if (TheObject == TheAppSAComboBox) {
579: if (TheAppSAComboBox.getSelectedIndex() == 0) {
580: view.setSceneAntialiasingEnable(true);
581: environmentProperties.put(
582: "sceneantialiasingenable",
583: new Boolean(true));
584: } else {
585: view.setSceneAntialiasingEnable(false);
586: environmentProperties.put(
587: "sceneantialiasingenable", new Boolean(
588: false));
589: }
590: } else if (TheObject == TheAppJSMComboBox) {
591: if (TheAppJSMComboBox.getSelectedIndex() == 0) {
592: //javaSoundMixer.setAudioPlaybackType(int type);
593: environmentProperties.put("audioplaybacktype",
594: new Integer(0));
595: } else if (TheAppJSMComboBox.getSelectedIndex() == 1) {
596: javaSoundMixer
597: .setAudioPlaybackType(AudioDevice.HEADPHONES);
598: environmentProperties.put("audioplaybacktype",
599: new Integer(AudioDevice.HEADPHONES));
600: } else if (TheAppJSMComboBox.getSelectedIndex() == 2) {
601: javaSoundMixer
602: .setAudioPlaybackType(AudioDevice.MONO_SPEAKER);
603: environmentProperties.put("audioplaybacktype",
604: new Integer(AudioDevice.MONO_SPEAKER));
605: } else if (TheAppJSMComboBox.getSelectedIndex() == 3) {
606: javaSoundMixer
607: .setAudioPlaybackType(AudioDevice.STEREO_SPEAKERS);
608: environmentProperties.put("audioplaybacktype",
609: new Integer(AudioDevice.STEREO_SPEAKERS));
610: }
611: }
612: }
613:
614: }
615:
616: public void caretPositionChanged(
617: InputMethodEvent TheInputMethodEvent) {
618:
619: }
620:
621: public void inputMethodTextChanged(
622: InputMethodEvent TheInputMethodEvent) {
623:
624: Object TheObject;
625:
626: TheObject = TheInputMethodEvent.getSource();
627:
628: if (TheObject instanceof JTextField) {
629: if (TheObject == TheAppTTextField) {
630: try {
631: //not supported yet as of java3d 1.2
632: //Integer tableSize = new Integer(TheAppTTextField.getText());
633: //environmentProperties.put("texturecolortablesize", tableSize);
634: //canvas3D.setColorTableSize(tableSize);
635: environmentProperties.put("texturecolortablesize",
636: (Integer) canvas3D.queryProperties().get(
637: "textureColorTableSize"));
638: } catch (NumberFormatException exception) {
639: TheAppTTextField.setText(((Integer) canvas3D
640: .queryProperties().get(
641: "textureColorTableSize"))
642: .toString());
643: }
644: }
645: }
646:
647: }
648:
649: private void TheCloseCommand() {
650:
651: this .setVisible(false);
652: this .dispose();
653:
654: }
655:
656: private String packageInformation(ClassLoader classLoader,
657: String packageName, String className,
658: ResourceBundle resourceBundle) {
659:
660: String information;
661:
662: information = new String();
663:
664: try {
665: classLoader.loadClass(packageName + "." + className);
666: Package ThePackage = Package.getPackage(packageName);
667: if (ThePackage != null) {
668: information.concat(ThePackage.getName()
669: + resourceBundle.getString("SpaceDot"));
670: information.concat(resourceBundle
671: .getString("SpecificationTitle")
672: + resourceBundle.getString("SpaceDot")
673: + " "
674: + ThePackage.getSpecificationTitle() + ".\n");
675: information.concat(resourceBundle
676: .getString("SpecificationVendor")
677: + resourceBundle.getString("SpaceDot")
678: + " "
679: + ThePackage.getSpecificationVendor() + ".\n");
680: information.concat(resourceBundle
681: .getString("SpecificationVersion")
682: + resourceBundle.getString("SpaceDot")
683: + " "
684: + ThePackage.getSpecificationVersion() + ".\n");
685: information.concat(resourceBundle
686: .getString("ImplementationVendor")
687: + resourceBundle.getString("SpaceDot")
688: + " "
689: + ThePackage.getImplementationVendor() + ".\n");
690: information
691: .concat(resourceBundle
692: .getString("ImplementationVersion")
693: + resourceBundle.getString("SpaceDot")
694: + " "
695: + ThePackage.getImplementationVersion()
696: + ".\n");
697: }
698: } catch (ClassNotFoundException exception) {
699: }
700:
701: return information;
702:
703: }
704:
705: private String javaInformation(String propertyName,
706: ResourceBundle resourceBundle) {
707:
708: String information;
709:
710: information = new String(propertyName
711: + resourceBundle.getString("SpaceDot"));
712:
713: try {
714: information
715: .concat(System.getProperty(propertyName) + ".\n");
716: } catch (SecurityException e) {
717: information.concat(resourceBundle
718: .getString("UnknownPropertyValue")
719: + ".\n");
720: }
721:
722: return information;
723:
724: }
725:
726: }
|