Sachin,

thanks for the reply. See my comments below

1. yup,this works. I was using keyReleased instead of keyPressed.

2. lets say you have a table with isCellEditable = true and no
   other properties are set. Then, in this case, you can start
   editing BOTH by just a single click and a double click in the field.
   However when you double click only at that time startCellEditing
   is not called and NOT when you have single clicked and started
   editing. So the question is why editing starts just by single
   clicking ?

- Peter
--- Sachin Hejip <[EMAIL PROTECTED]> wrote:
> Hey,
> 
> 1.
> 
>         table.addKeyListener(new KeyAdapter() {
>              public void keyPressed( java.awt.event.KeyEvent e ) {
>                  if (e.getKeyCode() == KeyEvent.VK_TAB) {
>                     int row = table.getSelectedRow();
>                     int col = table.getSelectedColumn();
>                     System.out.println("row = " + row);
>                     System.out.println("col = " + col);
>                     if (row == table.getModel().getRowCount() - 1 &&
> col ==
> 2) {
>                        
> ((DefaultTableModel)table.getModel()).addRow(new
> String[] { "", "", "" });
>                     }
>                  }
>              }
>         });
> 
> This does what you wanted for a JTable created using JTable table =
> new
> JTable(3, 3).
> 
> 2.
> I am sorry, I didnt understand the question. What was the behaviour
> you
> expected? You can change the number of mouse clicks to start editing
> by
> using the method setClickCountToStart in DefaultCellEditor.
> 
> Hope this helps.
> 
> Regards
> Sachin
> 
> ----- Original Message -----
> From: "Peter Peterson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 11, 2002 6:21 AM
> Subject: JTable question ...another...
> 
> 
> > Hi All,
> >
> > JTable editing is just tedious. I am having so many problems, one
> > after another.
> >
> > here are my question.
> >
> > 1. I have a JTable and its editable. Its has SINGLE_SELECTION
> policy
> >    set on it. When I tab from one column to another, it puts a
> faint
> >    black box around a cell. Is this cell selection or eidting ?
> >    I dont get correct column when I use getEditingColumn() and also
> >    getSelectedColumn(). Editing column is properly returned ONLY
> >    when I double click into the cell and selection column is
> >    properly returned ONLY when there is that blue color highlighing
> >    on a cell of a column. Then what is the black box ? If that
> > represent
> >    just focus, how to I find out which column has focus ?
> >
> >    Basically when user tabs out of last column, I want to add a row
> >    to the table and I want to do this only when user has tabbed out
> >    of last column of a last row.
> >
> > 2. I have a table model which returns true for isEditable. When I
> >    tab from one column to another, why editing is allowed, because
> >    I can just start typing and into the cell. Its very
> >    confusing when JTable allows editing, just by having a focus on
> >    a cell or by double clicking on it. ( in case of double click,
> >    it changes cell into, I think, a text field. )
> >
> > Any ideas whats going on ?
> >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Faith Hill - Exclusive Performances, Videos & More
> > http://faith.yahoo.com
> > _______________________________________________
> > Swing mailing list
> > [EMAIL PROTECTED]
> > http://eos.dk/mailman/listinfo/swing
> 
> 


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to