JTreeTable: can't get CellEditor for non-tree cells to work

Hi!
I'm using a JTreeTable ( http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html ) in my application. In the table cells I use ImageIcons to visualize some object data. Now I need some interaction when the user clicks on these icons, but I'm not able to get any kind of cell editor to work with the table's cells.
I now play around with the TreeTable 2 example code and it's about the same. I can't even get a JTextField to work as an editor. I've been searching this forum and the web but did not find an appropriate solution or sample code.
Is someone out there who can help me out?

Hi there.
Hopefully we can help each other out as I am also struggling with the example from sun.
I have managed to get an editor to work but I'm using a check box.
Very simple, I took all the code from sun. In the TreeTableModelAdapter, I put code for isCellEditable() and for setValueAt(), like this
public boolean isCellEditable(int row, int column) {
         if(column ==0){        
              return treeTableModel.isCellEditable(nodeForRow(row), column);
         else if(column == 1){        
              return true;
         else return false;          
    public void setValueAt(Object value, int row, int column) {
          if(column ==0){
               treeTableModel.setValueAt(value, nodeForRow(row), column);
          else if(column == 1){
               DefaultMutableTreeNode theNode = (DefaultMutableTreeNode)nodeForRow(row);
               NewsNode theNewsNode = (NewsNode)theNode.getUserObject();
               if(!theNewsNode.isSelectable()) return;
               Boolean theValue = (Boolean)value;               
               theNewsNode.setSelected(theValue.booleanValue());
             fireTableChanged(null);
    }I'm not sure if that's what you need but it worked for me.
Maybe you could elaborate further.
Cheers,
rachel

Similar Messages

  • Can we get reimbursed for apps that do not work

    Can I get reimbursed for apps that do not work?

    Hi...
    You can contact iTunes support here and see if they will make an exception:
    http://www.apple.com/support/itunes/contact/
    They usually respond within 24 hours.
    Hope this helps.

  • Editing non-tree cells problem in JTreeTable

    Hello all,
    I've been playing around with the JTreeTable for quite a while and have a fairly good grip on it. However, I've run into a problem that involves the display of cell data in the non-tree cells.
    Assume I have a JTreeTable with one node below the root (and the root node is not displayed). Also assume I've edited some information in one of the other cells in a 5-celled JTreeTable. The JTreeTable behaves normally with regard to editing/setting the values of the table cells.
    Now, with the click of a separate button, I programmatically create a new node in the JTree. I update the JTree model with a call to nodeChanged() and nodeStructureChanged() (or I could call reload() - both seem to work).
    This successfully adds a node, but in the process clears the entire remainder of the table's cell values. If I call fireTableDataChanged(), then the display of the JTree gets all screwed up (basically what happens to the display if you add/remove nodes, but don't update the display in a JTree). Not only that, but the fireTableDataChanged() method still does not redisplay my cell information for the remainder of the table.
    I'm at a loss to figure out what's responsible for this. The tableCellRenderer seems to work just fine until I add node. Even then, the tableCellRenderer for the JTree still works until I call fireTableDataChanged().
    Any ideas?
    Thank you,
    Brion Swanson

    I use a JTreeTable and in looking at my code, I've
    noticed that I make use of treeTable.repaint() fairly
    frequently (as whenever I update my stuff).Did the treeTable.updateUI do funky things to your JTree? It does on mine if I do a programmatic node addition or removal (basically any change to the tree structure will cause treeTable.updateUI() to completely destroy the display of the tree). This is a separate issue, but I thought I'd ask anyway since you seem to have run into at least a few of the same problems I'm experiencing.
    I don't fully understand your problem<snip/>
    do you mean
    it drops all edits you have done?Yes, it drops all the edits except the one currently being "edited" (that is, the selected editable cell will not lose it's value).
    I had a problem about it dropping the edits I had
    done and I resolved them by adding key listeners
    and played with the TableCellEditor.Could you elaborate on what you did to the TableCellEditor and which object you had listening to the keys (the table? or the tree? or something else?).
    You help is greatly appreciated!
    Brion Swanson

  • I have an ipad 2 and want to get a wireless keyboard so my daughter can practice typing? can you get them for ipad 2?

    i have an ipad 2 and want to get a wireless keyboard so my daughter can practice typing? can you get them for ipad 2?

    Yes, there are lots of Bluetooth keyboards available for the iPad 2. Logitech and Zagg have several.

  • HT5622 I think my granddaughter bought a $3.99 app after I put the password in for a free app.  How can I find out what she purchased?  Can I get credit for it?  I just got an email from my credit card confirming the purchase.

    I think my granddaughter bought a $3.99 app after I put the password in for a free app.  I just got an email from my credit card confirming the purchase.  How can I find out what she purchased?  Can I get credit for it? 

    The password is good for 15 minutes to make purchases. You should receive a receipt in 24 to 48 hours for the purchases. There is a link to Report an issue. You could use that to start a conversation with iTunes Support about a refund.
    Apple considers all sales final. But has been known to offer a one time refund. So the question is, do you want to use your one time refund on this purchase or one more expensive in the future?

  • Where can I get driver for network scanning on my Laserjet Multifunction M1120n for Windows 7?

    Where can I get driver for network scanning on my Laserjet Multifunction M1120n for Windows 7 64bit? It must be the Windows 7 driver of Scanto.msi. Thank you for your support.
    This question was solved.
    View Solution.

    Hi,
    Unfortunately any HP Software component (HP Toolbox, HP Scan, etc.) for this product support 32-bit envoirnment only.
    As you may find by the User Guide, only  basic Print and Scan drivers provided for 64-bit (Page 14):
    http://h10032.www1.hp.com/ctg/Manual/c01072750.pdf
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How can you get audio for  books on the kindle

    how can you get audio for  books on the kindle

    The audio inputs on Macs are line level inputs and not mic inputs.  You need a mic with a built in preamp (battery powered) or more conveniently a USB mic or bluetooth headset.

  • Where can I get iTunes for 64 bit Windows XP?

    I am running Windows XP 64 bit Pro. I downloaded iTunes for Windows, started setup and I got message which says that I should download 64 bit iTunes version.
    So where can I get iTunes for Windows XP 64 bit?

    According to the following document, iTunes is not supported for 64 bit XP
    http://support.apple.com/kb/HT1426
    CG

  • I cannot open a pdf file on my Mac because i don't have the segue UI font. How can I get it for my Mac?

    I cannot open a pdf file on my Mac because i don't have the segue UI font. How can I get it for my Mac?

    The user already has an identical topic https://forums.adobe.com/thread/1468166 in the Reader forum.

  • HT3702 how can i get refund for a double charged app

    how can i get refund for a double charged app

    Click Support at the top of this page, then click the link under Contact Us.

  • Can I get Siri for my I Pad?

    Can I get Siri for my I Pad?

    Siri is not compatible with older devices. This includes iPad 2 (and maybe 3). If holding down the home button doesn't work, it probably is not compatible with your iPad.
    -Ethan7988

  • Can I get Siri for my iPhone4. I've upgraded to ios5

    Can I get Siri for my iPhone4? I've upgraded to ios5

    The iPad 2 also has the A5 chip, but it currently does NOT support Siri.
    (Since someone would inevitably ask again, I'm addressing it preemptively!)

  • How can I get iWork for my MBP 2011

    How can I get iWork for my MacBook Pro 15" late 2011?
    The Up-to-Date programme doesn't operate for this model
    iWork is now free for iOS - can I get it for Mavericks 10.9.4?
    Thanks
    Philip

    philippo wrote:
    How can I get iWork for my MacBook Pro 15" late 2011?
    Mac App store or you can use iWork at iCloud.com for free.
    iWork for iOS is free for new iOS devices.

  • How can I get Siri for my ipad2

    How can I get Siri for my iPad 2 , and what happen to my YouTube app?

    Siri does not work with the iPad 2.
    Google are reportedly in the advanced stages of issuing a YouTube app.

  • Where can i get Keynote for Mac OSX 10.7.5?

    Can I get Keynote for my Mac which runs osx 10.7.5?

    You can purchase iWork '09 on eBay or Amazon, but you can't download it anymore.

Maybe you are looking for