Results 1 to 5 of 5
  1. #1
    manolisc is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Default Populate a JTable with NetBeans.

    Hello Everyone! I'm trying for the past 3 days to populate a table with data from an SQL database. I've already got connected to the database but I cannot populate the database. Read every tutorial on it, also read a lot of topics in forums but can't figure it out. I have created a JTable using NetBean's GUI so i would like to populate it in my main method.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Populate a JTable with NetBeans.

    I'd recommend posting more information about the problem. For instance, does your code compile? Does it throw exceptions? Does it run and misbehave? If so, where? Have you read the tutorials on how to create a JTable?

  3. #3
    manolisc is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Default Re: Populate a JTable with NetBeans.

    Well after reading too many tutorials i cannot conclude in a certain tutorial. Many Using Vector or something like JTable Model.. And many of them create the table from the code. I created the table from the GUI. My code compiles but without anything about the table populating.

  4. #4
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Populate a JTable with NetBeans.

    Quote Originally Posted by manolisc View Post
    And many of them create the table from the code. I created the table from the GUI.
    If you are just beginning with creating GUI's, I recommend against using a GUI builder. While they may seem to be useful now, if you don't have a clue what they are doing behind the scenes then your chances of debugging, customizing, adapting, or even reading someone else's code diminish drastically. Rather, work through the Oracle tutorial on using JTables - doing so gives you a solid foundation for solving not just this problem but those to come. And if you have a specific question, ask it along with posting an SSCCE that describes the problem.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default Re: Populate a JTable with NetBeans.

    Also, don't try and do this all at once.
    You have two things here that can (and should) be coded separately.
    One is the GUI, which should allow you to add/edit rows in a JTable.
    The other is the code for inserting/updating/selecting data from your table in the database.

    Finally you write the (what should be fairly small) bit of code that lets one part talk to the other.
    The GUI code should not care where the data comes from, or where it goes.
    The database access code shouldn't care who is calling it.
    Only the bit in the middle (the last part you need to write) should worry about any of that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. populate jtable from jtextboxes and jcombo
    By purejoker in forum AWT / Swing
    Replies: 4
    Last Post: 12-02-2010, 09:29 AM
  2. JTable netbeans help
    By karno in forum NetBeans
    Replies: 1
    Last Post: 03-31-2010, 03:45 AM
  3. Netbeans JTable
    By sysout in forum NetBeans
    Replies: 6
    Last Post: 08-26-2009, 02:27 AM
  4. how to populate large record in jTable
    By ahmed88 in forum New To Java
    Replies: 4
    Last Post: 04-17-2009, 07:22 PM
  5. Netbeans Jtable
    By Manfizy in forum NetBeans
    Replies: 16
    Last Post: 11-13-2008, 09:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •