Simple CRUD With Netbeans
Simple CRUD With Netbeans
●
MySQL Database Server
– XAMPP
– Manual Install
●
Windows:
– https://www.mysql.com/downloads/
– https://dev.mysql.com/downloads/windows/installer/8.0.html
●
Linux:
– Install dari Repository
●
Download Connector
– https://dev.mysql.com/downloads/connector/j/
– MySQL JDBC Driver
– MySQL Connector
2
Requirements
●
Download Netbeans
– https://netbeans.apache.org/download/index.html
●
Install it!
3
Prepare Database & Table
Prepare Database & Table
●
Create Database
– create database libraryDB;
●
Create Table
– use libraryDB;
– create table categories (
id int NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
5
Prepare Database & Table
●
Insert Sample Data
– insert into categories (name) values (‘Komputer’);
– insert into categories (name) values (‘Sastra’);
6
Setup Netbeans Connector for MySQL
Create New Project
●
File > New Project
●
Java with Maven > Java Application
●
Entry Project Name
●
Finish
8
Setup Dependencies
●
Right Click Dependencies
●
Add Dependencies
9
Setup Dependencies
●
Select mysql-connector-java-
8.0.27.jar
●
Right Click
●
Select Manual Install Artifact
●
Browse the MySQL
Connector .jar file
●
Click Install Locally
10
CRUD: List Form
Category List
●
Add New JFrame Form
●
Class Name: CategoryList
●
Finish
12
Category List
13
Refresh Button
14
CRUD: Master Form
Category Form
●
Add New JFrame Form
●
Class Name: CategoryForm
●
Finish
16
Category Form
17
Category List::New Button
●
Double Click the NEW Button at the Category List
●
Add the code to Open CategoryForm
18
Category Form::Save Button
19
Run the App
●
F6 to Run it!
●
Choose CategoryList as Main
Class
20
The App
21
Thank You
@wukongrita
22