Re: JTable/Model/JTextField focus problem

From: Babu Kalakrishnan (k.a.l.a_at_sankya.com)
Date: 12/11/04

  • Next message: John McGrath: "Re: Action - conceptual question"
    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


  • Next message: John McGrath: "Re: Action - conceptual question"

    Relevant Pages

    • JTable/Model/JTextField focus problem
      ... listener to a JTextField which I am using as the cell editor. ... focus gained even will fire for my textfield and tabbing off the field will ... fire the focus lost event. ... the focus gained and focus lost event do not fire. ...
      (comp.lang.java.programmer)
    • JTable/Model/JTextField focus problem
      ... listener to a JTextField which I am using as the cell editor. ... fire the focus lost event. ... the focus gained and focus lost event do not fire. ...
      (comp.lang.java.gui)
    • RE: User List Box - List from Hidden range - VBA worng
      ... In your for loop, ... range is only 1 column wide this will be a single cell). ... Basic Editor type the word on it's own in lower case on a line and hit enter. ... in the array reference - and an array starts with element 0. ...
      (microsoft.public.excel.programming)
    • Counterfeit batteries could result in TSA ban on all Li packs
      ... laptop fire on board an aircraft. ... fire can be contained with existing extinguishers. ... this is for a correctly assembled pack with all safety ... measures intact including cell partitions and vents, ...
      (comp.sys.laptops)
    • Re: Li-Ion rechargeables
      ... However, if you overcharge or overdischarge them, so the cell voltage is>4.3V or <2.4V, metallic lithium separates out inside the cell. ... I suggest that you consult the MSDS sheets for Li-Ion cells from various manufacturers. ... Water, CO2 and foam are the most commonly recommended agents for a fire involving Li-Ion batteries. ... Even an over or under charged Li_Ion battery does not present metallic lithium that will burn in water. ...
      (sci.chem.electrochem.battery)