Article View: borland.public.jbuilder.java.swing
Article #9592Re: A customized TableCellEditor in a JTable does not work!
From: Redarmy
Date: Fri, 03 Mar 2000 00:00
Date: Fri, 03 Mar 2000 00:00
46 lines
2267 bytes
2267 bytes
I have same problem with u.
This is a JAVA BUG, U can c the bug report on JDC(java.sun.com/jdc),bug id
is 4256006.
u write a subclass of BasicTableUI may be slove thit preoblem.
Martin Dahlem <martin.dahlem@germany.ncr.com> wrote in message
news:38BE5FF0.AA2904CD@germany.ncr.com...
> Dear all,
> I want to validate user-inputs in
> a JTable. When I set a new TableCellEditor
> to any column, it is used only when I doubleclick
> in the cell. Then it works fine so far.
> Otherwise (setting the focus to the cell
> by using the TAB-key or by clicking only once in it)
> my cellEditor is not used for this cell and
> the user can type all the invalid characters
> my cellEditor should filter out.
> If I use
> "cellEditor.setClickCountToStart(0);",
> I make my cellEditor work after a single click
> in the cell. But how can I make it work after
> setting the focus to a cell by using the TAB-key????
>
> Thank you for any tip or hint!
>
>
>
> Here is my example:
>
> Vector data = new Vector();
> Vector columNames = new Vector();
> columNames.addElement("Connection");
> columNames.addElement("AsId");
> JTable tableAsIds = new JTable();
> tableAsIds.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
> tableAsIds.setModel(new DefaultTableModel(data, columNames));
> JScrollPane tableScroller = new JScrollPane(tableAsIds);
> add(tableScroller);
> JTextField tf = new JTextField();
> tf.addKeyListener(new NumberValidator());
> DefaultCellEditor cellEditor = new DefaultCellEditor(tf);
> cellEditor.setClickCountToStart(0);
> tableAsIds.getColumnModel().getColumn(1).setCellEditor(cellEditor);
>
Technical Details
Message-ID:
<89nu1o$pak7@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38BE5FF0.AA2904CD@germany.ncr.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,6edbc71d4b1ba6ae X-Google-Attributes: gid111d45,public From: "Redarmy" <www@usa> Subject: Re: A customized TableCellEditor in a JTable does not work! Date: 2000/03/03 Message-ID: <89nu1o$pak7@bornews.borland.com> X-Deja-AN: 592587172 References: <38BE5FF0.AA2904CD@germany.ncr.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Reply-To: "Redarmy" <www@usa> Newsgroups: borland.public.jbuilder.java.swing