1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AsWingのJTableのセルを編集不可にする。

Last updated at Posted at 2012-12-26

超優秀なGUIライブラリAsWing( http://www.aswing.org )のTips

JTableはデフォルトだと、ダブルクリックでセルの編集が可能なのでこれを禁止する。

sample.as
table.setDefaultEditor( "Object", new AbstractCellEditor() );

結構、わかりづらかった。

追記:2012/03/15
上記のコードで、データを追加するときにエラーが出たので以下のコードがよさそう。

sample.as
var cellEditor:DefaultTextFieldCellEditor = new DefaultTextFieldCellEditor();
table.setDefaultEditor( "Object", cellEditor );
cellEditor.setClickCountToStart( Infinity );

追記:2012/04/13
Enterキーで編集可能だった。以下のコードなら問題ない?

sample.as
var cellEditor:DefaultTextFieldCellEditor = new DefaultTextFieldCellEditor();
table.setDefaultEditor( "Object", cellEditor );
cellEditor.getEditorComponent().visible = false;
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?