Article View: borland.public.jbuilder.java.swing
Article #10515Re: JTables and cell editors
From: Sam Wilson
Date: Fri, 17 Sep 1999 00:00
Date: Fri, 17 Sep 1999 00:00
36 lines
1866 bytes
1866 bytes
> I am using a JComboBox as a JTable cell editor. If the first item in the
> list is
> the current value and I reselect this value from the drop down list, the
> combo box does not close. The drop down list disappears but the combo box
> is still visible. I guess that it is not telling the table that editing
has
> finished. Any suggestions?
By setting the first eleement of the drop down list to an empty string I
have made this behaviour acceptable. Not a very nice solution though
> I also have a JPanel as both a renderer and an editor for another column.
I
> have placed JButtons on these panels. The problem is that clicking on one
> of the buttons causes it to be stuck in the down position. It takes
another
> click to make it reset. From this point on the buttons function correctly
> (until another cell is selected).
I also now have a nasty fix for this one.
public class TableButton extends JButton
{
protected void processMouseEvent(MouseEvent e)
{
if (e.getID() == MouseEvent.MOUSE_ENTERED)
{
e = new MouseEvent((Component) e.getSource(),
MouseEvent.MOUSE_RELEASED, e.getWhen(),
e.getModifiers(), e.getX(), e.getY(),
e.getClickCount(), e.isPopupTrigger());
}
super.processMouseEvent(e);
}
}
Technical Details
Message-ID:
<7rt7um$p4i10@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7rlnm6$o0r18@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,93f6ca68d1336006 X-Google-Attributes: gid111d45,public From: "Sam Wilson" <sam.wilson@cenes.co.uk> Subject: Re: JTables and cell editors Date: 1999/09/17 Message-ID: <7rt7um$p4i10@forums.borland.com> X-Deja-AN: 526279963 References: <7rlnm6$o0r18@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing