Re: JTable/Model/JTextField focus problem
From: Babu Kalakrishnan (k.a.l.a_at_sankya.com)
Date: 12/11/04
- Previous message: Clara: "Re: JTree thumb selection"
- In reply to: blue: "JTable/Model/JTextField focus problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 11 Dec 2004 11:15:10 +0530
blue wrote:
> Hello All,
>
> I have a JTable with a DefaultTabelModel. I have applied my own focus
> listener (lost/gained) to a JTextField which I am using as the cell editor.
>
> My problem is this: If I use the mouse to actually click into a cell, the
> focus gained even will fire for my textfield and tabbing off the field will
> fire the focus lost event. However, if I tab between cells without using
> the mouse, the focus gained and focus lost event do not fire.
>
> Am I missing something?
>
This is a known "feature" of JTable where it goes into editing mode and
forwards keystrokes to the editor without the editor actually having
focus. Been around since the early days of Swing.
Try calling setSurrendersFocusOnKeystroke(true) on the table.
BK
- Previous message: Clara: "Re: JTree thumb selection"
- In reply to: blue: "JTable/Model/JTextField focus problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|