Loop text in a while loop , from a db . Please help

am new to java and woundering if some one could just correct this problem am having or point be in the right direction to fixing it.
am connected to a database and want to show the reults in a Jframe. but if i place the code in a JLable or textpanel the text is all grouped together and does not line break.
works line if i just System.out.println the table results but i need it to be in a Jframe
here the code below:
while ( rs.next() ) // this will step through our data row-by-row
TextPane = new JTextPane();
TextPane.setText("User Name: " + rs.getString(1) + " Score: " + rs.getString(2));
TextPane.setBounds(30, 40, 260, 260);
frame.getContentPane().add(TextPane);
// System.out.println("User Name: " + rs.getString(1) + " Score: " + rs.getString(2));
Thanks for your time
chris mon

Thanks very much for the reply and for the help:-). You're welcome.
so the value is the StringBuilder(100), is that like
how many characters it can hold?Read the API for that constructor. 100 is just an initial capacity before resizing will occur. If you add 80 characters, no resizing will occur. If you had 1000 characters, it will resize to hold it. The upper limit is determined by memory (and by length of an array being an 'int', I guess). Anyway, I'm sure you can hold whatever you need to hold.
can i ask one more helpful tip aswell. when it
outputs the results they are all together like
below:
User Name: chrisScore: 8User Name: johnScore: 7User
Name: lukeScore: 9User Name: BillScore: 15User Name:
louiseScore: 13User Name: peterScore: 11User Name:
peterScore: 11
is there a way of braking them down like this
User Name: chris Score: 8
User Name: john Score: 7
User Name: luke Score: 9Read my reply #3 regarding line separators. If "\n" doesn't work, use the line.separator property that I mentioned.

