• category: swing folder: OnlyLeftMouseButtonDrag title: JSliderのノブをマウスの右ボタンで操作不可に設定する tags: [JSlider, UIManager] author: aterai pubdate: 2015-11-09T00:56:22+09:00 description: JSliderのノブをマウスの右ボタンで操作可能かどうかを設定で切り替えます。 image: https://lh3.googleusercontent.com/-coZSnO6AOYE/Vj9vbNsYp8I/AAAAAAAAOGA/2KnLThlR9u4/s800-Ic42/OnlyLeftMouseButtonDrag.png

概要

JSliderのノブをマウスの右ボタンで操作可能かどうかを設定で切り替えます。

サンプルコード

UIManager.put("Slider.onlyLeftMouseButtonDrag", Boolean.TRUE);
View in GitHub: Java, Kotlin

解説

  • UIManager.put("Slider.onlyLeftMouseButtonDrag", Boolean.TRUE)
    • JSliderのノブをマウスの右ボタンで選択、ドラッグしても操作不可
    • WindowsLookAndFeelなどのデフォルト
  • UIManager.put("Slider.onlyLeftMouseButtonDrag", Boolean.FALSE)
    • JSliderのノブをマウスの右ボタンで選択、ドラッグで操作可能
    • NimbusLookAndFeelなどのデフォルト

参考リンク

コメント