Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Ip pinging programm with tables, realy need help

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Ip pinging programm with tables, realy need help

    Hello im stuck with my programm, I'm newbie at programming, but I have to finish this programm for my school project. I only use youtube tutorials, but in the end there is not enought info so im asking here for help.

    Basicaly what this programm does is take ip addreses from Database and pings them, if it fails to ping it displays ip address in one table if pingable it dispalys in other.I hope you understand what im trying to do here, and plz don't say that my question is not clear, cause I dont think I can explain it better,its pretty hard cause I hardly understand programming language.


    private void browseActionPerformed(java.awt.event.ActionEvent evt) {
    JFileChooser chooser = new JFileChooser();
    File F = new File ("c:/");
    File NameDir, NamePath;
    int Checker;
    chooser.setCurrentDirectory(F);
    chooser.setDialogTitle ("Choose db");
    Checker = chooser.showOpenDialog(null);

    if (Checker == JFileChooser.APPROVE_OPTION){
    NameDir = chooser.getCurrentDirectory();
    NamePath = chooser.getSelectedFile();

    try {

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    String filename = NamePath.getAbsolutePath();
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=true}";
    Connection con = DriverManager.getConnection( database ,"","");

    //I am using Access Database thats why all this connection code ^^

    Statement s = con.createStatement();
    s.execute("SELECT AgIP FROM Agents ");
    ResultSet rs = s.getResultSet();
    if (rs != null)
    while ( rs.next()){
    String sampleString = rs.getString(1);
    boolean reachable = false;
    reachable=(InetAddress.getByName(sampleString).isR eachable(1000));

    if (reachable==true){
    for (int i = 0;i <jTable1.getRowCount();i++){ //This place is not right for sure
    jTable1.getModel().setValueAt(sampleString, i, 0);

    }
    }
    else{


    for (int e = 0;e <jTable2.getRowCount();e++){
    jTable2.getModel().setValueAt(sampleString, e , 0);

    }
    }
    }
    }
    catch (Exception err) {
    System.out.println("ERROR: " + err);
    }
    }
    }

    Hope it is enough info.In picture I added there is explained deeper what im trying to achieve.
    Attached Images Attached Images


  2. #2
    Junior Member
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Ip pinging programm with tables, realy need help

    Anyone?

  3. #3
    Member angstrem's Avatar
    Join Date
    Mar 2013
    Location
    Ukraine
    Posts
    200
    My Mood
    Happy
    Thanks
    9
    Thanked 31 Times in 29 Posts

    Default Re: Ip pinging programm with tables, realy need help

    Use official Oracle tutorial. It has more than enough info for you to understand Java and Swing.

  4. #4
    Junior Member
    Join Date
    May 2013
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Ip pinging programm with tables, realy need help

    What exactly is wrong with it?

  5. #5
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Ip pinging programm with tables, realy need help

    Quote Originally Posted by reinisla View Post
    Anyone?
    There is no need to "bump" your thread. The volunteers will read it when they get to it and bumping your thread does not cause anyone to sit down at their pc any sooner. However, it does cause extra for us to read and reply to, which actually decreases the amount of help provided over time.
    Please see the Announcements page for the use of code tags when posting code on the forum.

    I understand what you want the code to do. I do not understand where you are stuck or what problem you are having. Does the code compile? Are there any error messages? What were you trying to accomplish (specifically what step are you on in the overall project) when you got stuck?

Similar Threads

  1. Programm does not start. Help Please!
    By efluvio in forum What's Wrong With My Code?
    Replies: 11
    Last Post: March 8th, 2013, 02:55 PM
  2. Client-Server programm creation
    By MustSeeMelons in forum Java Networking
    Replies: 16
    Last Post: December 11th, 2012, 04:39 PM
  3. Creating a programm
    By TheBoss84 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 23rd, 2011, 03:36 PM
  4. Can't run Game of Life programm
    By cutekill0 in forum What's Wrong With My Code?
    Replies: 24
    Last Post: September 13th, 2011, 09:30 AM
  5. Replies: 1
    Last Post: May 3rd, 2010, 02:03 PM

Tags for this Thread