Swing/DividerLocation のバックアップソース(No.2)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Swing/DividerLocation へ行く。
- 1 (2011-11-14 (月) 11:38:21)
- 2 (2011-11-29 (火) 16:45:19)
- 3 (2012-12-30 (日) 09:22:40)
- 4 (2014-10-25 (土) 23:50:43)
- 5 (2015-11-22 (日) 14:03:18)
- 6 (2017-05-25 (木) 13:52:30)
- 7 (2018-05-11 (金) 16:32:24)
- 8 (2019-05-31 (金) 17:09:21)
- 9 (2021-02-19 (金) 04:19:04)
- 10 (2025-01-03 (金) 08:57:02)
- 11 (2025-01-03 (金) 09:01:23)
- 12 (2025-01-03 (金) 09:02:38)
- 13 (2025-01-03 (金) 09:03:21)
- 14 (2025-01-03 (金) 09:04:02)
- 15 (2025-06-19 (木) 12:41:37)
- 16 (2025-06-19 (木) 12:43:47)
TITLE:JSplitPaneを等分割する #navi(../) RIGHT:Posted by [[aterai]] at 2010-06-28 *JSplitPaneを等分割する [#mabfea1e] JSplitPaneのディバイダが中央にくるように設定します。 -&jnlp; -&jar; -&zip; //#screenshot #ref(http://lh5.ggpht.com/_9Z4BYR88imo/TQTLR0Z5M_I/AAAAAAAAAXU/R6r6dvVJa9M/s800/DividerLocation.png) **サンプルコード [#mdde9cfa] #code{{ EventQueue.invokeLater(new Runnable() { @Override public void run() { sp.setDividerLocation(0.5); //sp.setResizeWeight(0.5); } }); }} **解説 [#p41e1a6c] 上記のサンプルでは、JSplitPaneのサイズが決まった後(例えばJFrame#pack()や、JFrame#setSize(int,int)などした後)で、JSplitPane#setDividerLocation(0.5); を使用し、ディバイダを中央に配置しています。 ---- JSplitPane#setResizeWeight(double)を使用し、JSplitPane内に配置したコンポーネント(JScrollPane)の余ったスペースの配分が同じになるようにして、ディバイダを中央に配置する方法もあります。 //**参考リンク **コメント [#k7e6f9ad] #comment