How to detect if user clicks on another cell in a JTable while editing?

I use a custom TableModel which extends AbstractTableModel and I serialize the TableModel to save the data in a file. Sometimes when I try to serialize, my program crashes after putting in random data in to the table. I have reduced the problem down to if a user is editing a field and clicks on another cell instead of hitting "enter", then then program will crash if that was the last action when trying to save.
I am thinking it might be something with the custom TableModel class, like I am missing a method or something. I have getColumnName, getColumnCount, getValueAt, setValueAt, isCellEditable
Thanks

Clicking on another cell should not cause a problem as this will stop editing in the previous cell. However if you click on your save button directly then the editor is still being used. Use the following after creating your table:
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

Similar Messages

  • How can i add a MouseMotionlistener  to the cells in the JTable?

    hi !
    how can i add a MouseMotionlistener to the cells in the JTable?

    yes i have.but that is different from adding MouseMotionlistener to the cells for me .
    i just want get the values where the mouse moves to .

  • Forms: how to make it so that when the user clicks something, another form pops up?

    Sorry if that's confusing, but like how for example, you have:
    ADDRESS: _________________________  +another address
    & then if the user typed in information into the address field and wanted another address, it would look like:
    ADDRESS: __________________________
    ADDRESS: __________________________ +another address
    & so on... is there a way to do this?

    What you want is something like this
    http://dynamicdrive.com/dynamicindex16/chainedselects/index.htm

  • Getting a video to stop playing when user clicks on another button to navigate

    Hello,
    I am trying to create a little website in flash.. I have some video that plays automatically once the user goes to that section (I am using frame labels to navigate from section to section of the site).
    But, when the user clicks another button to go to a different page, the video is still playing because I hear it..How can I stop the video from playing once another button gets clicked?
    thanks
    babs

    All's you should need, if the video starts playing on its own, is...
    function clickSection(evtObj:MouseEvent) {
         if (this.currentLabel == "about") {
              about_mc.vid_mc.gotoAndStop(1);
         gotoAndStop(evtObj.target.name);
    If the video needs to be kick started because it was sent back to stop at frame 1 due to a previous navigation, then place that kick start in the about frame itself... about_mc.vid_mc.play();
    If that's not working, be sure to check that your instance names are assigned.  Also, I have been assuming that the video is embedded into the timeline of the movieclip, so if that's not the case, then some other solution may be needed.

  • !!URGENT!! how to detect HTML link click in JTextPane??

    I'm using JTextPane to display HTML file.
    Now I want to detect event when user click on a hyper link in that HTML file.
    So that I can open a new window for use to save it or something else.
    How can I do that??
    Please help!!!

    The JEditorPane API description has an example of how to write a HyperLinkListener.

  • Detecting when user clicks title bar of TitleWindow

    I am just beginning to dabble in Flex and am loving it so
    far. I can't seem to figure out how to detect when a user clicks
    the title bar of a TitleWindow. Could someone please give an
    example of the correct way to detect this? How do you tell the
    application to dispatch an event only when the title bar is clicked
    and not the contents of the TitleWindow.
    Thanks!
    Josh

    Subclass TitleBar and add a mouseDown event handler to the
    protected titleBar property (of type UIComponent). That event
    handler will execute when a person clicks down in the header.
    Stephen

  • How to detect only single click and not double-click mouse events in Swing?

    Hi,
    In my application, I want to implement a functionality only for single click. But problem is on double click, first i can see a single click and then double click.
    i.e e.getCount() return 1 and then 2 for double click. I want to avoid this situation.
    Shouldn't it be just one event with a clickCount of 2? or any alternative solution?
    Please let me know how can i stop this.
    Thanks in advance..
    Cheers
    Somasekhar
    Edited by: SomasekharPatil on Mar 13, 2009 3:36 PM

    Maybe something like the below example:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.SwingUtilities;
    import javax.swing.Timer;
    public class SingleClickOnly {
        public static void main(String[] args) {
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
              new SingleClickOnly().createGUI();
        public void createGUI() {
         JFrame frame = new JFrame();
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         JLabel label = new JLabel("Only acts on a single click");
         label.addMouseListener(createListener());
         frame.add(label);
         frame.pack();
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
        public MouseListener createListener() {
         return new MouseAdapter() {
             private int clickCount = 0;
             private final Timer timer = new Timer(1000, new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  if (clickCount == 1) {
                   System.out
                        .println("Executing action on click count 1 only");
              timer.setRepeats(false);
             @Override
             public void mouseClicked(MouseEvent event) {
              clickCount = event.getClickCount();
              System.out.println("Clicked: " + clickCount);
              if (clickCount == 1) {
                  if (timer.isRunning()) {
                   timer.stop();
                  timer.start();
    }Piet

  • How to findout whether user clicked print or preview

    Hi ALL,
    i NEED TO UPDATE A ZTABLE ONLY WHEN THE SCRIPT OUTPUT IS PRINTED. IF THE USER CLICKS PRINT PREVIEW OR CANCEL THEN I SHOULDN'T UPDATE THE TABLE.
    cAN ANYONE TELL WHAT PARAMETER I NEED TO CHECK. I'm looking at itcpo structure in debug mode i didnot found any difference when i clicked print or print preview
    THANKS

    check the sy-ucomm
    Print = PRNT is Ok code
    Print preview is PREV is Ok code
    keep the break point at OPEN_FORM and use sy-ucomm in debugging.
    Thanks
    Seshu

  • Clicking in a cell in a JTable that autoscrolls horz

    I have a JTable inside of a JScollPane. The JTable is wider than the JScrollPane so the scroll bar becomes enabled. If I have a column that is paritally obstructed and a I click in a cel in the column the scroll panel scrolls horizontally in an attemp to make the entire cell visible. Is there a way to stop the auto scrolling without making the table disabled?
    Thanks
    Chris

    try with this.
    table.setAutoscrolls(false);

  • How to restrict mutiple user clicks with asynchrounous behavior of FLEX

    I have developed a flex application and it has a datagrid, and on double clicking on the datagrid, I am showing a popup window ( the code in the popup window has call to httpService.send(), to get the data and display). Before the popup is opened, the user is double clicking again on the datagrid, which inturn is trying to open the popup window (with a new call to web service). These calls are piling up. How can i restrict making call to httpService.send() when user double clicked for the second time on the datagrid. Since, the web service call is asynchronous by nature, I am not able to figure out a way for this. Can anyone please help.

    Hi,
    You can use bussyCursor for this and keep it busy until you don't recieve the response of any particular click.
    Like  CursorManager.setBusyCursor(); on the click of mouse.And  CursorManager.removeBusyCursor();
    after getting the response from the server.
    Also you can use Application.application.enabled = false; until you dont get response of the earlier's click.
    And then set it to true after the response.
    with Regards,
    Shardul Singh Bartwal

  • How to detect apps users holding locks

    Dear all
    Finding out users holding locks is easy for database and then killing them using alter statement
    But when the Sid is revealed, how can i link them to apps users and find who the user actually was

    Sawwan,
    On my test server, i logged in from a user farid and held a lock on MTL_SYSTEMS_ITEMS_B table through the item master form
    Then i did as follows just to analyze how to find apps username holding the lock
    SQL> select object_id from dba_objects where object_name='MTL_SYSTEM_ITEMS_B';
    OBJECT_ID
    38489
    38715
    SQL> select * from v$lock where id2=38489 or id2=38715;
    no rows selected
    SQL> select * from v$lock where id1=38489 or id1=38715;
    ADDR KADDR SID TY ID1 ID2 LMODE
    REQUEST CTIME BLOCK
    000000009D869FE8 000000009D86A010 347 TM 38489 0 3
    0 165 0
    SQL> select paddr from v$session where sid=347;
    PADDR
    000000009F912AE0
    SQL> select addr,pid from v$process where addr='000000009F912AE0';
    ADDR PID
    000000009F912AE0 57
    SQL> select
    2 d.user_name "User Name",
    3 b.sid SID,b.serial# "Serial#", c.spid "srvPID", a.SPID "ClPID",
    4 to_char(START_TIME,'DD-MON-YY HH:MM:SS') "STime"
    5 from
    6 fnd_logins a, v$session b, v$process c, fnd_user d
    7 where
    8 b.paddr = c.addr
    9 and a.pid=c.pid
    10 and a.spid = b.process
    11 and d.user_id = a.user_id
    12 and a.SPID = &PID;
    Enter value for pid: 57
    old 12: and a.SPID = &PID
    new 12: and a.SPID = 57
    no rows selected
    Now can you plz tell me if all i did was right and the query doesnt work or something i did was wrong in the above action plan

  • Edit User Profile How do I enalble user lo loggin to their own profile page and edit it?

    Hi
    I am having some problems....... any help would be nice
    I am using DWCS3 and ADDT toolbox extension wamp and phpmyadmin
    I am trying to create a site for people to be able to post a profile with a picture and info and display it in a dynamic table.
    I can create the form, a database and display the data on another page in a dynamic table all ok..... kind of.
    I can create a user registration system with ADDT.
    I can redirect them after registration to a post profile page, which has a form to upload details. I can then display those details on a user info page.
    I would like to allow logged in users to be able to click on a link to their own profile page , which would show the same form that was filled out in the post profile page, but would be already populated with their previously entered information. I would like users to be able to edit the content of the form and update the information in the database and automatically delete delete any previously entered information ( only in the fields that have been edited)
    How do I go about doing this?.... step by step?
    I want to allow logged in user to view their own profile not every bodies.... how do I do that?
    I have read on another post that to do something similar to this I should filter my database information using a session varialble MM_username that I think is created automatically after user logs in .... but I don;t know how to do this.... I really don;t understand is this the way I link my user to a page that only displays their info ? or is there another way?
    I would also like to allow only people who have posted a profile to be able to edit profile ...... do I do that by
    1. new user registers and is redirected to login page
    2. user logs in and is redirected to an index page that has a post profile button and a edit profile button but only the POST button is active ( and links to a form to post info ) and the edit profile button is linked to a " You must post a profile first" page ( with a link back)
    3 so user posts profile and is directed to an index page which has an edit profile button which is now linked to an edit profile page
    Does that sound correct?
    Any suggestions in getting all this to work would be much appreciated

    Hi Yomi,
    I have created the users page which submits to a members page and tell the user to edit biodata, profession, and hobbies. but on clicking I am really confused on how the id will be transfered from the members page to update biodata and the user updates the form which will show past records. this should also apply to the profession and hobbies
    If I understand this right, you might want to consider providing a complete "userdata" section which comes with a Dynamic List and a Dynamic Form to have users add & update their data plus (via the Dynamic List) track all past records
    Lastly is it possible I create recordset at will and the id will be passed thru since kt-login-id behaves sololy
    I really can´t recommend this "pass user_id as URL variable" approach in this case, as URL variables are displayed in the browser´s address bar -- and this is absolutely insecure, because anyone could simply change the displayed "user_id" value, reload the form and hence edit data which belongs to a different user.
    The only secure method is indeed to use ADDT´s session variable kt_login_id
    Fatal error: Call to undefined function: var_export()
    Not sure, but maybe some "includes" files haven´t been generated
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • How do I disallow users from saving the data they enter into an Editable form?

    Hi all,
    I am working with a client who does NOT want their users to be able to save their data. In other words, when the user opens the PDF file, they can enter data into the editable fields, but they should NOT be able to save that data as part of the PDF.
    Does that make sense?
    My client doesn't want the user to be able to save a local copy of the PDF with any of the data entered onto the form.
    Based on what I've found in my research, as of Version 11, Adobe Reader now allows users to save their data. Unfortunately, my client doesn't want that.
    Any help?
    Thanks,
    Steve

    About the best you can do is include a JavaScript that resets the form when it is saved, so no entered data remains in the fields. The problem with this approach is JavaScript can be disabled, resulting in the form not being cleared and allowing the filled-in form to be saved.
    You can address this with an additional JavaScript that runs when the form is opened that sets all of the fields from read-only to not read-only, allowing the fields to be filled-in. If JavaScript is disabled, the script won't run when the document is opened and the fields will remain read-only and therefore not fillable.
    The user would be able to work around this by having JavaScript enabled when the document is opened and disabling it after filling-in the form but before saving it. Most users would not be aware of how to do this though.
    If there are rules/regulations/laws in place that require something more certain, you'll have to take a different approach.

  • How to avoid the user accounts to appear in the disk boot while installing Yosemite?

    Hi, there is an issue when I encrypt the disk in Yosemite, when I make a clean installation, I first format partition with encryption, install system and restart computer, in the first boot the system ask only for disk password then continue creating user account, when I finish the configuration and restart the computer, the first boot screen ask me for disk password or user password, this is wrong, I want that the system ask me first the disk password and then the users accounts passwords to start the session as it was in Mavericks, so I try different ways to do this.
    1. In clean Installation is not working, every time that create a user it appears in the first boot screen, in which the system must ask only for disk password.
    2. In upgrade Installation with a computer already encrypted, it appears to works properly but if you create a new user it appears in the first boot screen.
    3. I test this by doing a clean installation without encryption, create a user and make an image of this partition, then I copy the dwg image to an external disk, then start computer with an USB with Yosemite, using disk utility I erase the partition and format it with encryption, then restore the dwg image in this partition, it looks that works properly, but if I create a New User then the new user appears in the first boot screen when only must ask for disk password.
    Can someone help me with this issue please?
    If there is someone of Mac can you tell me if this is going to be corrected in this version? or we must wait for the next OS X version.
    Thank You.

    Hi, there is an issue when I encrypt the disk in Yosemite, when I make a clean installation, I first format partition with encryption, install system and restart computer, in the first boot the system ask only for disk password then continue creating user account, when I finish the configuration and restart the computer, the first boot screen ask me for disk password or user password, this is wrong, I want that the system ask me first the disk password and then the users accounts passwords to start the session as it was in Mavericks, so I try different ways to do this.
    1. In clean Installation is not working, every time that create a user it appears in the first boot screen, in which the system must ask only for disk password.
    2. In upgrade Installation with a computer already encrypted, it appears to works properly but if you create a new user it appears in the first boot screen.
    3. I test this by doing a clean installation without encryption, create a user and make an image of this partition, then I copy the dwg image to an external disk, then start computer with an USB with Yosemite, using disk utility I erase the partition and format it with encryption, then restore the dwg image in this partition, it looks that works properly, but if I create a New User then the new user appears in the first boot screen when only must ask for disk password.
    Can someone help me with this issue please?
    If there is someone of Mac can you tell me if this is going to be corrected in this version? or we must wait for the next OS X version.
    Thank You.

  • In Aperature, how do you keep photos in the order you changed them to while editing? When you go to burn them to a disk, the order changes from what you see on the screen.

    I need to know how to save my photos to a disk for a client in the order I changed them while working on them. I photographed a party with another photographer and joined both photographers photos. Now I want to keep them in the order the event took place and how I rearranged them.

    The exported photos will show on the disk like any sequence of files, sorted by date, name, filetype, etc. To help your client to sort them according to your sequence, rename the files and append a sequence number. You can rename them on export by using an export preset, for example the name format "Custom name with index". That will append a number to the filename, according to the position in the album you are exporting.

Maybe you are looking for