Loop keeps writing over textarea

hi everyone, im writing a small application where if a certain word is found in a hashmap, id like it to be printed in a textarea. However, the loop keeps on running a setText method, and im guessing this keeps on writing over the previous text written! i understand why it is doing this, but i just cant think of a solution.
if i run system.out.println on the temp[] variable, the right words are being printed out to the terminal, so its just a matter of transfering these words to the text area.
below is the code for the loop, and also the method addtoarea.
please let me know any suggestions you may have!
thanks alot
Torre
     for (int i = 0; i < temp.length; i++) {
if (hashMap.containsKey(temp)) {
          pt.addtoarea(temp[i]);
                    num++;
public void addtoarea (String s)
     area.setText(s);

//Import needed packages.
import javax.swing.*;
import java.util.*;
public class Test extends JFrame
     //create textfield and call the base class construtor
     JTextField area;
     public Test(String str){
     super(str);
     area=new JTextField();
//set Text of the JTextField
public void addtoarea (String s)
               area.setText(s);
public static void main(String[] args)
          //create an object of the Test class
          Test t=new Test("Hi");
          t.setSize(300,300);
          t.setVisible(true);
          t.getContentPane().add(t.area);
          Map hashMap=new HashMap();
          String[] temp=new String[5];
          temp[0]=new String("Hello");
          //check if hashMap contains key if it does set the Text and break out of the loop.
          hashMap.put(0,temp[0]);          
          for (int i = 0; i < temp.length; i++) {
          if (hashMap.containsKey(i))
              t.addtoarea(temp);
          System.out.println(temp[i]);
break;
               i++;
}//end of main
}//end of class TestSwing is not thread safe so you would need to place it in a sepreate thread it would be something of this sort:Runnable doWorkRunnable = new Runnable() {
                    public void run() {
                    ....stuffs
                         SwingUtilities.invokeLater(doWorkRunnable);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • I have an IPone 4, there is an add video for Capital one that keeps coming up on its own... ive deleted my history and cookies and this video keeps taking over my phone. how do i get rid of it? the video is of a man with a puppet and the puppet is singing

    i have an IPone 4, there is an add video for Capital one that keeps coming up on its own... ive deleted my history and cookies and this video keeps taking over my phone. how do i get rid of it? the video is of a man with a puppet and the puppet is singing a song while he is checking his phone. how do i get rid of it????

    If it happens again the make sure that you aren't suppressing website colors.
    Make sure that you allow pages to choose their colors and that you haven't enabled High Contrast in the Accessibility settings.
    *Tools > Options > Content : Fonts & Colors > Colors : [X] "Allow pages to choose their own colors, instead of my selections above"
    *https://support.mozilla.org/kb/Options+window+-+Content+panel
    *http://kb.mozillazine.org/Website_colors_are_wrong
    *http://kb.mozillazine.org/Websites_look_wrong

  • Why does my page keep rolling over to a pop-up

    why does my screen keep rolling over to 5gigs.net?

    Do you use iGoogle? This problem is often caused by the "My Scores" gadget on iGoogle.
    Open the iGoogle page but press the escape key to stop the page loading. If you have the "My Scores" gadget delete it.

  • Using safari web pages have writing over writing hard to read

    I do a lot of surfing from web page to web page.  Lately it is very hard to read many of the pages as there is writing over writing.  Sometimes a section on the page is too small and I cannot read to entire content.

    Two main things you can try are to reset Safari, which can be selected under the Safari menu item and try deleting the .plist.
    You need to look in your user Library/Preferences for the .plist. Hold down the option key while using the Finder "Go To Folder" command. Enter ~/Library. Delete the .plist(s) for the application.
    If you prefer to make your user library permanently visible, use the Terminal command found below.
    http://osxdaily.com/2011/07/04/show-library-directory-in-mac-os-x-lion/
    You might want to bookmark the command. I had to use it again after I installed 10.8.2. I have also been informed that if you drag the user library to Finder it will remain visible.
    The article below contains other things to try:
    Speeding up Safari

  • Babylon search engin keeps taking over my home page.I have deleted it from my computer and it just took over Google again. How can I get rid of it?

    Since I downloaded Mozilla Firefox on my new computer, Babylon search engine keeps taking over my home page. I have deleted it from my computer and have installed Google as my home page - It has just done ANOTHER hostile takeover and completely kicked Google off. Babylon doesn't even find the right things I search for. It is horrible - is it a virus and how do I get rid of it?

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • Firewall keeps failing over when IPS fails

    Is there a way to prevent the firewall from failing over if the IPS fails, I do not have it selected as a critera but I've been having some issues with the IPS module and the firewall keeps failing over.

    Hello Matt,
    There is an enhancement request for this:
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCsm81086
    But there isn't an ETA yet. You can save the bug to get updates.
    Regards,
    Felipe
    Security Team.

  • Adobe reader DC keeps installing over 11

    Use Reader 11 and lately every time I return to my computer, Reader DC is now the default reader. I did not want to change from 11 so I remove DC and reinstall 11. the next day I return to my computer and DC is back !!
    I do not like DC, do not want to use DC, I want 11 to be my default. Is there a reason DC keeps installing over 11??? Can I stop this somehow? I do NOT want to use DC, I do not like its interface nor any of its "improved" features, I just want to stay with 11 and be left the h*ll alone by DC.
    Can anyone shed some light on this??
    I have to go now, have to again remove DC and reinstall 11

    Thank you, it is all good except the third step. I do NOT want DC on my system, I only want version 11 and no further since my other software does not play well with DC including my Chrome browser. I did follow the steps you mentioned and still DC managed to install itself over 11 so I had no luck keeping it from returning. Even if you tell it not tu update it does whatever it wants anyway. My current solution, which is a bad option but I have no choice, is to install a different brand of viewer. I prefer to have Adobe Reader 11 but it only lasts for a day before DC comes in and takes over. I am not sure even the removal tool from Adobe can remove it. I have scanned my system for viruses with 3 different packages and found none. There is something about Dc still stuck there and it will not go away. I may have to go manually into my registry and delete every single Adobe key and sub-key there, that will take a while.

  • My ipad mini 2 gets blue screen and then keep restarting over and over again problem

    My ipad mini 2 gets blue screen and then keep restarting over and over again problem. I tried to restore to the factory setting but it was not successful to fix the problem. Sometimes I could not even restore. How can I do with this kind of problem?
    I'm very frustrated now. Please help me!

    I have the same issue and have not found a way to fix it yet. I cant even down grade back to 8.2 because it wont stay on long enough.

  • HT201263 My iPad 2 keeps resetting over & over

    My iPad 2 keeps resetting over &amp; over again without the home screen even coming up. I tried a restore but it is still resetting itself any suggestions?

    You can try to restore using Recovery Mode. You can read about it here.
    http://support.apple.com/kb/ht4097
    Recovery Mode Instructions
    Disconnect the USB cable from the iPad, but leave the other end of the cable connected to your computer's USB port.
    Turn off iPad: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for iPad to turn off.
    If you cannot turn off iPad using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the iPad turns off, release the Sleep/Wake and Home buttons.
    While pressing and holding the Home button, reconnect the USB cable to iPad. When you reconnect the USB cable, iPad should power on.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears you can release the Home button.
    If necessary, open iTunes. You should see the recovery mode alert that iTunes has detected an iPad in recovery mode.
    Use iTunes to restore iPad.

  • HT201412 my iphone keeps rebooting over and over.  How do I fix it?

    how do I fix my iphone if it keeps rebooting over and over?  Help!!

    Try:                                               
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable       
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar                              

  • Running 10.8.3 on an Intel iMac 27'. The Finder keeps grabbing over 100% of the CPU which seems to stop me from opening any folders. Only quitting the Finder from Activity monitor resets it to normal. Any ideas?

    My Finder keeps grabbing over 100% of the CPU which seems to stop me from opening any folders.
    Only quitting the Finder from Activity monitor resets it to normal.
    Any ideas?

    Nope, I don't have a "/Users/charon/Library/Mobile Documents" directory, let alone anything underneath it. Is that like an iCloud thing or something?  I tend to avoid the Apple-supplied services when I can (I don't use iTunes either unless I can help it).
    As an update, as of about two days later this problem seems to have solved itself. Possibly sleeping and waking did something to it (though that seems unlikely given how many times I rebooted), or else there was just some long-*** kernel process that finally worked itself out.  But my system CPU is back down to normal and the cursor freezes are gone.
    ??? it is a mystery! ???

  • My Iphone 5 keeps restarting over and over. it wont stay on for more than a minute. how do I fix this?

    My Iphone 5 keeps restarting over and over. it wont stay on for more than a minute. how do I fix this?

    Contact Apple Support or an Apple Store if you have one near you. Your battery needs to run through the diagnostic test. You can also try to put the device into Recovery mode as well and rsetore the iOS software, and set up the device as new. Follow this article on Recovery Mode:
    http://support.apple.com/kb/ht1808

  • My ipad keeps restarting over and over again and even it does not appear the home screen

    my ipad keeps restarting over and over again and even it does not appear the home screen...............................how can i fix this.................
    `

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
     Cheers, Tom

  • Keep writing myself into infinite loops please please help

    ok i figured out the computations for my previous post but now i created a test table in my database with an even number of values to add to the array so when i try to detect wether the value for the median is an integer it should use the other formula but instead it never reaches it. Could someone please give me some insight on what i'm doing wrong this is killin me haha...Thanks ahead of time for any replies
    HERE"S THE CODE
    //FIND MEDIAN EXAM GRADE
    for(int j=0; j<n; ++j)
            if(Math.abs(j - Math.floor(j))<1.e-10)
              j = (n+1)/2;
              medianGrade = (s[j-1] + s[j+1])/2;
         else
              medianGrade = s[j];
    System.out.println("medianGrade: " + medianGrade);
    //FIND 90TH PERCENTILE
    for(int j=0; j<n; ++j)
         if(Math.abs(j - Math.floor(j))<1.e-10)
              j = s[((n+1)*(90/100))];
              ninetiethPercent = (s[(j-1)] + s[(j+1)])/2;
         else
              ninetiethPercent = s[j];
    System.out.println("ninetiethPercent: " + ninetiethPercent);
                   

    It's a considered extension for Java 1.8. It means
    that the code in question is not VB. You may not
    think this is important now but when you see the
    changes planned for 1.7 it will make more sense.(but
    I've said too much now and must return to hidingout
    in my reinforced igloo)hahahah..... ;DDon't laugh! Coming in dolphin...
    class Test {
       int monkey; // With getter/setter
    Test t = <test><monkey>5</monkey></test>;Eep.
    PS thanks toi the user I know who posted this on their blog originally after discovering this at Java UK this year but whom I did not credit because I am not sure they want the notoriety

  • Is Replica aware stubs are in infinite loop when fail over????

              Hi
              Any help on this Appreciated
              See in this senario, where there is four weblogic instance runs in the cluster
              and a replica aware stub(stateless bean with idempodent methods) finds a particular
              method fails on a server and it redircets the request to another one server but the
              same method fails on all the server, then what is goin to happen?? is it going to
              throw some exception or gonna be in a loop to keep on redirecting the method request
              to all servers in Round???
              Regards
              Aruna
              

              Aruna,
              A stateless session bean whose methods have been declared idempotent will automatically
              retry on another service provider in a fail-over situation. When a fail-over situation
              occurs, the stub refreshes its list of service providers. Note: Just because your
              method call fails, doesn't mean it's a fail-over situation.
              Jane
              "Aruna" <[email protected]> wrote:
              >
              >Hi
              >
              > Any help on this Appreciated
              >
              > See in this senario, where there is four weblogic instance runs in
              >the cluster
              >and a replica aware stub(stateless bean with idempodent methods) finds a
              >particular
              >method fails on a server and it redircets the request to another one server
              >but the
              >same method fails on all the server, then what is goin to happen?? is it
              >going to
              >throw some exception or gonna be in a loop to keep on redirecting the method
              >request
              >to all servers in Round???
              >
              >
              >Regards
              >Aruna
              

Maybe you are looking for

  • Error in populating table data through forms

    I had one SIM REPLACEMENT Form which has a base block table PPBS_SIM_CHANGE. Once all the entires are entered the table gets populated. But some times it seen that the base table does not get populated.Also the form does not gives any error.Pl help m

  • Missed Call Notification in Exchange 2010/2013 coexistence mode

    Dear all, Context: Lync 2013 Enterprise Voice, Exchange 2010 and Exchange 2013 in coexistence mode Waiting complete migration, some users are always on exchange 2010 UM role is installed on both exchange server The exchange servers UM are attached to

  • Can a case structure execute multiple cases?

    So I have a VI set up with a mutiple option case structure to select which input a voltage is read from (there are 32 options). Now that I have it made, I realize that sometimes I may want to read from multiple inputs at once.. Is there an easy way t

  • Help!! Image

    Hi all, I need to create a simple report with the records displayed in it, And i want this to be displayed inside my viewlet panel. But the size of the panel is very high, i want to design a page size also for each report.. can anyone help me in this

  • Annoying Yellow Boxes - Mac OS 10.4.10

    I am becoming annoyed at the appearances of "Yellow Boxes" that appear everywhere in Mac OS 10.4.10. To help provide an explanation, I have put an image of an example of one of them on Flickr. You can see the page with the image and a description of