JList & JDBC display problem. Help, and Thanks.

I wrote the three parts of Code, want to display the a column of database.
import java.awt.*;
public class Application1
     private boolean packFrame=false;
     static
          try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               System.out.println("Success loading MySQL Dvier...");
          catch (Exception e)
               System.out.println("Error loading ...");
               e.printStackTrace();
     public Application1()
          Frame1 frame = new Frame1();
        frame.pack();
        frame.validate();
          frame.setVisible(true);
     public static void main(String []args)
          new Application1();
}second is :
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Frame1 extends JFrame
     private JPanel contentPane;
     private JScrollPane jScrollPane1=new JScrollPane();
     private JList jList1=new JList();
     private Connection con = null;
      Statement stmt1 = null;
     private ResultSetListModel resultSetListModel1=new ResultSetListModel();
     static
          try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               System.out.println("success loading JDBC-ODBC Bridge Driver...");
          catch(Exception ce)
               System.out.println("Error loading JDBC-ODBC Bridge Driver...");
               ce.printStackTrace();
     public Frame1()
          enableEvents(AWTEvent.WINDOW_EVENT_MASK);
          try
               jbInit();
               dataInit1();
          catch(Exception e)
               e.printStackTrace();
     private void jbInit() throws Exception
               setTitle( "TEST JList" );
              setSize(1000,800);
            getContentPane().setLayout(new BorderLayout());
            JPanel topPanel = new JPanel();
              topPanel.setLayout( new BorderLayout() );
              getContentPane().add( topPanel );
     private void dataInit1() throws Exception
          try
               con=DriverManager.getConnection("jdbc:odbc:playerInfor","root","");
               System.out.println("Success eastablisheing the connection...");
               stmt1=con.createStatement();
               ResultSet rs1=stmt1.executeQuery("select pace from physical;");
               resultSetListModel1.setResultSet(rs1,"pace");
               jList1.setModel((ListModel)resultSetListModel1);
               con.close();
               System.out.println("Connection is closed");
          catch(Exception ex)
               throw ex;
}last one is:
import javax.swing.*;
import java.sql.*;
import java.util.Vector;
public class ResultSetListModel extends AbstractListModel
      Vector data = new Vector();
     public ResultSetListModel()
          data.removeAllElements();
          data.addElement(new String(""));
     public void setResultSet(ResultSet resultset, String coumnname) throws SQLException
          data.removeAllElements();
          try
               while(resultset.next())
                    data.addElement(new String(resultset.getString(coumnname)));
          catch (SQLException ex)
               throw ex;
          finally
               if(data.size()==0)
                    data.addElement(new String(""));
     public int getSize()
          return data.size();
     public Object getElementAt(int index)
          return data.elementAt(index);
}when i try to run application1.java, it is not working.

Hi,
What do you mean by "it's not working"? Do you get any error messages you suppose us to guess? Or does it refuse to compile?
You have to be more specific.
Eric

