Rajarshi Guha wrote:
> OK, so I assume that if jmp is an instance of JmolPanel then something
> like
>
> jmp.dispatchEvent(e)
>
> shoudl send whatever event I get to the viewer.

Yes, from quick look at the JavaDoc that looks right to me.


> OK, so basically what I have so far is a JTable which uses a custom cell
> renderer for the structure's column. From what I understand I need to
> provide a custom cell editor - as basically clicking/dragging on a cell
> can be considered an 'edit' operation.
>
> However, since I want the 'editor' to simply be a forwarder for events
> (forwarding to the cell component which is a JmolPanel) I need to
> implmenet some form of a listener/action interface - maybe ActionEvent?
>
>
> This is where I'm getting stuck - I dont know enough of what is
> available to choose what interface needs to be implemented.

OK, I did a little research ...

> I've placed the source file at http://jijo.cjb.net/molview.java
> if anybody would be able to help out with this problem. Currently it
> wont compile since I dont know how to fill in the JmolPanelCellEditor
> class (which implenments TableCellEditor)

As you said, you need to implement TableCellEditor.

One important method will be isCellEditable(EventObject evt). I do not
know exactly what kinds of events you will get. It seems to me that you
want to return true on a mouse down event.

When you return true, the JTable code is going to call
getTableCellEditorComponent(...). At this point, I think you just need to
return your JmolPanel ... the same one that you are using for display.

My understanding is that all mouse events will get routed to that
Component. So, in fact, you will never even see those events; you will
never need to call jmp.dispatchEvent directly. The JTable is already set
up to dispatch the event to the tableCellEditorComponent.

(keyboard events do *not* automatically get routed to the Component by
JTable, but you don't need to worry about that)

At some point the user is going to click someplace else in the table. When
that happens the stopCellEditing() will be called. You do not need to do
anything ... just return true.


That is the path that I would pursue. Print plenty of stuff to stdout so
that you know the state of the events that you are receiving.

Keep us advised as to your progress.


Miguel



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to