Results 1 to 1 of 1
- 10-23-2008, 10:23 AM #1
Member
- Join Date
- Aug 2007
- Posts
- 44
- Rep Power
- 0
Auto updation of Editable Column Indexes
Dear Friends
I am creating a class EditableTable (Bean component) that has a set for maintaining editable comlumn indexs.
I have created following function in this class:-Java Code:public TreeSet<Integer> editableColumnIndexes=new TreeSet<Integer>();
Now, Whenever programmer (Who will use this bean component) made changes in model such as:Java Code:/** * If we change the editable condition of Column/Cell then we have to call this method. */ public void updateEditableColumns() { editableColumnIndexes.clear(); for (int colIndex = 0; colIndex < getColumnCount(); colIndex++) if(isCellEditable(0,colIndex)) editableColumnIndexes.add(colIndex); }
Then user must call expicitly:Java Code:editableTable1 = new gajesh.widget.EditableTable(); editableTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4", "Title 5" } ) { Class[] types = new Class [] { java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Boolean.class }; boolean[] canEdit = new boolean [] { false, true, true, false, true }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } });
I WANT TO avoid this explicitly call of updateEditableColumns() i.e. User whenever change editable conidition of column/cell thenJava Code:editableTable1.updateEditableColumns();
What method should be overriden by me in class EditableTable?
OR
What listener should be add int EditableTable's Constructor?
Thanks
GAJESH TRIPATHI
Similar Threads
-
insert row and column and delete row and column
By daredavil82 in forum New To JavaReplies: 13Last Post: 09-22-2011, 06:10 PM -
JScrollPane updation Problem
By goodwillwins in forum AWT / SwingReplies: 22Last Post: 09-28-2008, 09:11 AM -
Auto-complete/Auto-fix for custom statement
By dark_cybernetics in forum EclipseReplies: 0Last Post: 08-19-2008, 11:19 AM -
Creating a non-editable combo box
By Java Tip in forum SWTReplies: 0Last Post: 07-07-2008, 04:45 PM -
How can i set the table's column dragable/movable false and cell editable
By johnt in forum AWT / SwingReplies: 4Last Post: 05-19-2007, 11:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks