Swing/AuditoryCues のバックアップソース(No.3)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Swing/AuditoryCues へ行く。
- 1 (2008-05-26 (月) 17:13:17)
- 2 (2008-06-26 (木) 13:59:57)
- 3 (2008-10-08 (水) 17:25:29)
- 4 (2008-11-21 (金) 11:58:11)
- 5 (2009-01-08 (木) 15:58:36)
- 6 (2010-12-12 (日) 23:21:21)
- 7 (2014-10-02 (木) 03:52:59)
- 8 (2015-11-06 (金) 04:15:10)
- 9 (2016-05-26 (木) 14:33:35)
- 10 (2017-08-17 (木) 14:21:43)
- 11 (2017-11-02 (木) 15:31:07)
- 12 (2018-02-21 (水) 15:20:06)
- 13 (2018-11-08 (木) 17:48:07)
- 14 (2019-05-07 (火) 19:24:05)
- 15 (2021-02-05 (金) 08:28:39)
- 16 (2024-03-30 (土) 23:37:31)
TITLE:AuditoryCuesでイベント音を設定する #navi(../) *AuditoryCuesでイベント音を設定する [#v95f25a7] Posted by [[terai]] at 2008-05-26 #contents **概要 [#r477c4dc] UIManagerに"AuditoryCues.playList"を設定して、ダイアログが開いた時の警告音などを鳴らします。 -&jnlp; -&jar; -&zip; #screenshot **サンプルコード [#b4933fee] #code{{ Object[] optionPaneAuditoryCues = { "OptionPane.errorSound", "OptionPane.informationSound", "OptionPane.questionSound", "OptionPane.warningSound" }; //UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.allAuditoryCues")); //UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.defaultCueList")); //UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues")); UIManager.put("AuditoryCues.playList", optionPaneAuditoryCues); }} **解説 [#nb3f1b60] 上記のサンプルでは、デフォルトではすべて再生しないように設定されている聴覚フィードバックを、JOptionPaneでダイアログを開いた時には有効になるように変更しています。 -showMessageDialog1(左) --L&Fデフォルトの音が鳴る(L&Fにデフォルトの音が無い場合は鳴らない) --Windows L&F では、「コントロールパネル」「サウンドとオーディオデバイスのプロパティ」で、プログラムイベントが設定されている場合は鳴る -showMessageDialog2(右) --wavファイルで音を鳴らす --UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues"))として、二重に鳴らないようにしている ---- metalやmotif L&F では、以下のようにすることで、MessageDialogのイベント音を変更することも出来ます。 #code{{ UIManager.put("OptionPane.informationSound", "/example/notice2.wav"); }} **参考リンク [#t9700925] -[[Swing コンポーネントの音声フィードバック>http://java.sun.com/javase/ja/6/docs/ja/technotes/guides/swing/SwingChanges.html#Miscellaneous]] -[[Merlinの魔術: Swingのオーディオ>http://www.ibm.com/developerworks/jp/java/library/j-mer0730/]] -[["taitai studio" フリーWav素材集>http://www.taitaistudio.com/wav/]] --wavファイルを拝借しています。 **コメント [#k5553b1c] #comment