>Thanks for the suggestions.  I won't be able to try
>this for a bit but while I have your attention let me
>ask some followup questions (hope you don't mind me
>pickin your brain a bit!):

>Does the ancestor event mean that the component is
>displayed and in some kind of state of readiness?   

ancestorAdded seems something of a misnomer to me.  It is
called when a component becomes visible.  This may be because
it or one of its ancestors has setVisible(true) called, or
because the component or one of its ancestors is added
to a component that is visible, etc.  Ultimately visible
means that component and all its ancestors have their
visible property set true and that the entire chain ends
in some form of Window. 

>I know JTable will propogate the event
>isCellEditable()  checked and blessed, but why is the
>popup menu recieving it?  Didn't the button consume
>the event or doesn't the popup care if the event is
>consumed?

Returning null will stop the event being propagated.
This is because the table attempts to propagate the
mouse event on to the component returned by the cell
editor.  I don't know why this is being further
propagated onto the popup menu.  I'd need to look at
the specifics of your situation to determine this and
I'm afraid I don't have that much spare time.

>If I return null, what happens to the display, I ask
>because if my renderer is called to fast it messes up
>some state information?  

Returning null effectively causes the edit request to be
ignored.  It has the same effect as returning false from
isCellEditable(row, column), but using this technique 
provides a useful way of implementing an edit which isn't
an in-place edit of the cell.

>Do you know if I can use something like
>getCellRect(row, col) to get a location for the popup?
> The whole table is in a scrollpane, if the rectangle
>is in table coordinates and if the table is the
>invoker, where will the popup get displayed?  Do I map
>the rectangle x,y to the scrollpane or something?

Yes, use getCellRect.  If you pass the table as the component
to show on the popup I think this should deal with all the
translation even in a scroll pane.  If you want to show the
menu relative to something else you need to do the translation
yourself but this is easy using the various convertXXX methods
in SwingUtilities.

>Thanks for your time, really do appreciate it!
>Steve

You're welcome.

Regards

Dave Wathen
Goldman Sachs Asset Management
3rd Floor, Procession House
55 Ludgate Hill
London EC4M 7JN
+44 (0)20-7774-2998

It is not necessary to understand things in order to argue about them.
(Caron de Beaumarchais)

--- "Wathen, Dave" <[EMAIL PROTECTED]> wrote:
> Don't know if this will work but it might be worth a
> go.  It sounds like you
> need to defer the doClick a while longer.  Try
> adding an AncestorListener to
> the button and calling doClick when ancestorAdded is
> called (possibly in an
> invokeLater but I don't think that would be
> necessary).
> 
> I assume the effect you're after is to have the
> table display a button which
> brings up the popup when it is 'pressed'.  It sounds
> as if you've arrange
> for the action of the button to bring up the popup
> and you're trying to make
> that happen automatically.  Instead of using the
> button to invoke the popup
> you could do this directly as in:
> 
> public Component getTableCellEditorComponent
>         (JTable table, Object value, boolean
> isSelected, int row, int
> column) {
>     //display the popup
>     ...
> 
>     //now the popup's displayed we don't really want
> to edit with the
> 'button'
>     return null;
> }
> 
> 
> Regards
> 
> Dave Wathen
> Goldman Sachs Asset Management
> 3rd Floor, Procession House
> 55 Ludgate Hill
> London EC4M 7JN
> +44 (0)20-7774-2998
> 
> It is not necessary to understand things in order to
> argue about them.
> (Caron de Beaumarchais)
> 
> 
> -----Original Message-----
> From: Steve Barrett [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 08, 2001 6:57 PM
> To: [EMAIL PROTECTED]
> Subject: isCellEditable() question 
> 
> 
> I am using a table which has a button that
> implements
> CellEditor.  I want a single click in the table to
> make the button do its thing so I have
> isCellEditable() returning true if the event is a
> mouse event with a click count == 1.  In the
> getCellEditor() I call the button's doClick() in an
> invokeLater() thread.  If I don't call the doClick()
> then I have to click again, and if I don't do it in
> an
> invokeLater() then then menu does not display
> (presumably because the table hasn't given my
> component some real estate).   The problem is that
> the
> 1st popup menu item is immediatly selected if the
> menu
> pops up under the mouse pointer.  I have tried
> consuming the event in the isCellEditable() as well
> as
> disabling event listening and neither have worked. 
> Any suggestions would be appreciated.
> Oh yeah: Win9x, JDK 1.3.
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail -
> only $35 
> a year!  http://personal.mail.yahoo.com/
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swin


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to