DefaultCellEditor in JTable can not update itself when the value changes

Hi,
I have a JTable which has 4 columns. The 3rd column has a comboBox. whenever I select an item from the first row, the cell at (currentrow, 4thcolumn) will be updated according to the item selected.
Now the problem is, after selecting the item in any cell with 3rd column, the row is updated correctly, but then all comboBox in column 3 are gone! I cannot figure out what causes this. Please help! Any suggestion will be greatly appreciated!
Jing

Thanks! Could you give more details on how to use the second approach?
I have a table with two columns, one called ID and the other called Value. I'm using JComboBox for the Value column. Whenever I select an item from the comboBox, I want the value in the cell under the ID column to change value to the value selected in the comboBox.
The problem I'm having now is although I can change the value in the comboBox and which triggers the event to change the value under the ID column, when I click the comboBox of another row, the cell under ID of the previous row changed also, before the value under ID of the current selected row.
I think the problem is there is no distinct comboBox for each row of the table. Seems like when one box change and trigger an event, that event performed in every other rows in the table.
Following is the code:
public class Test extends JPanel{
     DefaultTableModel tm;
     JTable table;
     JScrollPane nscrollPane;
     public int total=4;
     public Vector datavec, thvec;
     public Test(Vector datavec, Vector thvec){
          this.datavec=datavec;
          this.thvec=thvec;
     tm = new DefaultTableModel(datavec,thvec);
          table = new JTable(tm);
          table.addMouseListener(new PopupListener(table));
// table.addMouseListener(new PopupListener(table));
//tm.setTableHeader(table.getTableHeader()); //ADDED THIS
int height = table.getRowHeight()*table.getRowCount();
table.setPreferredScrollableViewportSize(new Dimension(500, height));
//Create the scroll pane and add the table to it.
nscrollPane = new JScrollPane(table);
setUpNNColumn(table, table.getColumnModel().getColumn(1));
//Add the scroll pane to this panel.
add(nscrollPane);
public void updateLabel(Integer size)
     int r=table.getSelectedRow();
     if(r!=-1)
     ((Vector)datavec.elementAt(r)).setElementAt(size, 0);
     repaint();
public void setUpNNColumn(JTable table, TableColumn nnColumn) {
          //Set up the editor for the sport cells
          JComboBox comboBox = new JComboBox();
          comboBox.addActionListener(new ComboBoxListener());
          int num=total/2;
          for(int i=0; i<2; i++){
               comboBox.addItem(new Integer(num*(i+1)));
          comboBox.setSelectedIndex(1);
          nnColumn.setCellEditor(new DefaultCellEditor(comboBox));
private class ComboBoxListener implements ActionListener{
     public void actionPerformed(ActionEvent e)
          JComboBox cb = (JComboBox)e.getSource();
Integer size = (Integer)cb.getSelectedItem();
     updateLabel(size);
private static void createAndShowGUI(Vector a, Vector b) {
\ JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("Nearest Neighbor Fact Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
Test newContentPane = new Test(a, b);
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
     int patidx, hitnum=2;
     Vector a=new Vector();
     Vector a1=new Vector();
     Vector a2=new Vector();
     a1.add(new Integer(1));
     a1.add(new Integer(4));
     a.add(a1);
     a2.add(new Integer(2));
     a2.add(new Integer(4));
     a.add(a2);
     Vector b=new Vector();
     b.add("ID");
     b.add("Value");
     //StatTableGUI.createAndShowGUI(gd);
     Test.createAndShowGUI(a,b);
Any suggestions? Thanks!
Jing

Similar Messages

  • HT2731 How can I update apps when the screen just goes blank?

    How can I update apps on my iPad my screen is just blank. My phone updates fine.

    There are a number of other threads from people reporting a problem with a blank Updates tab in the App Store app on their iPads - it looks like there is a problem at Apple's end which they need to fix.
    Some posts are suggesting that you if you go into the Purchased tab in the App Store app you might be able to update the apps from there, though you will need to scroll through the list (potentially going through the A to Z list on the left-hand side of the screen, and similarly tapping the 'iPad Apps' button at the top left of the screen and selecting 'iPhone Apps') to find those with updates and individually update them.

  • CAN NOT UPDATE ANYTHING ON THE MAC APP STORE?

    When I try to update my apps it say's We could not complete your request. There was an error in the App Store. Please try again later. (20)
    - I STILL HAVE UPDATES!
    HELP!

    Not the OP, but I've been having this problem since June (with the exact same error), and logging out and back in hasn't helped.
    Helpfully, the store app opens a pop-up every 2 weeks or so to let me know that there are updates I can't access. It's super annoying.

  • Can not start X when the laptop boots from battery

    Hi,
    I have just found out recently that X doesn't start when i boot my laptop from battery. After the daemons are run, X is started and then shows me a blank black screen. Ctrl-Alt-Del or Ctrl-Alt-Backspace don't work. And i can't change tty like Ctrl-Alt-F1 to escape to the console. It just hangs.
    When power cable is plugged then the laptop works just fine. Even if i pull the cable out afterwards, it continues working on battery mode.
    What can be the reason ? Has anyone the same problem ?
    Last edited by lamnk (2009-01-12 21:20:04)

    Hello, take a look at this thread please and let us know if this is something related with your problem.
    http://bbs.archlinux.org/viewtopic.php?id=60473
    Last edited by alienman (2009-03-09 23:58:20)

  • Updating view when the model changes

    We have a requirement that when we receive a message and write to database we should update all the concerned User's(intersted in that data) view(implemented as JSP's). We don't want to put a time based refresh mechanism as it would be entirely inefficient and annoying for the users whose view of interest has not changed. Can we implement a MDB which when it gets a messages calles controller( servlet) which in turns calles the JSP's? If the approach is fine then the issue is that message need to be written to database and then only the view need to be refreshed, Any thoughts on the implementation strategy?
    I tried to serach for already posted topics on the issue but could not find much..so Sorry if the issue is repeated.

    Sorry, HTTP is a pull only medium and wasn't design for real time updates like you're asking for.
    You may be able to write JavaScript that polls for updates and only reloads the change when there is an update but that is beyond my JavaScript skills. Or you could write a Java Applet that polled the server often.
    No matter what you do it's gonna be an ugly hack. I suggest you reconider what is more important, real time updates or a web interface.

  • Using NetConnection not working .pause when the page changes (Is this a FLASH PLAYER PROBLEM?)

    I am having trouble troubleshooting my interactive USB.
    Here it goes:
    (1) I have 5 buttons which are dynamically loaded
    (2) With the 5 buttons, I have 5 change-page. On my 4th and 5th buttons, this is where my NetConnection is placed. Below is my code on page 4.
    var connection:NetConnection = new NetConnection();
    var stream:NetStream;
    var video:Video = new Video(470,376);
    var metaObj:Object = new Object();
    function onMetaData1(data:Object):void
    connection.connect(null);
    stream = new NetStream(connection);
    stream.client = metaObj;
    metaObj.onMetaData = onMetaData1;
    video.attachNetStream(stream);
    addChild(video);
    stream.play("video/FILM_4.f4v");
    stream2.pause();
    (3) Now, when I try publishing it in .exe file, the videos added are working fine. The problem is when go to page 1,2,3,5 it changes the page but the audio sometimes stop and sometimes not.

    Hi Ysong,
    Please try posting your question to the ActionScript 3 forum: http://forums.adobe.com/community/flash/flash_actionscript3. It's the most appropriate forum for your question. You might also try the forums for Flash, Flash Builder, or Flex, depending on the authoring environment you are using to write your ActionScript code.
    Thanks,
    KALTechWriter

  • AAM not updating itself to Creative Cloud Desktop app

    I had the Creative Cloud desktop/toolbar app running briefly yesterday but was frustrated by having the CS6 and CC versions of various apps running side by side, so decided to uninstall everything and do a clean install.  I ran the various uninstall programs and the cleaner utility, then re-installed AAM, AI and PS as a starting point.
    AAM has not updated itself to the Creative Cloud desktop app, and if I go to the Download link for the Creative Cloud desktop app and click on Download, it just switches to the AAM app, and does nothing.
    If I look in the updates section of AAM, there are no updates for AAM itself and Creative Cloud Desktop is not an installable program in AAM either.
    Can anyone help me in either triggering AAM to update/install Creative Cloud Desktop, or provide some manual installation steps?
    Many thanks,
    Nick

    We may want to see what Nick's OS is before we go into to many details.
    Here is a quick tip though for Windows 8 and 7 64-bit users which might resolve your difficulties.
    Go to  C:\Program Files (x86)\Common Files\Adobe and rename the OOBE folder to OOBE_old
    Close and relaunch your browser
    Sign in with your Adobe ID and password to https://creative.adobe.com/products/creative-cloud
    Download the Creative Cloud app.

  • I put pictures on  my iphone when i first got it and i can not see them when i look for them now

    I need to get ride of photos that are on my phone but I can not find them when the phone is hooked up. How can I find them?

    If you go to the Photos app, is there content in the Photo Library? These would be pictures that are synced to the phone from the computer. Photos in the camera roll are those that you take with the phone, or save from email, MMS on the phone. What type of pictures are you trying to get rid of? If you are trying to get rid of the synced photos, you need to connect to iTunes, select the iPhone in the device pane, then go to the Photo tab in iTunes and remove the check mark by sync.

  • Update manager in IdM automatically when the manager changes in SAP HR

    Hi Experts
    I have been given a requirement where the manager of a user in IdM should be updated automatically when the manager changes in SAP HR.
    The HR extraction job is currently in place and runs every 30mins.
    Please could you give me some ideas on how to implement this.
    IDM 7.2 SP 6
    Thanks
    Ran

    Hi Deepak
    I have been discussing this a bit more in detail with the client. So, the issue is as follows
    When a new/replacement manager is hired
    When people are moved from one org unit to another
    The scheduled extraction job (RPLDAP_EXTRACT_IDM with a variant with the delta tick on) does not update the new manager info in IDM for the relevant users who report to that manager. The client has to run the program (RPLDAP_EXTRACT_IDM with a variant with the delta tick off) manually each time for the affected users which updates the manager info successfully in idm.
    I investigated the query LDAP_IDM_QUERY from user group /SAPQUERY/L1 and want to know if the below should be ticked as well. Your thoughts please?
    Please advise.
    Thanks
    Ranjit

  • How to update and use the values of variables of another class

    I can we update or use the values of the variables of another class. For example, if we have class A
    public class A //(situated in package view)
    public s0,s1;
    public void runFunction()
    ...some coding and proceedings
    s0="Hi";s1"Hello";
    ......some coding
    RequestDispatcher dispatcher = request.getRequestDispatcher("/MainUser.jsp?alert=F");
    dispatcher.forward(request, response);
    ARunner.jsp
    <jsp:useBean id="a" class="view.A" scope="session"/>
    <%
    a.runFunction();
    %>
    MainUser.jsp
    <jsp:useBean id="a" class="view.A" scope="session"/>
    <%
    System.out.println("S0:"+a.s0+" S1:"+a.s1); //should print S0:Hi S1:Hello, but printing S0:null S1:null
    %>
    A.class has some procedures and String variables which can be updated and later can be used in JSP pages. The project starts with ARunner.jsp which uses the A.class and updates the values of string variables s0 and s1of A to hi and hello respectively.And then redirects the page to MainUser.jsp.
    Now what I want is ,when I call those string variables(s0 & s1 of A.class) in any another jsp likeMainUser.jsp it should give me the value of hi and hello respectively not null as it is giving right now. Could you refine the coding for this one?

    public class A //(situated in package view)
    public String s0,s1;
    public void runFunction()
    ...some coding and proceedings
    s0="Hi";s1"Hello";
    ......some coding
    RequestDispatcher dispatcher = request.getRequestDispatcher("/MainUser.jsp");
    dispatcher.forward(request, response);
    ARunner.jsp
    <jsp:useBean id="a" class="view.A" scope="session"/>
    <%
    a.runFunction();
    %>
    MainUser.jsp
    <jsp:useBean id="a" class="view.A" scope="session"/>
    <%
    System.out.println("S0:"+a.s0+" S1:"+a.s1); //should print S0:Hi S1:Hello, but printing S0:null S1:null
    %>
    giving code again to remove the typing errors. Please guide.

  • How can I fire an event case on the value change of an indicator, or a network variable?

    Hi!  I have an event structure setup to look for a value change of an indicator on the front panel.  The indicator is updated by the value of a boolean network-published shared variable through a seperate parallel loop that is polling all of the network-published shared variables.  The event, however, does not fire when the indicator changes value.  I have switched the indicator to a control and tested it with user interaction and that works just fine.
    I want to use the event structure space for my code exectution because it seems logical that that is where it would go, and it will help keep my block diagram tity.  The code is also something I would like executed with the front pannel temperarily disabled.  I would rather not have the code in my network-variable polling loop because again the tity issue.   I would also rather not use a notification VI wired to an independent loop for this particular code.
    Is there a way to have an event structure fire an event with the value change of an indicator, or a network variable directly?
    Thanks for your input.
    LV 8.5
    -Nic

    Thanks for the reply.
    I went about things a little differently, but got them to work so..... .  It really was not my desire to have a boolean indicator on the front panel.  As previously stated, my ultimate goal was to have an event fire on the change of a network variable, which I had to poll for anyway but that is tucked away in a section where I am handling all my network variables.  I ended up using that Create User Event, Register User Event, and Generate User Event SubVIs to handle the task.
    I've read the help for all of those SubVI's and it is not entirely clear to me if the event fires every time the "Generate User Event" receives some inputs, or if it only fires when the value changes.  I could do a test to find out.  It wouldn't be too difficult to add a shift register or a feedback node and place the Generate User Event in a case structure so that it is only fired when the input changes state.

  • Have updated from Snow Leopard to Lion with Safari Version 5.0.5. Now I can not update to Safari 5.1. There is no update in the Software Updater, and on the apple-download page, I only found a Safari 5.1 for Snow Leopard. When executing it, there is an e

    I have updated from Snow Leopard to Lion with Safari Version 5.0.5. Now I can not update to Safari 5.1. There is no update in the Software Updater, and on the apple-download page, I only found a Safari 5.1 for Snow Leopard. When executing it, there is an error message, that it is for 10.6 only.
    It seems that I should have first updated Safari, and then only to Lion, which I didn't. Any idea how I can fix this now without having to rollback to Snow Leopard, update Safari and then go back to Lion?

    Try this Safari5.1 from the installer package
    http://www.filefactory.com/file/cc9005d/n/Safari.pkg.zip
    The download worked better with Firefox not sure why. At the bottom of the page after the captcha>> slow down load is the Free link,  it took about 4 minutes to download on my test.

  • My Creative Cloud Desktop app closes suddenly when loads palicativos installed. I can not update my apps. What i do?

    My Creative Cloud Desktop app closes suddenly when loads palicativos installed. I can not update my apps. Already reinstalled the desktop app CC often using adobe cc cleaner. It does not uninstall the normal way. What do I do? I can not contact anyone here in Brazil. I've tried phone, facebook, email and chat.

    Hi etges,
    Kindly check the below mentioned link and revert if problem persists.
    Link:  CC applications crashes immediately after launch
    Thanks,
    Atul Saini

  • I can not update OS X mavericks, my macbook OS X lion 10.7.5, when i install that show me This copy of the Install OS X Mavericks application, my brother can upgrade with internet that just me can do that

    i can not update OS X mavericks, my macbook OS X lion 10.7.5, when i install that show me This copy of the Install OS X Mavericks application, my brother can upgrade with internet that just me can do that

    Is your MacBook compatible with Mavericks? Open  > About this Mac > More Info, and you will see the MacBook model you have got. Then, check in this site if it's supported > http://www.apple.com/osx/specs
    If your Mac is not compatible, OS X 10.7.5 is the most recent version for your Mac. Also, copy the whole message you see when you open the Mavericks installer

  • I downloaded the new version of iTunes 11.0.3 and now I get this error when I go to update Apps...any solutions????  You can not update this software since you have not owned the major version of this software.

    You can not update this software since you have not owned the major version of this software.
    any soultions???

    Same here. Just becoming a nightmare. Updated iTunes and now can't update apps it itself is showing as available updates. Count me in on the latest "You can not update this software since you have not owned the major version of this software." bug.
    Next I have to post about a new problem in iPhoto on a new thread.... it lost the "link" between some but not all photos I have in the library and what it itself posted to FaceBook a few hours ago...
    Incredibly frustrating.
    Imran

Maybe you are looking for

  • PDF Proofing Problems in Acrobat Reader

    I have initiated a PDF Review for Comments and Markups in Adobe Acrobat Pro. My reviewers all have Adobe Reader and when they open the document, they are able to view it, but not able to comment and mark it up. They can't even access the Comment & Ma

  • Function module to get BOM which WOULD be created if I open a production

    Is there a function module to get the BOM which WOULD be created if I open a production order? note that I don't have the produciton order created. I already tried with the FM CS_BOM_EXPL_MAT_V2 and CSAP_MAT_BOM_READ. I debuged the CO01, but I did no

  • People Refinement Panel not displaying "Department" filter category.

    I am trying to create people directory in SharePoint 2010. I am using "People Search Core Result" web-part and "People Refinement Panel" web-part. Following is the screen of my "People Search Core Result" webpart properties: Following is the "Filter

  • Batch active at client level

    Hi All, Batch status is active at client level. However, in the inbound delivery I am able to receive an existing batch for some other material. Ideally, I should get an error that the batch already exists etc because the batch is active at the clien

  • ERS Self-Billing Output Messages

    Hi, We have a small issue when running our self-billing process as follows: 1) MRRL - we run this to see all the goods movements for the week or period - no problem here, the FI document is created OK. 2) MR90 - we then run this to process the output