Cant get JTextArea setText  working correctly

I am developing an app where a user selects rows from a table, and the selections are listed in a textarea. if a user selects a row twice, he deselects that item -- because of this I use setText instead of append (easiest way to display selected rows). Problem is that sometimes if I click on a row, the corresponding item isnt always displayed in the textarea. Thanx in advance for any help. Here is my relevant code
archiveInfo.addMouseListener( new MouseAdapter() {
            public void mouseClicked(MouseEvent e){
                int rowAnother = archiveInfo.rowAtPoint(e.getPoint());
                addArchiveChoice(rowAnother); // rowAnother might be more accurate; handle more clicks
                if(numberArchivesSelected > 0)
                    mainPanel.setEnabledAt(1,true);
                else
                    mainPanel.setEnabledAt(1,false);
private void addArchiveChoice(int i) {
        if (!archiveChoices.selected) {
archiveChoices[i].selected = true;
printMessage("Adding to choices: " + archiveChoices[i].name);
numberArchivesSelected++;
// selectedArchives.append(archiveChoices[i].name+"\n");
} else {
archiveChoices[i].selected = false;
printMessage("Removing from choices: " + archiveChoices[i].name);
numberArchivesSelected--;
setArchiveText();
private void setArchiveText() {
String choices = "";
for (int i=0; i<archiveChoices.length; i++)
if (archiveChoices[i].selected)
choices += archiveChoices[i].name + "\n";
selectedArchives.setText(choices);
selectedArchives.revalidate();
any ideas on what is wrong?

Problem is that sometimes if I click on a row, the corresponding item isnt always displayed in the textareaA mouseClicked event is generated when a mousePressed and mouseReleased event is created at the same X, Y location. However, if you move the mouse even a pixel after the mousePressed event is created and before the mouseReleased event is created, then a mouseClicked event is not created.
A better way to check for row selection is to use a selection listener. See this section from the Swing tutorial on "Tables - Detecting User Selections":
file:///C:/Java/tutorial/uiswing/components/table.html#selection

Similar Messages

  • Please help with this method, cant get it to work correctly.

    any suggestions AT ALL please, im really stuck with this.
    im creating a little animation of pacman, just an animation of it moving buy its self. im using the java elements package so this is all being shown in a drawing window.
    ive made it move fine and go round the window abit eating dots but the code is a mess, and i know i could change some of the main part into a few simple methods and have tried but it seems to stop moving when i try
    import element.*;
    import java.awt.Color;
    static DrawingWindow d = new DrawingWindow(500,500);  
       public static void wait1second()
        //  pause for one tenth of a second second
            long now = System.currentTimeMillis();
            long then = now + 100; // 100 milliseconds
            while (System.currentTimeMillis() < then)
        public static void waitNSeconds(int number)
            int i;
            for (i = 0; i < number; i++) //allows you to determine how long to pause for
                wait1second();
    public static void main(String[] args) {
        //  declaring the variables
        int pacsize1 = 50, pacsize2 = 50;
        int pac1x = 20, pac1y = 20;
        int pacmouth1 = 45, pacangle1 = 270;
        int pacmouth2 = 25, pacangle2 = 320;
        int pacmouth3 = 6, pacangle3 = 348;
        int startmv = 0, stopmv = 33;
        d.setForeground(Color.black);
        Rect bkrnd = new Rect(0,0,500,500);     
        d.fill(bkrnd);
       // while loop used to make the pacman shape move right across the screen with its mouth in three different states
    Arc pacarc = new Arc();
         while (startmv++<stopmv)
            pac1x += 4;
            d.setForeground(Color.yellow);
            pacarc = new Arc(pac1x,pac1y,pacsize1,pacsize2,pacmouth1,pacangle1);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
            pac1x += 4;
            d.setForeground(Color.yellow);
            pacarc = new Arc(pac1x,pac1y,pacsize1,pacsize2,pacmouth2,pacangle2);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
            pac1x += 4;
            d.setForeground(Color.yellow);
            pacarc = new Arc(pac1x,pac1y,pacsize1,pacsize2,pacmouth3,pacangle3);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
    }so i tried making a method to make all the stuf in the while loop alot simpler but it just keeps making the pacman not move at all and im not sure why. heres the code i tried for the method:
    public static void pacmve(int pactestx, int pactesty, int pacsizetest1, int pacsizetest2, int pacmouthtest, int pacangletest)
            pactestx += 4;
            Arc pacarc = new Arc();
            d.setForeground(Color.yellow);
            pacarc = new Arc(pactestx,pactesty,pacsizetest1,pacsizetest2,pacmouthtest,pacangletest);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
            }it had no problems with the code, but it just doesnt seem to do anything when i call it in the while loop. heres how i used it to try and just make it move across with the mouth in one state:
    while (startmv++<stopmv)
    pacmve(20,20,50,50,45,270);
    }any ideas?
    Edited by: jeffsimmo85 on Nov 22, 2007 2:36 AM

    the clock is still ticking while you do this:
    while (System.currentTimeMillis() < then)
    is that method your design? why not just call Thread.sleep()?
    %

  • Cant get facetime to work on mini ipad

    Cant get FaceTime to work on new mini IPad....any suggestions? It keeps verifying but it will not work, it allows me to get apps. Triple checked that the Apple ID and password is correct, checked the settings to make sure they are turned on, able to get imessage, not sure what the problem could be?

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Extra FaceTime IDs
    http://tinyurl.com/k683gr4
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Fix Can’t Sign Into FaceTime or iMessage iOS 7
    http://ipadtutr.com/fix-login-facetime-imessage-ios-7/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • I cant get itunes to work on my new Sony Vaio. Im running Windows 8.1.

    i cant get itunes to work on my new Sony Vaio. Im running Windows 8.1. Anyone have a fix?

    Hello philtapevans,
    The following article provides information and steps that can help get iTunes installed on your computer.
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Cheers,
    Allen

  • Set up ipod touch to cox email, ive tried everything and cant get it to work. thanks!

    set up ipod touch to cox email, ive tried everything and cant get it to work. thanks!

    Here's an answer from the net:
    Go to Settings/Mail,contacts,calendars/Add account choose other, choose Add Mail Account. Fill in name, email address, password and description on the screen that comes up. Save those.
    One the next screen tat comes up click om POP in the first line then fil in the host name as
    spop.west.cox.net or spop.east.cox.net or the one to go with your region.
    Note that is not a misprint, that is spop (secure pop)
    Fill in your username one more time (the password should have carried over from previously)
    Fill in your outgoing mail server like smtp.west.cox.net (change for your region) and click Save.
    When all the settings are verified a checkmark will appear next to them all and you are good to go.
    If it says something like "can't connect via SSL would you like to ..." then you probably missed the step about selecting POP on the second screen and are trying IMAP so go back and try over with POP. Or perhaps mistyped soemthing.
    Once everything is working you can go back into the settings and see that it has automatically connected on port 995 and that SSL is on
    Note that you probably won't be able to send email from a wifi in a cafe or similar as cox won't let you connect to their smtp from outside their network.
    I haven't tried receiving mail from a non cox connected wifi yet but I suspect it will work just fine. Anyway these settings work for me using my ipod to my home wifi router connected to cox.
    I could not find a definitive guide when I searched so I hope this helps other folks trying to configure this.
    I got the spop from "Mail for Mac OS X 10.5 configure SSL / POP" here:
    http://support.cox.com/sdccommon/asp...c-7f95e8bcaf39

  • Apple Please sort out the V 11.1.4 problems as I cant get iTunes to work now. You need to have a new version asap

    Please sort out the V 11.1.4 problems as I cant get iTunes to work now. You need to have a new version asap

    Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features (later)
    Remove all of these items in the following order:
    iTunes
    Apple Software Update
    Apple Mobile Device Support (if this won't uninstall move on to the next item)
    Bonjour
    Apple Application Support
    Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
    The uninstall and reinstall process will preserve your iTunes library and settings, but ideally you would back up the library and your other important personal documents and data on a regular basis. See this user tip for a suggested technique.
    Please note:
    Some users may need to follow all the steps in whichever of the following support documents applies to their system. These include some additional manual file and folder deletions not mentioned above.
    HT1925: Removing and Reinstalling iTunes for Windows XP
    HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
    tt2

  • I cant get ECWID to work on my mobile devices, it only seems to use the desktop site rather that the Tablet or iPhone

    I cant get ECWID to work on my mobile devices, it only seems to use the desktop site rather that the Tablet or iPhone? Can anyone help me?

    Hi Jim,
    We’ll be glad to help you.
    Ecwid supports responsive layout, which means that the store pages can adapt to the visitor's screen width on the fly and keep the layout clean and nice. Your products and categories lists will be fit for any window's size, as Ecwid will calculate the most suitable number of products or categories in row automatically. In other words, Ecwid looks great on any mobile devices. You can check how your Ecwid store may look on smartphones and tablets, if you see your Starter Site (what it is).
    However, if you want Ecwid reveals itself in all its glory, you should embed your Ecwid store into website, which also support responsive layout, because if the site doesn’t adapt to size screen, Ecwid is not able to determine how it should be changed since it’s just a part of the site.
    We’ve checked your site and found that you used Adobe Muse for building your site. Using Adobe Muse, you can create alternate site layouts for web content to be displayed on desktop, smartphones, and tablets. Nonetheless, your site has a layout for desktops only, that’s why it looks the same on all devices. You can learn how to create those alternate layouts in Adobe Muse, by reading “Creating a Website for Mobile Devices” article.
    I hope this helps! But if there are any questions, don’t hesitate to reach us out on Ecwid forums.

  • Cant get Frontrow to work after installing 10.4.3 and updating it

    I made a terrible mistake today and moved all my files from my harddisk to my external harddisk. I had to reinstall everything but I cant get frontrow to work properly. I cant find it on my external harddisk either.
    Can someone please help me with this tricky question.

    Winbo:
    Can you describe your problem in a bit more detail? Why did you decide to move your files? What files did you move? What method did you use to move them? Did you move them over completely by way of backing up and then erased your disk prior to moving them back?
    Any other information you can provide will make it easier to make suggestions on your issue.
    Good luck.
    cornelius
    PismoG4 550, 100GB 5400 Toshiba internal, 1 GB RAM; Pismo 500 OS X (10.4.5)   Mac OS X (10.4.5)   Beige G3 OS 8.6

  • Cant get bluetooth to work on iphone 5 wont even discover divices

    Cant get bluetooth to work on iphone 5 wont even discover divices

    supported bluetooth profiles http://support.apple.com/kb/ht3647
    what are you trying to connect your device to?

  • Cant get wifi to work on ipod

    cant get wifi to work on ipod

    would help if you added more then that
    as in what set up is on your router, what have you tried etc

  • Cant get query to work

    can anyone see what i'm trying to do here?:::
    <cfquery name="display_log"
    datasource="allied_control_db1">
    SELECT *
    FROM ops_log_entry
    ORDER BY log_entry_date_time DESC
    </cfquery>
    <cfquery name="get_current_status"
    datasource="allied_control_db1">
    SELECT *
    FROM new_log_entries
    WHERE #display_log.ID# =
    #get_current_status.id_original_entry#
    </cfquery>
    i want to pull the 'current status' of an entry from another
    table where the ID of 'ops_log_entry' matches that of
    'new_log_entries'
    everything work except this line:
    WHERE #display_log.ID# =
    #get_current_status.id_original_entry#
    i dont think i'm far off but just cant get it to work.
    anyone?

    Hi Phil,
    i'm always carefull not to use reserved words as i spent
    nearly 24 hrs pulling my hair out before trying to figure out why a
    query wasnt working, so i'm pretty sure its not that.
    i havent added anything to the query apart from the date/time
    column name.
    <cfquery name="display_log"
    datasource="allied_control_db1">
    SELECT *
    FROM ops_log_entry AS L INNER JOIN new_log_entries AS N
    ON ( L.ID = N.id_original_entry )
    WHERE N.log_entry_date_time = (SELECT
    MAX(N1.log_entry_date_time)
    FROM new_log_entries AS N1
    WHERE N1.id_original_entry = N.id_original_entry)
    </cfquery>
    ive checked the DB column types and the ops_log_entry.ID is
    of course an AutoNumber (long integr) & the
    new_log_entries.id_original_entry is a Number (long integr)
    so seen as they are both the same types, should there be any
    need for single quotes?

  • [solved]passenger + nginx + rvm cant get nginx to work

    Hello ,
    I am trying to install   passenger-install-nginx-module from the wiki of ruby on rails. I removed my existing nginx but
    but now I cant get nginx to work from the /opt/nginx location. I am getting
    ruby-2.0.0-p481 [ytsejam@ytsejam ~]$ nginx -v
    bash: nginx: command not found
    If I try with "pacman Ql nginx "
    ruby-2.0.0-p481 [ytsejam@ytsejam ~]$ pacman -Ql nginx
    error: package 'nginx' was not found
    but I can enter the directory of /opt/nginx by using cd command.
    can anyone help me ?
    Last edited by ytsejam (2014-08-26 08:25:52)

    I'm happy to see that nginx-passenger had what you were looking for. If you encounter any problems, please don't hesitate to leave an AUR comment or submit a pull request!

  • I installed Aperture from the App Store, it was working ok, then suf=ddenly it wont load, I get the "Aperture encountered problem" message, have updated all OSX and Aperture but I still cant get it to work, any ideas ?

    I installed Aperture from the App Store, it was working ok, then suf=ddenly it wont load, I get the "Aperture encountered problem" message, have updated all OSX and Aperture but I still cant get it to work, any ideas ?

    I installed Aperture from the App Store, it was working ok, then suf=ddenly it wont load, I get the "Aperture encountered problem" message, have updated all OSX and Aperture but I still cant get it to work, any ideas ?

  • Strange problem. I have upgraded to OSX 10.9.1 but cant get wifi to work so forced to be hard wired. Any inputs appreciated.

    Hi All,
    Strange problem. I have upgraded to OSX 10.9.1 but cant get wifi to work so forced to be hard wired. Any inputs appreciated. Problem is I cant even reinstall it as I saw on a thread reason, it needs wifi to begin.

    It only needs an internet connection - wired or wireless.
    Fixing a Mavericks Installation Problem
    How to manage a failed OS X Mavericks installation | MacFixIt - CNET Reviews.
    Try these in order:
    1. a. Resetting your Mac's PRAM and NVRAM
        b. Intel-based Macs: Resetting the System Management Controller (SMC)
    2. Restart the computer in Safe Mode, then restart again, normally. If this doesn't help, then:
         Boot to the Recovery HD: Restart the computer and after the chime press and hold down the
         COMMAND and R keys until the Utilities menu screen appears. Alternatively, restart the computer and
         after the chime press and hold down the OPTION key until the boot manager screen appears.
         Select the Recovery HD and click on the downward pointing arrow button.
    3. Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the Utilities menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
    4. Reinstall Lion/Mountain Lion, Mavericks: Reboot from the Recovery HD. Select Reinstall Lion/Mountain Lion, Mavericks from the Utilities menu, and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • How do I get dictation to work correctly in Microsoft Word 2011?

    I am trying to get dictation to work correctly in Microsoft Word. It is not responding to commands like "new paragraph" or "new line".  All of the text ends up in the same paragraph.  Dictation works fine in Pages and Gmail, but not in Word.
    Any ideas?  Thanks in advance...

    Same here. I'm using office 2013. It is hard to believe, That there is still no solution for that problem. Parallels desktop and office 2013 lets you dictate, Though there is still no way to get the  new line or new paragraph 
    command to get to work in word or outlook. Do you think this isn't a apple issue or a Microsoft issue? On Windows in the ordinary editor the commands work well.
    I actually changed to mac for this killerfeature and i really need it. Now it does not work in the most common office app..

Maybe you are looking for