Similar Messages

  • HT201363 I'm having a problem I've shipped amyl $ 25 and now tell me Enter amyl reservists and has introduced wanted more meaningful than once and now tells me I timed help and thank you

    I'm having a problem I've shipped amyl $ 25 and now tell me Enter amyl reservists and has introduced wanted more meaningful than once and now tells me I timed help and thank you

    It could be that the existing wire in your appartment is not clean enough to provision DSL only. When combined with the phone possibly it has a higher line voltage and worked before. Now that the line is to be provisioned without phone service it may be giving them trouble that did not show before they came out and ran the new line test. So a new jack dedecated for your DSL line may require a new wire be run to your appartment. Also the account for internet only used to require direct billing to a credit card or something else. This was a number of years ago. Most accounts are linked to a phone number, and without a voice number it adds to the confusion.
    If you are getting the voice and everything turned on as before, then I am at a loss for words.

  • I cannot figure out how to make the text larger on an incoming email.  The finger method doesn't work and I cannot find any toolbar with which to do it.  I could find nothing in settings also.  Plese help and thank you.

    I cannot figure out how to make the text larger in a received email.  The finger method doesn't work and I can find no tool bar as I can for composing emails.  I can find nothing in settings.  Please help and thank you in advance.

    Hi there,
    Download a piece of software called TinkerTool - that might just solve your problem. I have used it myself to change the system fonts on my iMac. It is software and not an app.
    Good wishes,
    John.

  • No sound not muted please help and thanks

    My iPad was working great the first part of the day yesterday and then later that night I went to listen to some music and there was no sound. I plugged in my headphones and nothing. I checked to see if it was muted and it wasn't I also checked the switch above the volume and it wasn't muted either. Is my iPad broken? Please help and thank you in advance.

    Do you have sound through the built in the speaker?
    You could try resetting the iPad and see if the sound comes back. 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.
    You can also try reinserting the headphones and removing them a couple of times and see if the sound comes back on.
    The side switch will mute system sounds if it is set to do so. Music will still play even if you mute system sounds.

  • Please I'm frankly tired and in need of your help to activate the iPhone5 it does not account Icloud Old I know of has been good, I did not get before Fargo as a result of your help and thank you and appreciation

    please im tired and in need of your help to activate the iphon5 it does not account icloud old iknow of has been good, idid not get before fargo as aresult of your help and thank you and appreciation

    please im tired and in need of your help to activate the iphon5 it does not account icloud old iknow of has been good, idid not get before fargo as aresult of your help and thank you and appreciation

  • Just got my Mac air and i would like to make a file to store some web addresses for my new business with rodan and fields and I can't do it. Made the file but i cant copy and paste the web addresses in the file to save them. Please help and thank you.

    Just got my Mac air and i would like to make a file to store some web addresses for my new business with rodan and fields and I can't do it. Made the file but i cant copy and paste the web addresses in the file to save them. Please help and thank you.

    Yes - well you have to make the file in a word processing Application.
    You could use TextEdit (it's free) Pages (words only), or Numbers (data base) (they are part of iWorks - and may or may not be free (included) on your machine.  You could use MS Office (it is not free) You could use any Open source word processor that plays well with Office (NeoOffice, StarOffice) they are free.
    That's how you create content and copy/paste URLS. Then you save the file to the desktop. If you are going to make more than one file... you make a folder on the desktop and save, or drag the file(s) into it.
    You attach it to your e-mail client which will compress it and e-mail it. An excellent reference is to use Help, from the menu bar, also from inside any application. From your library or book store the OS X for Dummies has a lot of useful information (you don't read it cover to cover but look up chapters about what you'd like to do)
    You can also make appointments at your local Apple store for individualized help (if a store is nearby)

  • HT201210 I have a iPhone 3 g, I'm doing update and give me error 1015 Please help and thank you

    I have a iPhone 3 g, I'm doing update and give me error 1015 Please help and thank you

    You can not get help here per the terms of service. Discussing jailbroken devices is forbidden.
    The ONLY thing we can advise you to do is try putting the phone in DFU mode (google for instructions) and restore it.
    Beyond that, you're on your own.

  • HT201304 ello my little brother has developed lock my iPhone and I could not see the unlocking code Please help and thank you

    Hello
    ello my little brother has developed lock my iPhone and I could not see the unlocking code Please help and thank you
    edited by host

    Hi Omar_a983,
    If you are having an issue with the passcode on your iPhone, you may find the following article helpful:
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    Regards,
    - Brenden

  • Hello I want to change the plan Single App to Photography please help and thank you

    Hello I want to change the plan Single App to Photography please help and thank you

    Hi Rasheed,
    Contact Adobe support for that: https://helpx.adobe.com/contact.html
    Thanks,
    Kevin

  • Macbook and HP 2510i monitor display problem - help

    Hello,
    I am having display problem with my Macbook (Intel) and my 25'' HP 2510i monitor via DVI.. Until last monday I do not have any problems and my monitor was working flawless with my macbook.. Last monday I used the monitor with my HP Notebook to try Windows 8 on large screen. And after that try when I connect the monitor back to Macbook there is no display.. I tried the steps below
    - I connected Macbook to my Phillips Plasma TV and it worked (no error with display card of Macbook or the wire or the adaptor)
    - I connected the monitor back to HP laptop it worked.. (so no error with the monitor)
    - I unplugged monitor to cut electricity and tried.. nope not working
    - I did several tricks with macbook no effect
    - I reinstalled Mountain Lion .. no effect
    - I formatted Macbook, reinstalled Snow Leopard.. Not working.. I installed back Mountain Lion .. not working
    Whatever I tried the HP2510i is not displaying, mirroring my Macbook..
    Any help will be appreciated
    Thanks

    My graphic card details;
    NVIDIA GeForce 9400M:
      Chipset Model:          NVIDIA GeForce 9400M
      Type:          GPU
      Bus:          PCI
      VRAM (Total):          256 MB
      Vendor:          NVIDIA (0x10de)
      Device ID:          0x0863
      Revision ID:          0x00b1
      ROM Revision:          3462

  • I am trying to upload an imovie to youtube. it says project too large but i have permission for larger projects. Help and thanks.

    I am trying to upload an imovie to youtube. It keeps saying "project too large" even though I have permission from youtube for over 15 minutes. Please help. Thanks.

    share the video via a quicktime movie in whatever format you want to use, I usually create an mp4.  Once you that video is set (I usually save to my desktop) go ahead and upload from YouTube rather than going direct from iMovie.  I suspect you will not have the same size issue.

  • Display problem - brightness and grey area

    My 24" iMAC has been suffering with a grey section (middle vertical third of screen) on start-up. This lasts for 5-10 minutes, after which time the middle section resumes its normal brightness. Recently, I've noticed another problem and that is there is very little difference on the screen between the brightness at its lowest level and when it is at its highest. What has happened?

    Same problem here (with a Mac Mini 2009 model with the same nvidia chip as your aluminum MacBook) and a LG L204WT 20" monitor. Although on my LG monitor, if I reduce the sharpness setting one step (from 5 to 4), the flickering completely stops. This does make the display slightly fuzzier, but it feels better to my eyes than the flickering. Can you test this on your monitor also, and tell me if it helps?
    Regards,
    Enforce

  • Very unusual LCD display problem, help appreciated

    First post, I want to thank anyone who can help me in advance. I just took over my sister's MBP Unibody, and she has been having an issue where there is about a 1.5 inch wide strip of complete distortion on the left hand side of the screen. Everything in that strip is completely color distorted with constant screen tearing and flickering. I suspect there is something wrong with a wire in the lcd screen, as this problem only starts after using the computer for 15 minutes, and goes away initially by tapping the screen or adjusting the screen. After about half an hour of use however, it does not go away. In a completely unrelated incident, the glass panel cracked yesterday (This problem has been going on for about a month and a half), and i ordered a replacement, so I will be "under the hood" on Thursday. If anyone has any recommendations of what I might do to try to fix this, I would greatly appreciate it.
    3 pictures of my screen:
    http://i771.photobucket.com/albums/xx356/basicallydylan/IMG_0179.jpg
    http://i771.photobucket.com/albums/xx356/basicallydylan/IMG_0178-1.jpg
    http://i771.photobucket.com/albums/xx356/basicallydylan/IMG_0177.jpg

    Well its 70 dollars vs 600 dollars and it wasn't me who bought the applecare. And I would gladly bring it in to an apple technician instead, however my only problem with that is its not like they can just take off the glass, take a look at it and then tell me how much it costs. i mean the glass is shattered, you take it off and its going to be in pieces. Likewise, they very well might say that they can't do anything about it because the broken glass is clearly accidental damage and immediately attribute it to the lcd problem even though it has nothing to do with it. If the glass wasn't broken, I would never have even posted and immediately taken it to the apple store. Please, tell me I'm wrong and I will take it to them right away to tell me exactly why the screen is the way it is, and it will probably be covered seeing how it started out of no where. My understanding of apples policy however is that with the glass cracked as it is, they will have no choice but to immediately charge me for a full repair. But like I said, if I'm wrong please tell me and I'll take it in tomorrow

  • I have bought Adobe Flash on my school computer (Windows 8) and I'm trying to get it on my home computer (Windows 8). I'm stuck with my serial number, how do I find it? It is asking me for my serial number and I don't remember it. Please help and thanks.

    I am in desperate need of finding my serial number so please help asap!

    Hi,
    Which version of Flash Pro are you on? If on Flash CC and are being asked for a password, see Creative Cloud applications ask for serial number
    If you are on a perpetual license of CS6 or earlier, contact Adobe Customer CareContact Customer Care
    Thanks,
    Preran

  • My daughter has an iPod touch and is emailing a much older boy via text free app she downloaded. How can I see the conversations? Please help and thank you

    Please help me...My 12year old daughter has been talking to a older teenager through the text free app. How can I see the conversations? Also, there is a photo vault that is locked. What is that? Please someone help me. I don't know what else to do. I paid and downloaded a program that is supposed to tell you everything that's on the ipod but that was a joke. Thanks for your help.

    As long as you can't get a hold of the device, you can't do anything more than talking to your daughter about it.
    Erasing the device could also be an option to keep her from using apps you don't want her to have on her device.
    Try talking first

Maybe you are looking for