Swing/InvertedSlider のバックアップ差分(No.11)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/InvertedSlider へ行く。
- 1 (2014-02-10 (月) 00:01:53)
- 2 (2014-02-26 (水) 21:22:55)
- 3 (2014-09-20 (土) 15:59:42)
- 4 (2014-09-29 (月) 18:02:48)
- 5 (2015-07-08 (水) 16:56:22)
- 6 (2017-03-24 (金) 12:39:54)
- 7 (2018-01-24 (水) 17:39:57)
- 8 (2020-01-09 (木) 23:18:42)
- 9 (2021-07-10 (土) 04:35:21)
- 10 (2022-07-18 (月) 09:31:59)
- 11 (2024-01-09 (火) 16:23:47)
- 12 (2024-01-09 (火) 17:59:08)
- 追加された行はこの色です。
- 削除された行はこの色です。
---
category: swing
folder: InvertedSlider
title: JSliderの順序を反転
tags: [JSlider]
author: aterai
pubdate: 2014-02-10T00:01:53+09:00
description: JSliderの値や目盛りの表示などの順序を反転します。
image: https://lh6.googleusercontent.com/-qI_Mv8LOhi8/UvdK3TThMiI/AAAAAAAAB_0/xQR9OJ1Z8xY/s800/InvertedSlider.png
---
* 概要 [#summary]
`JSlider`の値や目盛りの表示などの順序を反転します。
#download(https://lh6.googleusercontent.com/-qI_Mv8LOhi8/UvdK3TThMiI/AAAAAAAAB_0/xQR9OJ1Z8xY/s800/InvertedSlider.png)
* サンプルコード [#sourcecode]
#code(link){{
slider.setInverted(true);
}}
* 解説 [#explanation]
上記のサンプルでは、`JSlider#setInverted(true)`で値や目盛りの表示位置を反転しています。
- `JSlider#setInverted(true)`は言語に依存する方向設定の`setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)`と同時に指定可能
-- `SwingConstants.HORIZONTAL`の場合両方指定すると表示は元に戻る
-- `SwingConstants.VERTICAL`の場合`JSlider#setInverted(true)`で上方向が最小値・下方向が最大値に変化し、`setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)`で目盛りの位置が右側から左側に変化する
- 範囲の塗り潰しが可能な`MetalLookAndFeel`の場合その範囲も反転する
- 縦の`JSlider`で`ComponentOrientation.RIGHT_TO_LEFT`、`WindowsLookAndFeel`を設定した場合ノブのフォーカスが描画されない
* 参考リンク [#reference]
- [https://docs.oracle.com/javase/jp/8/docs/api/javax/swing/JSlider.html#setInverted-boolean- JSlider#setInverted(boolean) (Java Platform SE 8)]
- [[JSliderの目盛り表示位置をトラック上部に変更する>Swing/SliderTicksPosition]]
* コメント [#comment]
#comment
#comment