Swing/WheelCombo のバックアップソース(No.5)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Swing/WheelCombo へ行く。
- 1 (2004-11-15 (月) 02:34:50)
- 2 (2005-04-28 (木) 04:33:11)
- 3 (2005-06-08 (水) 02:19:53)
- 4 (2005-07-01 (金) 17:04:53)
- 5 (2005-09-21 (水) 21:53:37)
- 6 (2006-02-27 (月) 16:39:06)
- 7 (2007-03-10 (土) 01:38:00)
- 8 (2007-10-06 (土) 21:29:51)
- 9 (2012-06-21 (木) 20:34:37)
- 10 (2013-04-14 (日) 00:27:22)
- 11 (2015-01-30 (金) 19:38:48)
- 12 (2016-08-03 (水) 17:05:05)
- 13 (2017-09-18 (月) 18:48:11)
- 14 (2019-02-22 (金) 20:33:46)
- 15 (2020-12-08 (火) 10:55:09)
- 16 (2021-11-16 (火) 08:22:44)
#navi(../) *JComboBoxの値をMouseWheelで変更 [#i7ef2fc7] >編集者:[[Terai Atsuhiro>terai]]~ 作成日:2004-11-15~ 更新日:&lastmod; #contents **概要 [#fb21376c] JComboBoxにフォーカスがある場合、その値をMouseWheelの上下で変更します。 http://terai.xrea.jp/swing/wheelcombo/screenshot.png **サンプルコード [#ef581a0a] combo.addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { JComboBox source = (JComboBox) e.getSource(); if(!source.hasFocus()) return; int ni = source.getSelectedIndex() + e.getWheelRotation(); if(ni>=0 && ni<source.getItemCount()) { source.setSelectedIndex(ni); } } }); -[[サンプルを起動>http://terai.xrea.jp/swing/wheelcombo/sample.jnlp]] -[[jarファイル>http://terai.xrea.jp/swing/wheelcombo/sample.jar]] -[[ソース>http://terai.xrea.jp/swing/wheelcombo/src.zip]] **解説 [#r2f99b4c] 上記のサンプルでは、一番上のコンボボックスにMouseWheelListenerが設定され、マウスホイールの上下回転に反応して、表示される内容が順次移動していきます。 //**参考リンク **コメント [#ebca23c2] #comment