JTable.changeSelection() has stopped working for me in Java 1.5

The application I'm working on has a search function for a large table of data. In addition, you can restrict the search to a selected area of the table. This worked fine when compiled on Java 1.4, but has stopped working on Java 1.5. It appears the problem is with changeSelection not actually changing the selection to the cell that was found in the search.
I've been able to reproduce the problem with some small modifications to the SimpleTableSelectionDemo.java tutorial program. I've included the code below with my changes.
Basically all I did was modify the mouseListener so that instead of printing the table contents, it calls changeSelection to a fixed location (simulating the search going to a matching cell).
If I compile/run in 1.4, I can select a cell or region, right-click the mouse and see the specified cell selected. If I start typing the selected cell is edited.
If I compile/run in 1.5, when I right-click the selected cell is not changed (the second selected cell of the select region stays selected). If I start typing the wrong cell is edited.
Hopefully someone can tell me if this is a run-time bug, or a change in behavior (and what I need to do to get it working again in 1.5).
* SimpleTableSelectionDemo.java is a 1.4 application that requires no other files.
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JComponent;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
* SimpleTableSelectionDemo is just like SimpleTableDemo,
* except that it detects selections, printing information
* about the current selection to standard output.
public class SimpleTableSelectionDemo extends JPanel {
    private boolean DEBUG = true;
    private boolean ALLOW_COLUMN_SELECTION = true;
    private boolean ALLOW_ROW_SELECTION = true;
    public SimpleTableSelectionDemo() {
        super(new GridLayout(1,0));
        final String[] columnNames = {"First Name",
                                      "Last Name",
                                      "Sport",
                                      "# of Years",
                                      "Vegetarian"};
        final Object[][] data = {
            {"Mary", "Campione",
             "Snowboarding", new Integer(5), new Boolean(false)},
            {"Alison", "Huml",
             "Rowing", new Integer(3), new Boolean(true)},
            {"Kathy", "Walrath",
             "Knitting", new Integer(2), new Boolean(false)},
            {"Sharon", "Zakhour",
             "Speed reading", new Integer(20), new Boolean(true)},
            {"Philip", "Milne",
             "Pool", new Integer(10), new Boolean(false)}
        final JTable table = new JTable(data, columnNames);
        table.setPreferredScrollableViewportSize(new Dimension(500, 70));
        table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        if (ALLOW_ROW_SELECTION) { // true by default
            ListSelectionModel rowSM = table.getSelectionModel();
            rowSM.addListSelectionListener(new ListSelectionListener() {
                public void valueChanged(ListSelectionEvent e) {
                    //Ignore extra messages.
                    if (e.getValueIsAdjusting()) return;
                    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
                    if (lsm.isSelectionEmpty()) {
                        System.out.println("No rows are selected.");
                    } else {
                        int selectedRow = lsm.getMinSelectionIndex();
                        System.out.println("Row " + selectedRow
                                           + " is now selected.");
        } else {
            table.setRowSelectionAllowed(false);
        if (ALLOW_COLUMN_SELECTION) { // false by default
            if (ALLOW_ROW_SELECTION) {
                //We allow both row and column selection, which
                //implies that we *really* want to allow individual
                //cell selection.
                table.setCellSelectionEnabled(true);
            table.setColumnSelectionAllowed(true);
            ListSelectionModel colSM =
                table.getColumnModel().getSelectionModel();
            colSM.addListSelectionListener(new ListSelectionListener() {
                public void valueChanged(ListSelectionEvent e) {
                    //Ignore extra messages.
                    if (e.getValueIsAdjusting()) return;
                    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
                    if (lsm.isSelectionEmpty()) {
                        System.out.println("No columns are selected.");
                    } else {
                        int selectedCol = lsm.getMinSelectionIndex();
                        System.out.println("Column " + selectedCol
                                           + " is now selected.");
        if (DEBUG) {
            table.addMouseListener(new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
//                  printDebugData(table);
// ==============================================
// Changed to do a changeSelection() on a right-click
// without clearing any existing selected area.
                    if (e.getButton() == MouseEvent.BUTTON3) {
                        System.out.println("mouse clicked");
                        table.changeSelection(2, 3, true, true);
// ==============================================
        //Create the scroll pane and add the table to it.
        JScrollPane scrollPane = new JScrollPane(table);
        //Add the scroll pane to this panel.
        add(scrollPane);
    private void printDebugData(JTable table) {
        int numRows = table.getRowCount();
        int numCols = table.getColumnCount();
        javax.swing.table.TableModel model = table.getModel();
        System.out.println("Value of data: ");
        for (int i=0; i < numRows; i++) {
            System.out.print("    row " + i + ":");
            for (int j=0; j < numCols; j++) {
                System.out.print("  " + model.getValueAt(i, j));
            System.out.println();
        System.out.println("--------------------------");
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
    private static void createAndShowGUI() {
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        //Create and set up the window.
        JFrame frame = new JFrame("SimpleTableSelectionDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Create and set up the content pane.
        SimpleTableSelectionDemo newContentPane = new SimpleTableSelectionDemo();
        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) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

Running on Mac OS X 10.4.3
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-56)
Java HotSpot(TM) Client VM (build 1.5.0_02-36, mixed mode, sharing)
The same problem occurs here.

Similar Messages

  • My Hotmail watcher has stopped working for the past week or so. I've uninstalled and reinstalled it several different times, but it did not help

    My Hotmail watcher has stopped working for the past week or so. I've uninstalled and reinstalled it several different times, but it did not help

    Hi,
    It appears that the developer has released a newer version of Hotmail Watcher. Version 2.13 located at https://sites.google.com/site/sonthakit/hotmailwatcher. You should try updating it to see if it works then.
    From https://addons.mozilla.org/en-us/firefox/addon/hotmail-watcher/<br>
    '''IMPORTANT -- I had changed my add-on to self-host. New version had been released at my site. Please install new version'''

  • My camera on my iPad 2 has stopped working for the second time.

    My camera on my iPad.2 has stopped working for the 2nd time. Last time it just started working again after a couple of months.
    I have tried closing the camera app completely &amp; also re-booting the iPad completely but to no avail.
    Any ideas anyone?

    You'll first need to have iTunes on your computer - from the summary page (the one that opens when you select the iPad in iTunes) it'll give you options for backing up and restoring it. On that page just select 'restore iPad' and that'll get it started.
    Hope it's just software then, those out-of-warranty replacements can get pricey.

  • Can any one find a solution to this problem [ID CC 2014 has stopped working] for this file{link included}

    Hi all,
    Can any one find a solution to this problem [ID CC 2014 has stopped working] for this file{Dropbox - Questions CH-5 .indd}
    Note: I could open it, but suddenly I have faced this issue with just this file no any other of my files.
    Thanks for your help.

    try the blind export to .idml script at Adobe Community: InDesign 6 is crashing when attempting to open a particular document. All others are opening OK.

  • I cant get a photo project to email the moblile me address to someone else.  I know how, but it has stopped working for some reason.  Instead of pulling up the web address on the email form, it puts an error message?  Any ideas?

    I cant get a photo project to email the moblile me address to someone else.  I know how, but it has stopped working for some reason.  Instead of pulling up the web address on the email form, it puts an error message?  Any ideas?

    Michael,
    The link for the word 'HERE' directs to a Evergreen School District page, which outside of Mobile Me and/or Aperture. Your school district network might be intercepting the request from Aperture and displaying the 'network authentication page' that you see, instead of the email. I would get with the IT department to see if they can help you get around this.
    Have you also tried using the 'Tell a Friend' feature from another network location, like starbucks or your home?
    Cheers,
    Owen.

  • Keep getting error installation helper has stopped working for readstep2

    keep getting error installation helper has stopped working for readstep2

    attach a screenshot of that error message, FAQ: How do I capture and post a screen shot or... | Adobe Community

  • I receive the error Photoshop cs6 has stopped working for windows 7 32 bit

    I downloaded and installed cs6 for windows 7 32 bit and cant open it to use,i get the message" adobe photoshop cs6 has stopped working" I have tried different graphics drivers but still the same. My other adobe softaware works fine,IE: elements11 and lightroom4. Any ideas?

    Did you receive any error messages during the installation process?  You can check your installation log files to look for errors.  Please see Troubleshoot with install logs | CS5, CS5.5, CS6 - http://helpx.adobe.com/creative-suite/kb/troubleshoot-install-logs-cs5-cs5.html for more information on how to locate and interpret the installation log files.

  • Licensing has stopped working for Acrobat 9 Pro

    When I install Acrobat 9 Pro on my new Macbook 10.7.4, I get the message "licensing for this product has stopped working" and it tells me to uninstall and reinstall. When I first purchased Acrobat 9 Pro and installed it on my old Macbook Air, I had the same problem but I was able to fix it with one of the solutions at http://helpx.adobe.com/x-productkb/global/error-licensing-stopped-mac-os.html.
    However, none of these solutions work or make sense on my Mac version 10.7.4. I have already been on live chat with Adobe help twice and was unable to resolve the problem. Any help would be greatly appreciated! (I also have CS5 Premium installed and it works fine).

    I have been having the licensing issue with Windows 8.  I have run the licensing repair tool every few weeks.  It never "sticks".  Acrobat will work fine for a few weeks, maybe a month, then the error comes back.  Does anyone know of a permament fix. Thanks.

  • PProHeadless.exe has stopped working for Premiere Pro CS6

    I have had no problems with it until today.
    The video I was trying to produce was about 31 minutes long.
    I have had this PC less than a year and have never had PProHeadless.exe stop working for Premiere Pro CS6.
    what causes this to happen, has the last batch of updates caused this?
    PC specs:
    Windows 7 64bit fully updated
    MoBo Asus P6X58E-WS
    i7 quad core 950
    24 gigs of Ram
    10,000 rpm's Hard Drives
    very few things installed on this PC to avoid application conflicts, and I had no other applications running.
    Thanks for any input,
    Best regards,
    Tony

    Go to http://forums.adobe.com/community/premiere and, in the area just under Ask a Question, type in
    PProHeadless
    You may now read previous discussions on this subject... be sure to click the See More Results at the bottom of the initial, short list if the initial list does not answer your question

  • Internet Explorer has stopped working for IE8&9 in win7 for Oracle apps

    Dear All,
    While opening forms in windows 7 proffessional we are getting the below error ..
    Internet Explorer has stopped working
    after click the online solution getting the below
    Internet Explorer has closed this webpage to help protect your computer for IE8 and IE 9
    and it was working with Win XP and IE7...
    my Oracle application verion is 11.5.10.2
    forms developer version is 6.0.8.25
    i have checked the IE8 is certified with 11i for win7..
    Oracle Jinitiator version 1.3.1.21
    and i have tried with firefox also but it was not opening and it was stoppped at the second window i think we need install extension but enable Java for this not useful.
    i have tried with so many solution via google but resolved it....
    if any one give me solution for this and also tell me how to open forms in firefox for oracle 11i
    Thanks in Advance.....

    Hi,
    i tried upgraded the JRE but not solved.
    the problem is INTERNET EXPLORER has stopped working while opening forms
    and view problem details shows like below..
    Problem signature:
    Problem Event Name:     BEX
    Application Name:     iexplore.exe
    Application Version:     9.0.8112.16457
    Application Timestamp:     50a2f9e3
    Fault Module Name:     jvm.dll
    Fault Module Version:     0.0.0.0
    Fault Module Timestamp:     451ba4ef
    Exception Offset:     000bc430
    Exception Code:     c0000005
    Exception Data:     00000008
    OS Version:     6.1.7601.2.1.0.256.48
    Locale ID:     1033
    Additional Information 1:     f021
    Additional Information 2:     f021b4c9b91f8291caac8e31885832ca
    Additional Information 3:     4050
    Additional Information 4:     4050b4b420130162e60322654968da93
    Read our privacy statement online:
    http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
    C:\Windows\system32\en-US\erofflps.txt
    I think it was problem with IE settings or if IE8 and IE9 in win7 not supported for 11.5.10.2..
    is it correct if not pls correct me?..
    please help us..
    Thanks in advance...

  • Itunes has stopped working for PC

    I am running windows 7 64-bit on my pc and I have completely updated iTunes software.  When I open iTunes, everything works fine, I can play music in my library and sync my phone.  But when I try to open the iTunes store, i get an error saying:
    "iTunes has stopped working, Windows is checking for a solution to the problem"
    Then it closes. 
    How can i fix this???

    Yep, same issue here. Can anyone give a solution to this problem. "iTunes has stopped working", then Windows closes iTunes and start searching for solutions...
    Here are the specs
    Windows 7 64 bit, 4 gb ram, i5 cpu
    iPhone 3GS 8 GB

  • Skype has Stopped Working for one account

    Hi 
    I got an error of "Skype has stopped working" in all Operating Systems i.e. Windows, Mac, Android etc.. 
    User Name: sonattacamara
    I tested in windows with multiple skype accounts.. One account working properly.. But 'sonattacamara' account faced this problem..
    So, please clear this problem.. Suggest me the solution.
    Thank You..

    Most likely, your Skype is crashing due to this new "http hack".
    http://community.skype.com/t5/Windows-desktop-clie​​​nt/Skype-crashing/m-p/3996650#M347923
    One of your "friends" has sent you a chat message containing malicious "http sequence", which inadvertently crashes Skype installed on different devices. Yesterday, this issue was mainly affecting Skype localized in Russian, but by now seems to be more spread.
    Be aware, that due to security reason, all the posts describing in detail this hack, are removed from the Community Forum.
    See also this:
    http://community.skype.com/t5/Windows-desktop-clie​​​nt/Skype-just-started-crashing-on-multiple-clie...

  • HT4628 After 7 months of flawless performance, my airport extreme has stopped working for my iphone and ipad.  Can anyone help, i am not very computer savey.

    After 7 months of flawless performance, my allpe airport extreme wi-fi stopped working for my iphone and ipad.  I am not very computer savey.  Can someome help me?
    Thank you,
    George N

    Do you mean that only your iPhone and iPad stopped working! while other devices (Pc, laptop, etc..) still works?

  • Java(TM) Platform SE binary has stopped working when I install Java

    Hi everyone
    I have a computer where I not can uninstall or install Java.
    Every time I try to run the Java uninstaller, or the Java installer (the latest version 7 Update 51),
    Windows give me the following message:
    Java(TM) Platform SE binary has stopped working
    A problem caused the program to stop working correctly.
    Windows will close the program and notify you if a solution is available.
    When I click ok to the message, the uninstaller process continue, and after that, I guess Java is
    correct uninstalled, but I am not sure, because I still can find an add-on in Internet Explorer 11 from Java, but the folders etc. from the computer is
    deleted.
    Therefore I searched in the Windows registry database, and deleted all keys and sub keys regarding Java.
    Before I tried to install Java again, I run a registry cleaning tool and the tool also find many errors that I fixed with the tool.
    When I tried to install the latest version of Java again, the installation program give me the same results I describe above.
    After the installation I am more confused before I uninstalled the older version, because:
    1. When I start up Internet Explorer 11, I allow that the Java ADD-On must run, but if I try to verify that Java is installed correctly nothing happen
    2. If I try to run Java in the browser Google Chrome, Java run correctly, and I also can verify that Java
    is installed correctly.
    Another error message
    Windows give me when I installed Java is that a process in Windows called
    Rundll32.exe is stopped.
      When I install / uninstall other programs all working fine.
    If you have a solution I can try, or alternative an answer to why the problem come up, I will be
    happy.
    The computer is running Windows 7 64-bit Service Pack 1.
    Thanks in advance.
    Regards,
    Anders

    Have you installed Microsoft Office 2010 on your development machine?
    Especially if you have installed Office Groove 2010, this problem will happen.
    So, uninstall Groove and try to create a process. If the problem still persists, unstall Office 2010 compeltely and try again.
    Nith

  • Itunes has stop working for win 7 64 bits

    iTunes stops working has soon that start error I have win t 64 that was working fine until I install the latest version 10.5
    I try all the tricks that i know fix it delete and reinstall check for compatibility and everything fails...
    Please help
    Thanks vino

    I have the same issue!!  I can not find a way to sort it either!  I need help!

Maybe you are looking for

  • MSIE6 required for website; Safari3 not working

    I am unable to properly access my bank's website using Safari 3 as they only support MS IE6.0 . I tried using Tinkertool to emulate IE6 and it still didn't work. When I click on GO and another screen is supposed to pop up nothing happens. Allowoing p

  • Powering on a new Quad G5 ?

    I just got in a Quad, and the reality of not being able to power it on by touching the power button on my ADC monitors, just hit home. I of course have to use the ADC to DVI adapters, and my G5 is located deep under my desk. I have a bad neck, and re

  • Extracting data from iDoc tables

    Hi, I need to extract data from idoc segments from the database tables EDIDC and EDID4 for which the idoc status is 51 and to save all this data in an external file. For example, I need to check all the iDocs with WPUBON01 base type and if the status

  • HT201263 i done all the steps and my ipod touch wont come on still?

    my ipod will no turn on and i have read and tryed the steps on the website and it still wont work? what can i do now?

  • Macbook sees bellsouth wireless dsl but won't connect

    My macbook sees the wireless signal from my bellsouth modem and it says it is connected but when I try to get online it says I am not connected? any ideas? I have searched the forums but can't find the answer..