Swing/IntercellSpacing のバックアップソース(No.1)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Swing/IntercellSpacing へ行く。
TITLE:JTableの罫線の有無とセルの内余白を変更 #navi(../) RIGHT:Posted by &author(aterai); at 2011-05-30 *JTableの罫線の有無とセルの内余白を変更 [#mb66743f] JTableの罫線の表示非表示とセルの内余白を変更します。 -&jnlp; -&jar; -&zip; //#screenshot #ref(https://lh3.googleusercontent.com/-zDg_KUxGwU4/TeNHkhhJYGI/AAAAAAAAA8M/G5R8rKLVzUg/s800/IntercellSpacing.png) **サンプルコード [#hf7ab7cd] #code(link){{ Dimension d = table.getIntercellSpacing(); table.setShowVerticalLines(false); table.setIntercellSpacing(new Dimension(0,d.height)); //table.setShowHorizontalLines(false); //table.setIntercellSpacing(new Dimension(d.width,0)); }} **解説 [#y7260618] JTableの罫線を非表示にしてもセルの内余白が0でない場合、選択状態でその内余白が表示されるので、上記のサンプルでは、JTable#setShowVerticalLines(boolean)などと一緒に、JTable#setIntercellSpacing(Dimension)で余白を0に切り替えています。 - 罫線 -- JTable#setShowVerticalLines(boolean); -- JTable#setShowHorizontalLines(boolean); - セルの内余白 -- JTable#setIntercellSpacing(Dimension intercellSpacing); --- JTable#setRowMargin(intercellSpacing.height); --- JTable#getColumnModel().setColumnMargin(intercellSpacing.width); //**参考リンク **コメント [#j8f013a4] #comment