Java Add Row To JTable From Another JFrame

How To Insert A Row To JTable From A Different Form In Java Using NetBeans

add row to jtable from another jframe in java



In this Java Tutorial we will see How To Get Data From JTextFields And Add It To A Jtable Row From A Different JFrame Using Java NetBeans .




Project Source Code:

//************** in the jtable jframe **************//

// button to display a jframe with jtextfields
    private void jButtonOpenActionPerformed(java.awt.event.ActionEvent evt) {                                            
        
        JFrame_TextFiled frameText = new JFrame_TextFiled();
        frameText.setVisible(true);
        frameText.pack();
        frameText.setLocationRelativeTo(null);
        frameText.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        
    }                                           


// function to add row
    public static void AddRowToJTable(Object[] dataRow)
    {
        DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
        model.addRow(dataRow);
    }                                           



//************** in the jtextfields jframe **************//

// Button to add row
private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {                                           
      
        JFRAME_JTABLE.AddRowToJTable(new Object[]{
                                                  jTextField1.getText(),
                                                  jTextField2.getText(),
                                                  jTextField3.getText(),
                                           });
        
    }


////// OUTPUT : 

Add Row To JTable From Different JFrame In Java



Java Words Count

How To Count Words In A String Using Java Netbeans

words count in java

In This Java Tutorial  We Will See How To Count The Number Of Words In A jTextField Text Using Java Programming Language And NetBeans Editor.

STEPS:
1 - the user enter text into the jtexfields
2 - the user click "count" button to display the number of words in the text.


Project Source Code:

private void jButtonCountActionPerformed(java.awt.event.ActionEvent evt) {                                             
        
        String txt = jTextField1.getText();
        String[] words = txt.split(Pattern.quote(" "));
        System.out.println(words.length);
        
    } 


///////////////OUTPUT:

number of words in a string using java
Result : 11


VB.Net Add Row To Datagridview From Another Form

How To Insert Rows To DataGridView From Another Form In Visual Basic.Net 

insert rows to datagridview from another form using VB.net

In This VB.Net Tutorial  We Will See How To Add Rows To DataGridView From TextBoxes On A Different Form Using Visual Basic.Net Programming Language And Visual Studio Editor.

and in this example we will create 2 forms:
1 - form_1 with a datagridview and a Button
2 - form_2with 3 textboxes and a button

when we click in form_1 button "open a new window" the second form will show up , you need to fill up the textboxes and click the 'add' button

- To Learn More Watch The Video Tutorial Below. 


Project Source Code:

' Form DataGridView
Public Class FormGRID

    ' open a new form to add the data
    Private Sub ButtonOpen_Click(sender As Object, e As EventArgs) Handles ButtonOpen.Click

        Dim fdata As New FormDATA()
        fdata.Show()


    End Sub

End Class


' Form TextBoxes
Public Class FormDATA

    ' button add data
    Private Sub ButtonAdd_Click(sender As Object, e As EventArgs) Handles ButtonAdd.Click


        ' add a new row with our data to the datagridview
        FormGRID.DataGridView1.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text)


    End Sub

End Class
   

Note: make sure to set the datagridview to static (better if you watch th full video)
   
///////////////OUTPUT:

This Is The End Result




insert data to DataGridView from another form in vb




VB.Net Contact Management System Source Code

Contacts Information Management System Project Source Code Using Visual Basic .Net And MySQL Database



in this vb.net project demo you will see what you can do with this contacts management system project, build with visual basic .net and a mysql database.



goals of this project:

- give students / curious persons an example so they can learn from.

helping people create their first project. 

sharing knowledge with others.



this project is not for:

- people who want to use it as their final year project.
- a real life system.

tools:
- visual basic .net programming language.
- visual studio express 2013.
- mysql database.
- canva.com for images.
- flatuicolorpicker.com for colors.

Watch This Full Demo


1 - Login And Register

the Register and Login are in the same form so the user can easily navigate between the two.

The Register Part: 

this is where a user can create a new account.


The Login Part: 

this is where a user can enter his username and password to login into the application main form.



- the user can go between the two part using the label at the bottom


2 - Main Form


the main form contain 2 parts, one for the contacts, and the second for the contact's group.
at the top of the form you can see the profile picture and the username of the logged in user


The Group Section: 

here the user can add a new group, you can't add a group name that already exists ( for the logged in user )


and to edit a group name all you have to do is select the group you want from the combobox and enter the new name into the textbox and click edit.


