As shown above, at this point the JTable has 4x4 structure and empty data.
To use this file, classpath to the JDBC driver must be set for this project.Net Beans has a nice interface to connect DB, but many SQL commands are to be input as a whole sentence I made Swing application for inserting and viewing data to a table of My SQL database.The sample is very simple, available for one specific table and without deleting or updating operation, It would be extended but the document would be longer and more complicated, I'm afraid.Required implementations are inserted automatically Now the red line is gone!In fact, we also need to override get Column Name(int param) method, otherwise we couldn't get customized headders of the table. The code is specified to access the specific table "cars", so the number of column is fixed to 4. Notice the vertical positions of the nodes don't mean their actual locations.So let us proceed toward that with step-by-step instructions.In the preceding table I have created four columns, they are id for the unique identity, Name for the emp name, address for emp address and email to store the email address of the emp.Select "JFrame" node in the Inspector window to show its properties. I decided Grid Layout is the best to set these locations.Change "Form Size Policy" from default "Generate pack()" to "Generate Resize Code". The default layout on JPanel is Flow Layout in Net Beans. they could be moved by drag and drop on the form, If you are not satisfied with the location. The component might escape to a very wrong position, as a different panel.Edit manually the class declaration to extend "Abstract Table Model" class.The editor soon show the red and waved underline to show errors.