Similar Messages

  • Need help w/ for loop, a do loop, and a do-while loop.

    Hello I have been trying to write a program that uses a for, do, and a do-while loop, but I am having trouble. I need the program that will prompt the user to enter two numbers. The first number must be less than the second number. I need to use a "for loop", a "do loop", and a "do-while loop" to display the odd numbers between the first number and the second number. For example, if the user entered 1 and 8, the program would display 3,5,7 three different times (one for each of the loops). Please help if you can. Thanks.

    boolean2009 wrote:
    Thank all of you all for responding.Youre welcome.
    Yes this is my homework, but my major does not even involve java i just have to take the class.Not our problem.
    And yes we are suppose to have all three in one program I do not know why,So you can learn all three types of loops (there is also an enhanced for loop to learn later on).
    but I just do not understand programming nor do i really want to.Once again not our problem.
    If anybody could help it would be much appreciated. thanks.Yes, a lot of people are willing to help you. No, none of them will do it for you. What you need to do is attempt the code and when you get stuck, post your code using the code button, include error messages, indicate which lines in your code genereate those error messages and ask specific questions.

  • I just got the iphone 4s and my text messages are showing as urgent to others,please help me fix this

    i just got the iphone 4s and my text messages are showing as urgent to others,please help me fix this

    As ckuan said, there's no way to mark messages as urgent from the phone. So, either your carrier is doing something and you'll need to contact them or it't something on the other end. Is it just one person who's seeing your texts as urgent? Or everyone?

  • I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks

    I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks

    - If you used PhotoStream then try getting some of them from your PhotoStream. See that topic of:
    iOS: Importing personal photos and videos from iOS devices to your computer
    - Maybe from the restored iPod via
    How to perform iPad recovery for photos, videos
    Wondershare Dr.Fone for iOS: iPhone Data Recovery - Wondershare Official     
    http://www.amacsoft.com/ipod-data-recovery.html

  • Timemachine only opens a finder window even when I'm in iPhoto or mail. I am trying to retrieve a deleted book project from iPhoto. Please help

    Timemachine only opens a finder window even when I'm in iPhoto or mail. I am trying to retrieve a deleted book project from iPhoto. Please help

    jon199 wrote:
    Timemachine only opens a finder window even when I'm in iPhoto or mail. I am trying to retrieve a deleted book project from iPhoto. Please help
    If you have iPhoto '09, you cannot browse or restore seleted items from your backups.  See the pink box in #15 of Time Machine - Frequently Asked Questions.
    Mail should work, however, per the blue box there. 

  • Ksenija     Pretraživanje     Slike     Karte     Gmail     Disk     Kalendar     Prevoditelj     Blogger     Više      ksenija josipovic      Dijeli     ksenija josipovic     ksenija josipovic  Prevoditelj Greetings from the Croatian, please help me

    Greetings from the Croatian, please help me, I applied, create an account, but they keep telling me to confirm the account with your support, and we simply do not succeed, do not let me go to the store, or iTunes, so I can not download application, please tell me where I'm wrong, thanks a lot
    Novo! Držite pritisnutu tipku Shift, kliknite i povucite riječi prema gore kako biste ih preuredili. Ukloni
    Google Prevoditelj za tvrtke:Translator ToolkitPrevoditelj web-lokacijaGlobalna tražilica tržišta
    Isključi neposredan prijevodO usluzi Google PrevoditeljMobilni uređajiPrivatnostPomo

  • Getting Error "Apple ID does not have permission to access iTunes Connect" while logging to iTunes. Please help me in this regard

    Getting Error "Apple ID does not have permission to access iTunes Connect" while logging to iTunes. Please help me in this regard
    Regards,
    Amar

    See the "More Like This" section over there ===============>
    In the future, search before posting.

  • Iweb doesn't see my old domains under 10.9 after the upgrade from 10.7 Please help

    Hi everybody,
    iweb doesn't see my old domains under 10.9 after the upgrade from 10.7 Please help
    It gives me an option to choose a domain but when I go to "sites" it doesn't recognize none of them.
    Thanks :-)

    In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion, Mountain Lion or Mavericks or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks

    I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks

    If you had find my iphone enabled follow the steps in the article below:
    http://support.apple.com/kb/ph2701

  • HT1349 "Sync session failed to finish"---keeps me from syncing. Please Help!

    "Sync session failed to finish"---keeps me from syncing. Please Help!

    Quit iTunes, reboot your PC, and then try again.

  • I purchased a macbook pro 13' 3 days back. As per apple, customers purchasing their macbook after 21 july2011 will get a free upgrade to OS X LION. I've submitted the required steps online and i haven't recieved any sort of reply from apple. Please help.

    I purchased a macbook pro 13' 3 days back. As per apple, customers purchasing their macbook after 21 july2011 will get a free upgrade to OS X LION. I've submitted the required steps online and i haven't recieved any sort of reply from apple. Please help.

    When I clicked the following link:
    http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?partNumber=MD202Z/A
    and filled out the info, i got a code from apple on the web which i used to download Lion free from the appstore.

  • HT203167 Hi. 2 days ago I bought a cd ATB. And yesterday I deleted everything from iTunes. Please help in recovering all purchased cd

    Hi. 2 days ago I bought a cd ATB. And yesterday I deleted everything from iTunes. Please help in recovering all purchased cd

    Did you just delete them from iTunes, or did you also tell it to delete the music files from your Mac ? If just from iTunes then they might still be stored under /Users/username/Music - if they are then you can add them back via File > Add To Library
    If not, then whether you can redownload music depends upon what country that you are in. If you can redownload music (and if you haven't changed countries since buying it and it's still in your country's store) then it should show under the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage :
    If you can't redownload music then do you have a copy of it on your backup of your downloads/library that you can copy it back from ?

  • My apple store is deleted completely from my mac, please help

    i cannot update my mac book pro because my app store is deleted from my mac, please help.

    Change App Store back to Malaysia
    1. Tap "Settings"
    2. Tap "iTunes & App Stores"
    3. Tap on your Apple ID
    4.Tap "View Apple ID"
    5. Enter your user name and password.
    6. Tap "Country/Region."
    7. Tap "Change Country/Region"
    8. Select the country/region where you are located; re-select country/region even if it is correct
    9. Tap "Done".
    Note: If the change doesn't take effect, sign out of account and sign in again.

  • Writing text file in while loop

    Here is my question about writing text data to a file in a while loop...worded best I can.
    I have an Init case where I have the user choose a file path and name. I take the ref out and then I have data that is being written to the file. The loop will take 40,000 pieces of data write them to the file and go back to the get data case to collect another 40,000 data points. But when I open the file, I only get a file as big as 430KB. I'm not sure but can somone show me an example of pulling analog data from a DAQ Assist, doing a calculatoin on it, writing it to a file and repeating that by adding it to the same file at the end of the previous data?
    Solved!
    Go to Solution.

    Take a look at the attached VI's.  Did you have your data set to append?  This could be your problem.
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    Save Data SM.vi ‏15 KB
    File Path Prompt.vi ‏15 KB

  • How do I break a for loop (inside) and a while loop (outside) at the same time by a control button

    I have a while loop (outside) and a for loop (inside) and a control button within the for loop.  I want to stop the program by click the botton without finishing the for loop.  How can I do that?
    Thank you in advance.

    HI Please find attached snapshot Regards, Santosh
    Message Edited by SanRac on 12-17-2009 05:12 AM
    Message Edited by SanRac on 12-17-2009 05:13 AM
    Attachments:
    Snap1.png ‏4 KB

Maybe you are looking for