and to remove a group it's the same as the edit just select the group from combobox and click remove.


The Contact Section: 

1 - Add a New Contact

if the user want to add a new contact, he can do that by clicking on the add button and a new form will show up.


2 - Edit The Selected Contact

to edit a contact click the edit button a new form will show up.


now to select the contact you want to edit click on the "Select Contact" button, and a form with datagridview populated with all ( logged user ) contacts.


double click on the contact you want to edit, and the form will be closed and data will be displayed on the edit form.


now all you have to do is to enter the new data and click the edit button.

3 - Remove The Selected Contact

to remove a contact it's easy just select the contact you want to delete by clicking "Select Contact" and again we will use the same form as the edit to select a contact and the last step is clicking the remove button.


4 - Show Full Contacts List

if you want to see your full contacts list click on the "Show Full List" button, a new form will show up, in this form you can see a datagridview with all contacts.


when you select a contact you can see the full address in a textbox.

if you want to display contacts by group, just select the group you want from the listbox in the left.


if you want to show all contacts again click on the show all label at the top.

The User Section: 

the logged in user can edit his data by clicking on the label "edit my info".


and when you do that a new form will be displayed with the user data.


and to see the new information click on the "Refresh" label.

if you want the source code click on the download button below


Download Now



disclaimer: you will get the source code + the database script
                    and to make it work in your machine is your responsibility
                    and to debug any error/exception is your responsibility
                    this project is for the students who want to see an example and read                                      the code not to get and run

C# Contact Management System Source Code

Contacts Information Management System Project Source Code Using C# And MySQL Database



in this c# project demo you will see what you can do with this students contact management system project build with csharp and a mysql database.



goals of this project:

- give students / curious persons an example so they can learn from.

helping people create their first project. 

sharing knowledge with others.


this project is not for:
- people who want to use it as their final year project.
- a real life system.

tools:
- c# programming language.
- visual studio express 2013.
- mysql database
- canva.com for images
- flatuicolorpicker.com for colors



Watch This Full Demo


1 - Login And Register

the Register and Login are in the same form so the user can easily navigate between the two.

The Register Part: 

this is where a user can create a new account.

The Login Part: 


this is where a user can enter his username and password to login into the application main form.

- the user can go between the two part using the label at the bottom


2 - Main Form


the main form contain 2 parts, one for the contacts, the second for the contact's group.
at the top of the form you can see the profile picture and the username of the logged user

The Group Section: 

here you can add a new group, you can't add a group name that already exists ( for the logged user )


and to edit a group name all you have to do is select the group you want from the combobox and enter the new name and click edit.


and to remove a group it's the same as the edit just select the group from combobox and click remove.

The Contact Section: 

1 - Add a New Contact

if the user want to add a new contact, he can do that by clicking on the add button and a new form will show up.


2 - Edit The Selected Contact

to edit a contact click the edit button a new form will show up.


now to select the contact you want to edit click on the "Select Contact" button, and a form with datagridview populated with all ( logged user ) contacts.


double click on the contact you want to edit, and the form will be closed and data will be displayed on the edit form.


now all you have to do is to enter the new data and click the edit button.

3 - Remove The Selected Contact

to remove a contact it's easy just select the contact you want to delete by clicking "Select Contact" and again we will use the same form as the edit to select a contact and the last step is clicking the remove button.


4 - Show Full Contacts List

if you want to see your full contacts list click on the "Show Full List" button, a new form will show up, in this form you can see a datagridview with all contacts.


when you select a contact you can see the full address in a textbox.

if you want to display contacts by group, just select the group you want from the listbox in the left.


if you want to show all contacts again click on the show all label at the top.

The User Section: 

the logged in user can edit his data by clicking on the label "edit my info".


and when you do that a new form will be displayed with the user data.


and to see the new information click on the "Refresh" label.

if you want the source code click on the download button below





disclaimer: you will get the source code + the database script
                    and to make it work in your machine is your responsibility
                    and to debug any error/exception is your responsibility
                    this project is for the students who want to see an example and read                                      the code not to get and run.





More C# Projects:

C# Students Information System Source Code

Students Information Management System Source Code Using C# And MySQL Database

Students Information Management System Source Code In C#

in this c# project demo you will see what you can do with this students information  management system project build with csharp and a mysql database.

goals of this project:
- give students / curious persons an example so they can learn from.
helping people create their first project. 
sharing knowledge with others.

this project is not for:
- people who want to use it as their final year project.
- a real life system.

