Sunday, September 28, 2014

How to Make an Address Book in NetBeans

Instructions

    1

    Open the Netbeans software on your desktop. Click "File" and select "New." Click "Project." Type "AddressBook" for the app name and click "OK." A blank project is created on your desktop.

    2

    Drag and drop a "JForm" from the Netbeans toolbox to the center panel. The JForm is the object that contains your text boxes and buttons for the address book app. After you drag and drop the JForm to the center pane, you can create the address book text boxes your users use to fill out the data.

    3

    Drag and drop a text box control to the form. For instance, you need a first and last name text box. Drag and drop two text boxes to the JForm. Netbeans automatically draws the text boxes for you, so you just need to label them with "First Name" and "Last Name," so users know where to place the data.

    4

    Add a button to submit and store the new entry. Double-click the button to open the code panel where you add the code that saves the data to the database.

    5

    Add the code that stores the contact to the database. The following code is an example of storing the first and last name in a "contacts" database table:

    insert = query.executeQuery("insert into contacts (fname, lname) values ('" + fname + ";, '" + lname + "')");

    6

    Click the "Run" button to run the Netbeans app in the Java debugger.



No comments:

Post a Comment