Cell Editor for a JTable within A JTable Cell

My individual cells each contain a seperate JTable and I need to write a cell editor for it. I'm not really sure how to write one so if someone show me where I can find some useful examples of such a cell editor I would greatly appreciate it. Thank you for your time. :-)

So, you have a big table whose cells each contain a little table. I assume you already have the little tables working correctly with cell editors and so on, and you want to write a cell editor for the big table. Correct?
My problem with this is that I can't imagine how this would actually work in practice. Suppose I click on a cell in the big table; then the cell renderer displays the appropriate little table. At this point should I see one of the cells in that little table selected, and should I be able to use the Tab key to move around the little table? And if so, then I can't use the Tab key to move around the big table. Next, suppose I press F2 indicating that I want to edit the little table. What should change? Should I now be able to tab around the little table, whereas I couldn't before? And if so, how do I indicate that I have stopped editing the little table? Pressing Enter indicates to the little table's cell editor that its editing is finished, but how should I tell the big table's cell editor that its editing is finished?
Perhaps if you can answer this, you may have a better idea of how to solve your problem. Sorry I only have questions and not answers.

Similar Messages

  • Setting cell editor for individual cell in JTable

    Hi there,
    I want to provide individual cell editor for my JTable. Basically, my JTable shows property names and values. I want to show different cell editors for different properties.
    I followed the advice in this post:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=423318
    but I have a question:
    I looked at the code of DefaultCellEditor. It just has a single editor component (the one provided in the constructor), so all the methods use the same component and certain aspects are customized for the type of component. Again, there can be only one type of component at a time.The problem that I am facing is that I will have different components for different row/column of the same table. So how do I implement some of the methods (for example, getCellEditorValue()), when I have multiple editor components?
    Also, how do I commit changes made by the user?
    I am extremely confused.
    Someone please help!
    Thanks.

    Actually, that's what I am currently doing.
    Here is my cell editor class:
    public class ObjectPropertyEditor extends DefaultCellEditor
           public ObjectPropertyEditor()
              super(new JTextField());
              Vector list = new Vector();
              list.add("Yes");
              list.add("No");
             myCombo = new JComboBox(list);
          public Component getTableCellEditorComponent(JTable table, Object value,
              boolean isSelected, int row, int column)
             String colName = (String)table.getValueAt(row,0);
             if(colName.equalsIgnoreCase("Leaf-Node?")) //if it is the "Leaf" property, return the combo box as the editor
                 return myCombo;
            else  //for all other properties, use JTextField of the super class
                return super.getTableCellEditorComponent(table,value,isSelected,row,column);
        private JComboBox myCombo;
    }The problem I have is that when I select a new item from the combo box, the new selection is not reflected in the tableModel. I don't know how I can achive that. I think I need the functionalities that DefaultCellEditor gives to its delegate when its constructor arguments is a combo box. But how can I get two different sets of functionalities (JTextField and JComboBox) ?
    Please help!
    Thanks.

  • Using editor for multiple cells in JTable

    Hi,
    Here is my requirement -
    On clicking any column of a particular row in a JTable, a pop-up window containing the cells of that row will be displayed as JTextFields for the user to enter the value and on pressing OK, the entered values should be set in the corresponding columns of that row.
    I used a customised editor for this and the problem here is - getTableCellEditorComponent() method returns the cell value which got clicked/selected by the user. But in my case, all the cells have to be edited and returned to the corresponding columns in the table. The same is the problem with the method getCellEditorValue().
    So, please let me know how do i resolve the above issue?
    Thanks in advance!!

    Hi,
    No, the problem is not with showing the popup. I can get the pop-up containing the fields corresponding to each column in the Jtable and in the pop-up window, I have to change the Text fields and press OK.
    After pressing OK, the changed values in the pop-up will be rendered on the corresponding columns of the JTable.
    So, while using the customised editor, when the pop-up is displayed, the method public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) is basically used to return the selected component (cell).
    I can do the above using
    TableModel model = table.getModel();
    model.getValueAt(table.getSelectedRow,column)
    for all the columns but cannot return all these cells. Only one editorComponent can be returned.
    Similarly, after getting the pop-up and changing the values and pressing OK, getCellEditorValue() will be called which returns the edited cell value, again all the cell values cannot be returned here.
    So, is there a way by which all the cells of a particular row can be edited at a time? Hope the explanation is clear now.
    Please help!
    Thanks in advance!!

  • Setting value in a cell in JTable where editor for cell is a JComboBox

    Hi,
    I have a column in a JTable where it holds a comboBox . As the comboBox has different
    values depending on the row I've a cell editor for each row. That's fine. My problem is that one of the
    values on the comboBox launches a dialog where the user selects a new value to add to the comboBox.
    The comboBox gets updated with this new value and I call setValueAt on the table. Both get updated
    but the cell doesn't display the new value added in the JTable. I click it and the comboBox has the
    value and I've to select it to get it displayed in the cell.
    Here's the code for updating the tableModel -
    public void updateCellDetails(String value, int row)
    JComboBox combo = (JComboBox) rowEditor.getTableCellEditorComponent(
                        this,
                        value,
                        true,
                        row,
                        4);
    if (combo != null)
    combo.insertItemAt(value, combo.getItemCount() - 1);
    combo.setSelectedItem(value);
    rowEditor.setEditorAt(row, new DefaultCellEditor(combo));
    MyTableModel tableModel = (MyTableModel) getModel();
    tableModel.setValueAt(value, row, 4);
    Thanks

    Not sure if this'll help, but did you ever fire an editing-stopped event? If such an event is never fired, then editing-cancelled will be fired when you lose focus from the editor and the original value will be restored.

  • JTable - different editor for each cell?

    I have a JTable where two columns have combo box editors. When the user makes a selection in one combo box, the other combo box's options must change, as its allowable options depend on selection in the other combo box.
    So in short, I need a way of changing the combo box options for ONLY a specific cell, NOT the entire column. I currently only know how to do this for a whole column:
    // first put stuff in myComboBox, and then...
    myJTable.getColumnModel().getColumn().setCellEditor( new DefaultCellEditor( myComboBox ) );
    Is there any way to change the values in the combo box of a specific cell, rather than the entire column?
    I apologize if this is a newbish question... I am fairly new to Swing, but I didn't see anything addressing this in the documentation.
    -Vern

    The solution is like the one I gave you in one of
    your previous postings. In that posting you wanted a
    renderer for a specific cell. In this posting you
    want a editor for a specific cell. The solution is
    the same, only the method name changes.Okay, thanks. Sorry if it seems like I'm a slow learner. ;-)
    -Vern

  • Info on cell editors for specific rows

    Hi all,
    Could anyone tell me how to return different components to be the editors for different rows in a table.
    I have certain rows that will use a checkbox editor and certain rows that will use a formatted textfield editor. I have coded an outline to my custom editor which extends Component and implements TableCellEditor. Any help would be greatly appreciated.
    Regards
    Alan

    Override getCellEditor() for the JTable
        public TableCellEditor getCellEditor(int row, int column) {
            if(row==rowOfmyChoice) //Or whatever Logic You want
                      return new MyCellEditor()
            return super.getCellEditor(row,column);
        }

  • JTree: How to set different cell editor for different tree Nodes.

    I have a JTree and I want to set different cell editors for different node depending on some condition. E.g. I want to set ComboBox as editor for leaf node but each leaf node will have its own set of data.
    Any help or pointer?
    Thanks in advance
    Sachin

    take there:
    http://www.mutualinstrument.com/Easy/FAQ/Tree/tree.html

  • Setting JcomboBox editor for a table cell

    Hi,
    I have a ComboBox editor for a cell in my table. I want to set this editor depending on the value of another column
    qualifierTable.addMouseListener(new MouseAdapter(){
       public void mouseClicked(MouseEvent e){
        int selRow = qualifierTable.getSelectedRow();
        int selCol = qualifierTable.getSelectedColumn();
       if (someCondition)
                JComboBox comboBoxEditor = new JComboBox();
                comboBoxEditor.addItem("Private");
                 comboBoxEditor.addItem("Protected");
                 comboBoxEditor.addItem("Public");
                 qualDataValueCol.setCellEditor(new DefaultCellEditor(comboBoxEditor));
                 Object dataValue = comboBoxEditor.getSelectedItem();
                                          if (dataValue!= null)
                 {                              qualifierTablemodel.setValueAt(dataValue, selRow, selCol);
    }The problem is this sets the editor for all cells in the column. However I want the editor to revert to JTextField if this condition is not met. Where should I set it back. It does not work if I set it in the else part

    Override the getCellEditor(...) method to return the appropriate editor. Something like this:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=637581

  • Creating a Cell Editor for a JTree

    Hi...
    I would like to be able to edit the nodes of a JTree dynamically, but I'm not sure how to do it. I have unsuccessfully tried to implement a celleditor by extended the DefaultTreeCellEditor. The editing works fine, but once the cell has been edited, I get a ClassCastException.
    I know that I need to get the edited value and then make appropriate changes to the DefaultMutableTreeNode object stored, but I am not sure where to do all this. I would really appreciate some tips on where to get the edited value entered, and how I can access the object being edited. Thanks.
    ..VJ..

    So, you have a big table whose cells each contain a little table. I assume you already have the little tables working correctly with cell editors and so on, and you want to write a cell editor for the big table. Correct?
    My problem with this is that I can't imagine how this would actually work in practice. Suppose I click on a cell in the big table; then the cell renderer displays the appropriate little table. At this point should I see one of the cells in that little table selected, and should I be able to use the Tab key to move around the little table? And if so, then I can't use the Tab key to move around the big table. Next, suppose I press F2 indicating that I want to edit the little table. What should change? Should I now be able to tab around the little table, whereas I couldn't before? And if so, how do I indicate that I have stopped editing the little table? Pressing Enter indicates to the little table's cell editor that its editing is finished, but how should I tell the big table's cell editor that its editing is finished?
    Perhaps if you can answer this, you may have a better idea of how to solve your problem. Sorry I only have questions and not answers.

  • Dreamweaver CC and Windows 8.1 - Can't Find A Valid Editor For This File Extension

    Was running the latest version with no issues and then I loaded Office 2013 .. Now when I am in the remote site and try to double click on a .cfm file, I get a dialog box..Can't Find A Valid Editor For This File Extension..
    I tried the support chat and they said Dreamweaver support was not available, try again later???
    So I thought I would reinstall the CC version and now I can see the Dreamweaver icon next to the files but still ... can't open the file..
    Any assistance would be appreciated?
    Leo

    The issue is only in Windows 8.x where when Dreamweaver CC is installed, it is not able to turn on the file type associations by default.  The workaround for now is to manually add the extensions both within Windows and then within Dreamweaver CC itself.
    Go to Control Panel > Programs > Default Programs > Set Your Default Programs and select Dreamweaver CC and then select 'Choose defaults for this program' and Select All or the extensions you want to open in Dreamweaver CC
    Start Dreamweaver CC and go to Edit > Preferences > File Types/Editors and add '.cfm .cfc' to the extensions and then add C:\Program Files (x86)\Dreamweaver CC\Dreamweaver.exe then click on Apply and Close
    That should be it.
    James

  • IMovie08 as a rough cut editor for FCE4?

    Hi All,
    (I know there was a reference by Euisung Lee on this topic but no replies are currently allowed hence this new post...)
    http://discussions.apple.com/message.jspa?messageID=5317430
    I'm interested in the experience of anyone using iMovie08 as a rough cut editor for FCE4.
    Why do I want to do this?
    * I love the sheer speed of putting together videos, even lengthy ones, in iM08.
    * Also the integration with the iApps
    * Love having an accessible skimmable library of all my DV
    What I can't really live with in iM08...
    * The poor titling facilities
    * I've been trying the titling workaround noted in Karsten Shluter's website (ie. import a semi transparent TIFF or PNG from Photoshop and drag it onto clips). This works great except for one of my key projects where iM08 accepts the image file as normal, but doesn't display any overlayed image in the viewer.
    * Also concerned about the loss in quality on export (for DV files)
    So...I'm thinking about the following workflow...
    a) import DV to iM08 (no loss in quality)
    b) within iM08, perform rough cut video selections, and intersperse with image files from iPhoto (gives a documentary feel with video + stills)
    c) export XML to FCE4
    ...I understand in this step that audio, transitions, KBE, adjustments, titles etc is lost in this process, but I'm assuming that the cuts and also the interspersed photos are retained
    d) so then in FCE4 perform the titling, KBE on the photos, edit the audio and do any effects such as slowmo etc...
    I'm hoping this is a 'best of both worlds' solution in that I keep the speed factor in pulling together the backbones of the project, but also gain the functionality of FCE4 for the other components.
    My questions
    1. Does this work effectively - has anyone tried it? Any traps which would make it more cumbersome than I'm anticipating?
    2. Does FCE4 need to re-import or convert the original DV clips referenced by the iM08 XML. Does this duplicate the source files? Is there any loss of quality in the files then used in FCE4.
    3. Following from #2, will the export quality from FCE4 be superior to what I'm currently getting in iM08? (Noting that the majority of my output needs to end up as a DVD...not yet living in Steve J's DVD-less world yet)
    4. Has anyone run into the same titling/image overlay problems as I'm having with iM08.
    A big thanks to the regulars who provide a huge source of great info here for us all...

    Hi Joey,
    thanks for appreciating my post ..
    .. do you think using iM08 as a rough cut editor in this way could work?
    I guess, that is a way..
    when iM08 araised, in one of my posts, I said, skimming would be on my wishlist for FCE4 .. skimming is, imho, excellence in UI design.. a 'switchable' timelne in FCE (skimming mode/timeline mode) would really speed up editing.. (if speed is an issue )
    .. it appears that this workflow would also get me around the iM08 export quality issue.
    as far as I understand the process, there's no loss in quality in this process.. the xml is just 'in-/out data' (like Midi in audio processing) and you transfer/clone the raw imports from iMEvents to FCEproject... I'm not indepth will this workflow, I guess, you double the data = hdd space issues.. but, +you never have enough space while doing video+ ...
    .. It sounds like putting KBEs into photos is harder in FCE than iM08
    I'd like to phrase 'different' ..
    less intuitive, but with much more options (e.g. rotation, transparencies, multi pic, drop shadows ...) and with more control (e.g. no automatic 'smoothing'/acceleration as in KB/iM, creating 'paths' of movement .. .)
    with some craftmanship, you could create a slideshow looking like those 'Themes' in iMHD6/iDVD ...
    fo sure harder, but imho .. better ...
    .. _I assume_ that FCE4 would operate in the same way as FCE3.5
    me too, vers3.5. here, no hands-on on vers4 ...

  • Rough Cut Editor for Final Cut Server

    Hi everyone,
    we are working on a Rough Cut Editor for Final Cut Server.
    I'd like to know what you think about it and put a short video about its usage on my site at
    http://www.andre-aulich.de/en/perm/consol-rough-cut-editor-video
    Any feedback would be very much appreciated!
    Regards,
    André

    Hi guys,
    in addition to getting in touch with you personally, I'd like to answer some questions in public:
    LAN vs WAN
    ==========
    The RCE in its current form is primarily built to be used in a LAN.
    This is because you need both the Final Cut Server client as well
    as the RCE client to connect to a central server using the ports
    3000, 80, 8821, and 8891.
    In addition, we currently suppose the Edit Proxy folder to be an
    edit-in-place device, so you need to open port 548 if you use AFP
    for that. We might change that, but you still need the FCSvr client
    to connect to your server.
    That said, we currently consider the RCE to be run in a local network.
    FEATURES
    ======
    We are not planning to build a server ingest app, as there are other guys
    building these kinds of apps.
    A standalone version of the RCE without Final Cut Server connectivity would
    be easy to write, yet, we like to use FCSvr's proxies for preview, as this way
    low bandwidth (meaning non-Fibre Channel) to the viewing stations is
    sufficient.
    So today there's the RCE in its current form...
    AVAILABILITY
    ===========
    We are doing our final testing and hope to release the app within
    the next two weeks.
    As we need to install some tools on a server and have a look at its
    environment, we would currently install the RCE ourselves, usually
    through a remote connection.
    Yet, we already consider having selected partners to implement the
    RCE as well.
    Currently there's no beta program being planned, as we do our
    testing at a customer site, where we hope to evaluate the app
    quite comprehensively.
    I hope that answers some questions.
    For more questions, please feel free to get in touch with me.
    André

  • How do I search for a word within a web page

    I would like to be able to do a search for a pecific within the page currenly viewed in the browser. Is there a way to do that in Firefox?

    Hi JossefPerl,
    Searching on a page is actually really easy. You can just hit ''CTRL + F'' to use the search feature. You should take a look at the Knowledge Base article on [[Searching within a page]] for more information.
    Hopefully this helps!

  • Is there a way to play a song for several slides within a larger keynote presentation?

    is there a way to play a song for several slides within a larger keynote presentation?

    Place the sound file on the slide and use Builds to change the images during the sound files duration.
    Inspector > Builds > choose an effect
    Delivery: by paragraph
    more options > start build manually or,
    use automatically;    and select a delay (the amount of time the slides  show). For example; if you have a 30 second sound file and 10 images, enter a 3 second delay.

  • Delivery without reference for stock transfer within the same plant 311

    Dear all,
    I need to create a delivery without reference for stock transfer within the same plant, movement 311,  i.e. just from 1 storage location to another storage location.
    I tried to use VL01NO with delivery type UL.
    Now my question is how can I assign a receiving plant for a customer?
    I can't do the MIGO or MB1B document because I need the delivery document (packing list, forms, Texts,...).
    It's possible this option???
    Thank you very much.

    Hi,
    What is the item category you are assigning while doing VL01NO?  Check the schedule line category for that item category assignment.  That Schedule line category has an option for one step GI.  There you can assign 311 or create a separate item category and schedule line category and in that SC assign 311. 
    Thanks
    Krish.

Maybe you are looking for