JTable not getting latest data (unless mouse is focussed out of the cell)

Hi,
I am using JDK 1.4.2. I am having a basic problem of reading the data present in a JTable.
JTable table = new JTable(9, 9);
JButton solveButton = new JButton("Solve");
solveButton.addActionListener(new DumpListener(table));The dump listener just dumps the data in the table.
I have a 6*6 jtable where each value is a number. Now i focus the mouse on say square (1,2) and enter some data, then on square (5,5) and enter data say "4". There is a button in this panel, and which on being clicked, gets the table data and does some operation on it.
Problem is when i use the "getValueAt" API, it gives correct data for square(1,2) but not for (5,5). This is because the mouse focus is still on square (5,5). However if i focus out of square (5,5) using my mouse (to some other random square) then the data comes up properly. Am i missing something here?
I understand it is to do with the data model getting altered only when the mouse if focussed out? But this seems to be very trivial. Is there a way of getting the data out without focusing the mouse out of the cell?

My solution uses a JFrame instead of a JApplet.
But I think the effect is the same.
First of all, the setVisible(true) should be put after all components are added.
Secondly, when you retrieve data in the table, you'd synchronized() the model.
Thirdly, I didn't find any problem when I call stopCellEditing(). Perhaps I'm using Java 5. Anyway, please try whether the following code works.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.TableModel;
public class DummyFrame extends JFrame {
     public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    DummyFrame frame = new DummyFrame();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.pack();
                    frame.setVisible(true);
     public DummyFrame() {
          JTable table = new JTable(9, 9);
          JButton data = new JButton("DATA");
          data.addActionListener(new SimpleButtonListener(table));
          JPanel panel = new JPanel();
          panel.setLayout(new BorderLayout());
          panel.add(table, BorderLayout.CENTER);
          panel.add(data, BorderLayout.SOUTH);
          getContentPane().setLayout(new BorderLayout());
          getContentPane().add(panel);
class SimpleButtonListener implements ActionListener {
     JTable table;
     public SimpleButtonListener(JTable table) {
          this.table = table;
     public void actionPerformed(ActionEvent e) {
          synchronized (table) {
               if (table.isEditing()) {
                    System.out.println("Is Editing!");
                    table.getCellEditor(table.getEditingRow(), table.getEditingColumn()).stopCellEditing();
          printArray(getData());
     String[][] getData() {
          synchronized (table) {
               TableModel model = table.getModel();
               synchronized (model) {
                    String[][] question = new String[9][9];
                    for (int i = 0; i < 9; i++) {
                         for (int j = 0; j < 9; j++) {
                              question[i][j] = model.getValueAt(i,j) == null ? null : model.getValueAt(i,j).toString();
                    return question;
     void printArray(String[][] question) {
          int rows = question.length, columns = question[0].length;
          for (int i = 0; i < rows; i++) {
               for (int j = 0; j < columns; j++) {
                    System.out.println("[" + i + ", " + j + "] -> "
                              + question[i][j]);
}And ... please don't forget to give me the 5 Duke dollars if it works.
Thank you!
Asuka Kenji (UserID = 289)
(Duke Dollars Hunting now ...)

Similar Messages

  • How to get latest date

    If there are two dates for a P O and i want to get latest date how to giv the condition in select stmt.kindly ctell me pls.from EKET table.

    Hi Sameer,
    Try using this code.
    IF NOT it_ekpo[] IS INITIAL.
      SELECT ebeln
             ebelp
             etenr
             eindt
             menge
             wemng
        FROM eket
        INTO TABLE it_eket
        FOR ALL ENTRIES IN it_ekpo
        WHERE ebeln EQ it_ekpo-ebeln
        AND   ebelp EQ it_ekpo-ebelp.
      IF sy-subrc EQ 0.
        SORT it_eket BY ebeln ASCENDING
                        ebelp ASCENDING
                        eindt DESCENDING.
        DELETE ADJACENT DUPLICATES FROM it_eket COMPARING ebeln
                                                          ebelp.
      ENDIF.
    ENDIF.

  • BC4J - ViewObject not returning latest data

    BC4J - ViewObject not returning latest data. Some kind of EO/VO Cache Latency Issue.
    I have an edit page that presents a drop-down list which is suppose to display * un-assigned * messages, but does not. The drop-down list is using an <jbo:InputSelect> tag that gets values from a ViewObject (UnAssignedMessageView ) which issues the query listed below. Note, the ViewObject is not based on an Entity Object.
    (Query in UnAssignedMessageView)
    select      message.message_desc_short, message.message_id
    from     fmm.message
    where      message.message_id not in (select cardmessage.message_id from fmm.card_message)
    and message.message_id != 0     
    (from the edit.jsp)
    <jbo:ApplicationModule id="am" configname="com.maxmcbyte.fmm.model.ModelModule.ModelModuleLocal" releasemode="Reserved" />
    <jbo:DataSource id="ds" appid="am" viewobject="CardMessageView1" />           <<****** The VO where the inserts/updates are recorded.
    <jbo:DataSource id="ds2" appid="am" viewobject="MessageUnAssignedView" />     <<****** The VO for the unassigned message drop-down-list.
    The problem is at step 3.
    Starting with 3 Unassigned Messages.
    Step 1: enter new record AND select a MESSAGE_ID from the drop-down list.
    Step 2: commit the transaction.
    Step 3: enter another record AND select a MESSAGE_ID from the drop-down list.     <<****** the list should now be displaying 2 unassigned messages but is displaying 3.
    Note, if I check the database after step 3 using the same query as in the UnAssignedMessageView I get the correct result. I guess I'm not understanding how BC4J ViewObject Caching is working. It is strange that even after I commit the record that the cache is not updated.
    I have read the docs and will have to re-read them again * but * it would be REAL NICE to see an illustration of "A DAY IN THE LIFETIME OF DATA IN BC4J" for dummies like me.
    Can anyone tell me what I'm missing here AND what specifically needs to be done?
    Thanks All,
    Bill G...

    Well, I figured it out * BUT * this is the sort of thing that I'll bet stumps a lot of new users * AND * should be posted to a "Gotch-Ya" list.
    I'd still like to see an illustration of "A DAY IN THE LIFE OF DATA IN BC4J"
    Bill G...
    <jbo:ApplicationModule id="am" configname="com.maxmcbyte.fmm.model.ModelModule.ModelModuleLocal" releasemode="Reserved" />
    <jbo:DataSource id="ds1" appid="am" viewobject="CardMessageView1" />
    <jbo:DataSource id="ds2" appid="am" viewobject="MessageUnAssignedView" />
    <%-- adding this did the trick --%>
    <%
    ViewObject view2 = ds2.getRowSet().getViewObject();
    view2.executeQuery();
    view2.first();
    %>

  • Why the 2LIS_08TRTK extractor can not get  all data

    Hello, BW Gurus.
    Why the 2LIS_08TRTK and 2LIS_08TRTLP extractors can not get all data. I had used the RSA3 and get 10 registers, when a check at the VTTK table I had 20 registers, I didnt use filters at RSA3, could you help to know what happen o correct it.

    Is it because
    <i>
    Shipment documents and their dependent objects (shipment stages as well as shipment items [deliveries in the shipment]) are only extracted into BW when the Shipment completion status has been set.
    This is necessary because the numeric values that result from the delivery documents are only established at the time. If the data were already stored earlier in BW, the shipment data would not be updated if the delivery notes were changed in BW.
    </i>
    - from oss note 573470.

  • SAP Fiori Purchase Order  not getting any  data & getting a 404 Error Message

    Hi
    I have downloaded Purchase Order SAPUI5 code from SAP Fiori server.  import it into Eclipse then try to run that Apps/code(SAPUI5) from browser.
    1) Not getting any Data.
    2) It show 404 Error Message.
    3) Its show wrong User Name as Login

    Hi Pankaj,
    First question :
    Are you able to get the data in Fiori ?
    Secondly,
    You have mentioned as Purchase order, but here you have given snapshot of Purchase requisition app, and you are calling also purchase req app from the browser. Please clarify
    If you have mistakenly written PO  : If you are still not getting data for Approve Purc req, then check if your RFC connections are proper from Gateway to backend and backend to Gateway.
    If RFC is working fine, check the Remote logon, it should be marked as Current user. If its not marked as current user, then it will show some other user.
    Regards,
    Tejas

  • Disk Quota Warning Job Not Showing Latest Data

    Hi,
    I received warning email about "Approaching Web Site Storage Limit". The old quota is 4GB, the old warning limit is 3.8GB.
    I increased the quota to 5GB and the warning limit to 4.8GB in Central Admin.
    The following week, I received warning email again. I checked the current site storage limit is 4GB, whereas the warning limit is 4.8GB.
    I have restart the timer service, but still the same.
    May I know why and how to force the timer job to use the latest data?

    Have you double checked that the updated quota is applied to the site collection? Per
    http://technet.microsoft.com/en-us/library/cc263480(v=office.14).aspx
    The modified quota template will not be automatically applied to any existing site collections that use the quota template. A member of the Farm Administrators group must manually apply all modified values to all existing sites that use the quota template.
    Regards,
    Andrew J Billings
    Portal Systems Engineer//MCSA,MCSE
    Blog:
    http://www.andrewjbillings.com 
    Twitter:   LinkedIn:
      

  • Do not get any data from 0CA_IS_TS_1 and 0CA_IS_TS_2 data source

    Hi all,
    We are trying to populate cubes(0CATS_C01) and (0CATS_C02) for which data sources are 0CA_IS_TS_1 and 0CA_IS_TS_2 respectively. We activated business content for these data sources. When we run these data sources in RSA3 we do not get any data even though we have data in the repective tables. We applied SAP Note :1586467, which says (Note 1586467 - Extractor 0CA_TS_IS_1 returns no data), Can you please help me out in knowing if we are missing some thing?
    Thank you,
    Bob.

    Hi,
    To use this DataSource you must have implemented Support Package SAPKH46C32, or have made the relevant corrections in SAP Note 509592.
    Pl check you have required data as mentioned below
    When transferring time sheet data to the Business Information Warehouse (BW), you must note the connection between the following data sources:
    ·        CA_TS_IS_1 (Time Sheet Data (Approved))
    Documents are written in the SAP R/3 system for Time Sheets with status 30 (approved). The documents log the changes that have been made to data records.
    Therefore, the SAP R/3 system can perform a delta update for this data source. The system only transfers newly approved data records and changes that have been made to existing data records. At the same time, the SAP R/3 system notes the date of the last delta transfer.
    ·        CA_TS_IS_2 (Time Sheet Data (Released for approval))
    The SAP R/3 system does not write documents for Time Sheet data with status 20 (released for approval). This means that changes made to these data records are not logged.
    Therefore, the SAP R/3 system always performs a complete transfer of data records that have been released for approval. The number of data records that need to be transferred usually remains constant because in the period between two transfers not only new data records are added but other data records are also approved. Therefore, system performance is not restricted.
    Thanks and regards

  • New Server - Not Getting Event.Data back

    Its a weird problem i'm having. I've setup a brand new server (Original was a shared hosting setup from godaddy).
    I'm using my same application
    And i'm not getting event.data info back (in XML form)
    Here's an example:
    private function onUploadCompleteData(event:DataEvent):void {
    updateStatus(event.data, _numCurrentUpload - 1);
    var x:XML = new XML(event.data.toString()); <---- NOT FIRING
    Application.application.upAvatar = "/profile/" + x.name;
    Does anyone have any ideas? I was thinking it could be a misconfiguration with my apache settings.
    I'm using:
    Ubuntu
    Apache2
    PHP5
    CURL
    Thanks..

    hi,
    have you placed a fault event handler on your request to see what error if any is being returned ?
    David.

  • XL Reporter not getting any data

    <b>Hi</b>
    When I am using XL Composer and generating report using it, I am getting data what the fields I have dragged. Not getting any data when generating same report in organizer from composer except the Title field names. Before I got but now I am not getting.
    <b>STEPS Taken</b>  
                     XL Reporter Composer Tool bar
                     Generate
                     Generate(Window)(Name: given Sample & checked Generate report    then ok)
    And having another problem when generating sample reports I am getting data and when editing that report are preparing new with some fields, I am not getting any data.
    <b>Example:</b>   I have made Edit of Bank Book and placed extra field Document No,   saved the report and generated I am not getting any data except titled fields.
         In new report I have taken BP Code and sales Employee I am not getting any data.
    Please Can any one help me,   It is urgent.
    Thanks in Advance.
    <i><b>Urs
    Sindhu</b></i>

    If you did not select any "total" field (quantities, totals, etc), XL Reporter will show data only at report composer. It will not work at final XL Report itself.
    This is a normal behaviour of XL Reporter, unfortunetaly.
    If you are trying to create a simple list of records, I suggest to use Query Generator, combined to PLD in order to get a formatted report.

  • Why can i not get my email to send from my mac? the outgoing server keeps saying its offline?!

    why can i not get my email to send from my mac? the outgoing server keeps saying its offline?! any help would be greatly appreciated

    markwmsn wrote:
    To each his own. I own Outlook, but I avoid using it like the plague. The only Mac mail software I have liked better than Apple's Mail was Qualcomm's Eudora, which is no longer updated or even available, won't run without Rosetta, and unfortunately never quite got the hang of IMAP.
    Check out this post regarding this user's continuing use of Eudora on his Lion MacBook:
    Shield Eudora from Lion's Claws
    A thousand thanks and kudos to Michael for this fabulously excellent thread!
    Eudora's now happy in her new Snow Leopard VM home on my Lion ModBook!
    Appears essential to keep resource-forked data off Lion disk:
    First attempt with Eudora on SL VM was sharing data on Lion disk. Error messages on open like "can't find Table of Contents" suggest Lion ate resource forks crucial to Eudora.
    Found success by transferring data from SL Mac to thumb drive, then mounted drive in SL VM so Lion couldn't touch.
    While Michael warns against storing data in VM, appears there's no choice with Eudora. At least She's enthroned on a mirrored RAID.
    There is Nothing like Eudora! (to tune of "There is Nothing Like a Dame" from South Pacific -- Oops! my gray hair is showing!)
    (It's amazing Parallels can force Lion to store taboo resource forks. Thank God for code warriors!)
    B
    http://forums.macrumors.com/showpost.php?p=16496788&postcount=355

  • Ipad - how to push Exchange calendar events to iCloud account? MobileIron is used to get Exchange data -- is there an app to push the ipad version of the events to iCloud?

    ipad - how to push Exchange calendar events to iCloud account? MobileIron is used to get Exchange data -- is there an app to push the ipad version of the events to iCloud?
    There are two separate calendars on ipad (ios 7.1) one for icloud, one fo exchange. I have tried a couple of calendar apps and while they do a good job of showing the events in the app - they don't push (synch) back to iCloud. Any thoughts on an app that will take my ipad calendars and synch them to a single icloud calendar/account?
    Thanks

    Hi
    You asked about a recommendation for an app to paste a group of addresses into the To, Cc or Bcc fields of an email?
    Our "MailShot Pro" app is the only one we know of on the App Store that creates special "group contacts" in your address book which contain all your groups email addresses, but can be used just like regular contacts from most of your favourite apps. We now have nearly 50000 people using it, and growing steadily every day.
    Here is a link if you would like to know more “MailShot Pro” (itunes link).
    A free version is also available if you'd like to try it out with a small nmber of contacts.
    If you need any customer support just contact us at the website, we're always happy to help.
    Peter
    www.solubleapps.com
    Disclosure: I am the developer of this app and may benefit from its sale- (but so might you)

  • I have a new iMac with osx 10.8.3 i can not get my hp laserjet m1522nf scanner to work. The printer works but when in scanner mode the scanner does not show up

    I have a new iMac with osx 10.8.3 i can not get my hp laserjet m1522nf scanner to work. The printer works but when in scanner mode the scanner does not show up.I tried to install the newest hp driver for the printer but when I install the computer ca not find the printer.

    Repair permissions and restart your computer.
    Make sure you have the updated scanner drivers installed. 
    Install the gimp drivers:  http://gimp-print.sourceforge.net/MacOSX.php 
    http://support.apple.com/kb/PH11070 OS X Mountain Lion: Troubleshoot a network printer 
    http://support.apple.com/kb/PH11143 OS X Mountain Lion: Reset the printing system
    http://support.apple.com/kb/HT3669 Printer and scanner software available for download
    What to do when you can't print

  • I'm in Brazil and need to talk via e-mail or chat, with the USA App Store. It happens that I made a purchase and did not get because I live in Brazil and mistakenly bought the site of the USA. How do I? Do you have any e-mail the department in charge?

    I'm in Brazil and need to talk via e-mail or chat, with the USA App Store. It happens that I made a purchase and did not get because I live in Brazil and mistakenly bought the site of the USA. How do I? Do you have any e-mail the department in charge?

    I've tried, said they could not help and I should get in touch with the USA App Store. But the problem of getting in touch with the App Store USA is the only option I have on the phone, and my English is not very helpful. Therefore needed a complete address e-mail.

  • I am not getting clear alert from OEM 11g Grid, even after the issue solved

    I am not getting clear email alert from OEM 11g, even after the issue fixed.
    For eg: I got critical alert when I have shutdown the DB.But I didn't get clear alert even I have started my DB and is up running.
    I am getting only critical and warning alerts but not clear alerts from 11g Grid control.
    Please help me in troubleshooting the issue....
    Thanks in advance.............
    vgcrl

    Bullitt wrote:
    there email address is [email protected]
    Thank you... I will give that a go...
    Martin

  • HT1311 i tried to do a backup from my old iphone as i have a new one that was signed into another itunes account. it said i cant do it because the iphone rejected the request. how do i get around this? i have signed out of the old acct and into mine on th

    i tried to do a backup from my old iphone as i have a new one that was signed into another itunes account. it said i cant do it because the iphone rejected the request. how do i get around this? i have signed out of the old acct and into mine on the phone

    What is the precise wording of the error message that occurs on the old iPhone when attempting to do a backup?
    Are you attempting to backup via iTunes on the computer or iCloud?

Maybe you are looking for

  • Is there a log for logins?

    I want to establish multiple accounts on one computer and want to find out if as an admin I can keep track of who's been on the computer and for how long? Is this possible with panther and/or tiger? Thanks.

  • Message Mapping : Testing at Runtime

    Hi all, I am doing scenario File XI IDoc... I was encountering error.. Runtime exception in Mapping... So i tried the testing step described by michal. if i paste the payload of the data obtained from SXMB_MONI in test tab of message mapping editor i

  • Depreciation Run executed for a period but no posting found

    Dear Experts, I have checked a few of the FA in the Fixed Asset Master, and confirmed that they have not been depreciation run yet for period "2009-02". My current period is set to "2009-02" as well. But when I tried to run depreciation run for "2009

  • A few questions... Messenger and flash player

    okay guys yesterday i bought and ipod touch and i love it! i have the 2,0 software and app store! but can i get msn messenger or windows live messenger on my ipod touch? question number 2 i can watch videos directly from itunes when im connected to a

  • I'm getting an error Starting up FGEN-SFP

    I'm getting an error starting up NI-FGEN Soft Front Panel v1.4. On the splash screen that starts up with the application, in the midst of loading NI configuration manager, the following error appears: "NI-FGEN for DAQ 2.0.0 or higher was found, but i