tools:
- c# programming language.
- visual studio express 2013.
- mysql database
- canva.com for images
- flatuicolorpicker.com for colors
- text file ( to export data )

Watch This Full Demo


1 - Login Form

the login form allow the users to login into the application main form

C# Students Information System Source Code - login form

if the user enter wrong username or password a message will show up

C# Students Information System Source Code - login form error

and when you enter correct username and password


when you click on the login button the main form will show up and the login form will close it self.


2 - Main Form

the main form contain 3 tabs, one for the students, the second for the courses, and the last one for the scores.

3 - Student Section


on the student section you can add, edit, remove, and more.



C# Students Information System Source Code - main form - students
Students

-> Add Student Form

this form allow you to insert a new student with data verification before the insert

C# Students Information System Source Code - add student


-> Students List Form


this form contain a datagridveiw populated with all the students in the database, when you double click on a datagridview row -> the selected will be displayed on a new form to edit / remove student,
and you can click on the refresh button to display the edited data.


C# Students Information System Source Code - students list


-> Update Delete Student Form

you can access to this form by clicking on the "Edit / Remove" in the top menu, or by double clicking on a student in the students list form.
in this form you can:
- search student by id.
- remove student.
- edit student data.


C# Students Information System Source Code - edit, remove student





-> Students Statics Form


this form contain the total students in the database, male students percentage, female students  percentage.

C# Students Information System Source Code - statics
statics form

C# Students Information System Source Code - statics - total students
total students - mouse enter

C# Students Information System Source Code - statics - male students
male students percentage - mouse enter

C# Students Information System Source Code - statics - female students
female students percentage - mouse enter

-> Manage Students Form

on this form you can do / see :
- get a list of all students in the database to a datagridview.
- see the total of students depending on the datagridview.
- search students by value and display them on the datagridview.
- get selected from datagridview to the data fields
- edit student information.
- remove selected student.
- add a new student.
- browse image from your computer to the picturebox.
- save the image from picturebox to your computer.
- clear / reset all fields.

C# Students Information System Source Code - manage students

-> Print Students Form

 this form allow you to export students data from datagridview to text file.
you can select students by birthdate or gender or both.



C# Students Information System Source Code - printed students list


4 - Course Section


C# Students Information System Source Code - main form - courses
Courses


-> Add Course Form


this form allow you to insert a new course with data verification:
- course name not empty.
course name not already exists.
- number of hours +10 H ( we did that from NumericUpDown control -> properties -> set minimum to 10 ).


C# Students Information System Source Code - add course

-> Edit Course Form



in this form you can edit the selected course from the combobox .


C# Students Information System Source Code - edit course

-> Remove Course Form


this form allow you to delete a course with the given id .



C# Students Information System Source Code - delete course



-> Manage Courses Form

 what this form contain ? and what you can do on it?:
- listbox populated with all courses.
- label with the total courses number.
- add a new course.
- edit the selected course.
- remove the selected course.
- navigate between courses.



C# Students Information System Source Code - manage courses




-> Print Courses Form

 this form allow you to export courses data from datagridview to text file.



C# Students Information System Source Code - print courses



C# Students Information System Source Code - printed courses list


4 - Score Section


C# Students Information System Source Code - main form - scores
Score

-> Add Score Form

in this form you can set a score to a specific student on a specific course.


C# Students Information System Source Code - add score

-> Remove Score Form

in this form you can delete the selected score using datagridview.


C# Students Information System Source Code - delete score



-> Manage Scores Form

 what this form contain ? and what you can do on it?:
- a datagridview to show students or scores using to buttons.
- add a new score for the selected student from datagridview on the selected course from combobox.
- remove the selected score using student id and course id.
- remove the selected course.
- show the average score by course on a new form.

C# Students Information System Source Code - manage scores - show scores
show scores

C# Students Information System Source Code - manage scores - show students
show students

-> Print Scores Form

 this form allow you to export scores ( by student or course ) data from datagridview to text file.

C# Students Information System Source Code - print scores
all scores

C# Students Information System Source Code - print selected student scores
scores of the selected student

C# Students Information System Source Code - print selected course scores
scores for the selected course
printed scores




if you want the source code click on the download button below





disclaimer: you will get the source code + the database script
                    and to make it work in your machine is your responsibility
                    and to debug any error/exception is your responsibility
                    this project is for the students who want to see an example and read                                      the code not to get and run.





C# Inventory System Source Code