diff --git a/Projek 1/H071221090_Tugas Proyek/.vscode/settings.json b/Projek 1/H071221090_Tugas Proyek/.vscode/settings.json
new file mode 100644
index 0000000..cf9abf8
--- /dev/null
+++ b/Projek 1/H071221090_Tugas Proyek/.vscode/settings.json
@@ -0,0 +1,8 @@
+{
+ "java.project.sourcePaths": ["src"],
+ "java.project.outputPath": "bin",
+ "java.project.referencedLibraries": [
+ "lib/**/*.jar"
+ "C:\\MYSQL\\mysql-connector-j-8.0.32\\mysql-connector-j-8.0.32\\mysql-connector-j-8.0.32.jar"
+ ]
+}
diff --git a/Projek 1/H071221090_Tugas Proyek/README.md b/Projek 1/H071221090_Tugas Proyek/README.md
new file mode 100644
index 0000000..ea6d65b
--- /dev/null
+++ b/Projek 1/H071221090_Tugas Proyek/README.md
@@ -0,0 +1,24 @@
+# App.java
+didalam App.java terdapat method static yaitu method main. Dimana dalam method main terdapat Menu.showMenu();
+
+# com
+terdapat 1 package
+
+## config
+di dalam package config terdapat java class yaitu MyConfig
+di dalamnya terdapat java class yaitu DbController terdapat method static getDatabase untuk mengambil data yang ada dalam dalam database yang kita buat, selain itu terdapat juga getProdukByNama(), insertData(), updateNama(), updateHarga(), updataStok() dan deleteData()
+
+a. Delete: berfungsi untuk menghapus data yang ingin dihapus dengan cara menginput nama produk dengan benar
+
+b. Edit: berfungsi untuk mengedit data yang sudah ada
+
+c. Insert: berfungsi untuk menambahkan data baru
+
+d. Menu: berfungsi untuk menampilkan menu serta user dapat menginput menu yang diinginkan
+
+e. Read: berfungsi menampilkan seluruh data yang tersimpan
+
+dan terdapat java class Produk yang menyimpan atribut Id, name, price, stock, serta terdapat method setter dan getter untuk masing-masing atribut.
+
+
+
diff --git a/Projek 1/H071221090_Tugas Proyek/bin/App.class b/Projek 1/H071221090_Tugas Proyek/bin/App.class
new file mode 100644
index 0000000..2fbc437
Binary files /dev/null and b/Projek 1/H071221090_Tugas Proyek/bin/App.class differ
diff --git a/Projek 1/H071221090_Tugas Proyek/bin/MyConfig.class b/Projek 1/H071221090_Tugas Proyek/bin/MyConfig.class
new file mode 100644
index 0000000..0a99cff
Binary files /dev/null and b/Projek 1/H071221090_Tugas Proyek/bin/MyConfig.class differ
diff --git a/Projek 1/H071221090_Tugas Proyek/src/App.java b/Projek 1/H071221090_Tugas Proyek/src/App.java
new file mode 100644
index 0000000..d7a4653
--- /dev/null
+++ b/Projek 1/H071221090_Tugas Proyek/src/App.java
@@ -0,0 +1,74 @@
+import java.util.Scanner;
+
+public class App {
+ public static void main(String[] args) {
+ Scanner input = new Scanner(System.in);
+
+ MyConfig.getConnection();
+ MyConfig.createTable();
+
+ int choice;
+ do {
+ System.out.println("------------------------");
+ System.out.println(" WELCOME TO ...");
+ System.out.println("------------------------");
+ System.out.println("1.] Read Data");
+ System.out.println("2.] Insert data");
+ System.out.println("3.] Edit Data");
+ System.out.println("4.] Delete data");
+ System.out.println("5.] Exit");
+ System.out.println("------------------------");
+ System.out.print("Pilih: ");
+
+ choice = input.nextInt();
+ input.nextLine(); // Consume the newline character
+
+ switch (choice) {
+ case 1:
+ // Read Data
+ MyConfig.getDatabase();
+ break;
+ case 2:
+ // Insert Data
+ System.out.print("NAMA : ");
+ String newNama = input.nextLine();
+
+ System.out.print("HARGA : ");
+ long newharga = input.nextLong();
+
+ System.out.print("STOK : ");
+ int newstok = input.nextInt();
+ MyConfig.addData(newNama, newharga, newstok);
+ break;
+ case 3:
+ // Edit Data
+ System.out.print("ID: ");
+ int id = input.nextInt();
+ input.nextLine();
+ System.out.print("NAMA: ");
+ String nama = input.nextLine();
+ System.out.print("HARGA: ");
+ int harga = input.nextInt();
+ System.out.print("STOK: ");
+ int stok = input.nextInt();
+ MyConfig.editData(id, nama, harga, stok);
+ break;
+ case 4:
+ // Delete Data
+ System.out.print("ID: ");
+ int deleteId = input.nextInt();
+ MyConfig.deleteData(deleteId);
+ break;
+ case 5:
+ System.out.println("Exiting...");
+ break;
+ default:
+ System.out.println("Pilihan tidak tersedia");
+ break;
+ }
+
+ } while (choice != 5);
+
+ input.close();
+ }
+}
diff --git a/Projek 1/H071221090_Tugas Proyek/src/MyConfig.java b/Projek 1/H071221090_Tugas Proyek/src/MyConfig.java
new file mode 100644
index 0000000..f8aa947
--- /dev/null
+++ b/Projek 1/H071221090_Tugas Proyek/src/MyConfig.java
@@ -0,0 +1,98 @@
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public class MyConfig {
+
+ private static final String url = "jdbc:mysql://localhost:3306/imeltoko";
+ private static final String username = "root";
+ private static final String pass = "";
+
+ private static Connection connect;
+ private static Statement statement;
+
+ public static void getConnection() {
+ try {
+ connect = DriverManager.getConnection(url, username, pass);
+ System.out.println("Connected");
+ } catch (SQLException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+ public static void getDatabase() {
+ try {
+ String query = "SELECT * FROM BARANG";
+ PreparedStatement statement = connect.prepareStatement(query);
+ ResultSet resultSet = statement.executeQuery();
+
+ while (resultSet.next()) {
+ int id = resultSet.getInt("ID");
+ String Nama = resultSet.getString("NAMA");
+ int Harga = resultSet.getInt("HARGA");
+ int Stok = resultSet.getInt("STOK");
+ System.out.println("ID: " + id + ", NAMA: " + Nama + ", HARGA: " + Harga + ", STOK: " + Stok);
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void createTable() {
+ try {
+ String query = "CREATE TABLE IF NOT EXISTS BARANG (" +
+ "ID INT PRIMARY KEY AUTO_INCREMENT," +
+ "NAMA VARCHAR(255) NULL," +
+ "HARGA INT NULL," +
+ "STOK INT NULL" +
+ ")";
+ PreparedStatement statement = connect.prepareStatement(query);
+ statement.executeUpdate();
+ System.out.println("Table created successfully");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void addData(String newNama, long newHarga, int newStok) {
+ try {
+ statement = connect.createStatement();
+ statement.executeUpdate("INSERT INTO `BARANG` (`ID`, `NAMA`, `HARGA`, `STOK`) VALUES (NULL, '"+newNama+"', '"+newHarga+"', '"+newStok+"') ");
+ System.out.println("Data added successfully");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void editData(int ID, String NAMA, int HARGA, int STOK) {
+ try {
+ String query = "UPDATE BARANG SET NAMA=?, HARGA=?, STOK=? WHERE iD=?";
+ PreparedStatement statement = connect.prepareStatement(query);
+ statement.setString(1, NAMA);
+ statement.setDouble(2, HARGA);
+ statement.setInt(3, STOK);
+ statement.setInt(4, ID);
+ statement.executeUpdate();
+ System.out.println("Data updated successfully");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void deleteData(int id) {
+ try {
+ String query = "DELETE FROM BARANG WHERE ID=?";
+ PreparedStatement statement = connect.prepareStatement(query);
+ statement.setInt(1, id);
+ statement.executeUpdate();
+ System.out.println("Data deleted successfully");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+}
+
diff --git a/Projek 2/Kasir/build.xml b/Projek 2/Kasir/build.xml
new file mode 100644
index 0000000..79b19c0
--- /dev/null
+++ b/Projek 2/Kasir/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project Kasir.
+
+
+
diff --git a/Projek 2/Kasir/build/classes/.netbeans_automatic_build b/Projek 2/Kasir/build/classes/.netbeans_automatic_build
new file mode 100644
index 0000000..e69de29
diff --git a/Projek 2/Kasir/build/classes/.netbeans_update_resources b/Projek 2/Kasir/build/classes/.netbeans_update_resources
new file mode 100644
index 0000000..e69de29
diff --git a/Projek 2/Kasir/build/classes/App/Kasirku$1.class b/Projek 2/Kasir/build/classes/App/Kasirku$1.class
new file mode 100644
index 0000000..6f11ddb
Binary files /dev/null and b/Projek 2/Kasir/build/classes/App/Kasirku$1.class differ
diff --git a/Projek 2/Kasir/build/classes/App/Kasirku$2.class b/Projek 2/Kasir/build/classes/App/Kasirku$2.class
new file mode 100644
index 0000000..cbcf1c1
Binary files /dev/null and b/Projek 2/Kasir/build/classes/App/Kasirku$2.class differ
diff --git a/Projek 2/Kasir/build/classes/App/Kasirku$3.class b/Projek 2/Kasir/build/classes/App/Kasirku$3.class
new file mode 100644
index 0000000..4546a13
Binary files /dev/null and b/Projek 2/Kasir/build/classes/App/Kasirku$3.class differ
diff --git a/Projek 2/Kasir/build/classes/App/Kasirku$4.class b/Projek 2/Kasir/build/classes/App/Kasirku$4.class
new file mode 100644
index 0000000..3f973ed
Binary files /dev/null and b/Projek 2/Kasir/build/classes/App/Kasirku$4.class differ
diff --git a/Projek 2/Kasir/build/classes/App/Kasirku$5.class b/Projek 2/Kasir/build/classes/App/Kasirku$5.class
new file mode 100644
index 0000000..4ebc17b
Binary files /dev/null and b/Projek 2/Kasir/build/classes/App/Kasirku$5.class differ
diff --git a/Projek 2/Kasir/build/classes/App/Kasirku.class b/Projek 2/Kasir/build/classes/App/Kasirku.class
new file mode 100644
index 0000000..6b04397
Binary files /dev/null and b/Projek 2/Kasir/build/classes/App/Kasirku.class differ
diff --git a/Projek 2/Kasir/build/classes/Com/Config/DatabaseConnect.class b/Projek 2/Kasir/build/classes/Com/Config/DatabaseConnect.class
new file mode 100644
index 0000000..a471b57
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Com/Config/DatabaseConnect.class differ
diff --git a/Projek 2/Kasir/build/classes/Com/Config/MyConfig.class b/Projek 2/Kasir/build/classes/Com/Config/MyConfig.class
new file mode 100644
index 0000000..dc7aa95
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Com/Config/MyConfig.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$1.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$1.class
new file mode 100644
index 0000000..976486d
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$1.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$10.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$10.class
new file mode 100644
index 0000000..c6ce654
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$10.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$2.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$2.class
new file mode 100644
index 0000000..c672cf6
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$2.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$3.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$3.class
new file mode 100644
index 0000000..1dbb804
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$3.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$4.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$4.class
new file mode 100644
index 0000000..d495a62
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$4.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$5.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$5.class
new file mode 100644
index 0000000..91536a6
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$5.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$6.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$6.class
new file mode 100644
index 0000000..407f5a6
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$6.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$7.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$7.class
new file mode 100644
index 0000000..cf46c3b
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$7.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$8.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$8.class
new file mode 100644
index 0000000..1ab99fa
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$8.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku$9.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$9.class
new file mode 100644
index 0000000..4289741
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku$9.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku.class b/Projek 2/Kasir/build/classes/Kasirku/Kasirku.class
new file mode 100644
index 0000000..13b1bed
Binary files /dev/null and b/Projek 2/Kasir/build/classes/Kasirku/Kasirku.class differ
diff --git a/Projek 2/Kasir/build/classes/Kasirku/Kasirku.form b/Projek 2/Kasir/build/classes/Kasirku/Kasirku.form
new file mode 100644
index 0000000..be11dac
--- /dev/null
+++ b/Projek 2/Kasir/build/classes/Kasirku/Kasirku.form
@@ -0,0 +1,502 @@
+
+
+
diff --git a/Projek 2/Kasir/manifest.mf b/Projek 2/Kasir/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/Projek 2/Kasir/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Projek 2/Kasir/nbproject/build-impl.xml b/Projek 2/Kasir/nbproject/build-impl.xml
new file mode 100644
index 0000000..71a78ed
--- /dev/null
+++ b/Projek 2/Kasir/nbproject/build-impl.xml
@@ -0,0 +1,1771 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Projek 2/Kasir/nbproject/genfiles.properties b/Projek 2/Kasir/nbproject/genfiles.properties
new file mode 100644
index 0000000..2d1d5c8
--- /dev/null
+++ b/Projek 2/Kasir/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=c8f061af
+build.xml.script.CRC32=479c19fa
+build.xml.stylesheet.CRC32=f85dc8f2@1.107.0.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=c8f061af
+nbproject/build-impl.xml.script.CRC32=4f67fa6a
+nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.107.0.48
diff --git a/Projek 2/Kasir/nbproject/private/private.properties b/Projek 2/Kasir/nbproject/private/private.properties
new file mode 100644
index 0000000..b8c8127
--- /dev/null
+++ b/Projek 2/Kasir/nbproject/private/private.properties
@@ -0,0 +1,2 @@
+compile.on.save=true
+user.properties.file=C:\\Users\\NABILA AZAHRANI\\AppData\\Roaming\\NetBeans\\18\\build.properties
diff --git a/Projek 2/Kasir/nbproject/private/private.xml b/Projek 2/Kasir/nbproject/private/private.xml
new file mode 100644
index 0000000..69ee66c
--- /dev/null
+++ b/Projek 2/Kasir/nbproject/private/private.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ file:/C:/Users/NABILA%20AZAHRANI/OneDrive/Documents/Tugas%20PBO/Kasir/src/Com/Config/DatabaseConnect.java
+ file:/C:/Users/NABILA%20AZAHRANI/OneDrive/Documents/Tugas%20PBO/Kasir/src/Com/Config/MyConfig.java
+ file:/C:/Users/NABILA%20AZAHRANI/OneDrive/Documents/Tugas%20PBO/Kasir/src/Kasirku/Kasirku.java
+
+
+
diff --git a/Projek 2/Kasir/nbproject/project.properties b/Projek 2/Kasir/nbproject/project.properties
new file mode 100644
index 0000000..6a3887f
--- /dev/null
+++ b/Projek 2/Kasir/nbproject/project.properties
@@ -0,0 +1,96 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processor.options=
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/Kasir.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/Kasir
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${libs.MySQL_JDBC_Driver.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=19
+javac.target=19
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=Kasir
+main.class=
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/Projek 2/Kasir/nbproject/project.xml b/Projek 2/Kasir/nbproject/project.xml
new file mode 100644
index 0000000..35b1f18
--- /dev/null
+++ b/Projek 2/Kasir/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ Kasir
+
+
+
+
+
+
+
+
+
diff --git a/Projek 2/Kasir/src/Com/Config/DatabaseConnect.java b/Projek 2/Kasir/src/Com/Config/DatabaseConnect.java
new file mode 100644
index 0000000..7bebc0d
--- /dev/null
+++ b/Projek 2/Kasir/src/Com/Config/DatabaseConnect.java
@@ -0,0 +1,10 @@
+
+package Com.Config;
+
+import java.sql.Connection;
+
+public class DatabaseConnect {
+ MyConfig Con = new MyConfig();
+ Connection MyConfig = Con.getConnect();
+}
+
diff --git a/Projek 2/Kasir/src/Com/Config/MyConfig.java b/Projek 2/Kasir/src/Com/Config/MyConfig.java
new file mode 100644
index 0000000..624e8e6
--- /dev/null
+++ b/Projek 2/Kasir/src/Com/Config/MyConfig.java
@@ -0,0 +1,27 @@
+package Com.Config;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import javax.swing.JOptionPane;
+
+public class MyConfig {
+ private Connection Con;
+
+ public Connection getConnect(){
+ try{
+ Class.forName("com.mysql.cj.jdbc.Driver");
+ }catch(ClassNotFoundException ex){
+
+ }
+ try{
+ Con = DriverManager.getConnection("jdbc:mysql://localhost:3306/imeltoko","root","");
+ if(Con != null){
+ JOptionPane.showMessageDialog(null, "Koneksi Berhasil");
+ }
+ }catch(SQLException ex){
+ JOptionPane.showMessageDialog(null, "Koneksi Gagal");
+ }
+ return Con;
+ }
+}
\ No newline at end of file
diff --git a/Projek 2/Kasir/src/Kasirku/Kasirku.form b/Projek 2/Kasir/src/Kasirku/Kasirku.form
new file mode 100644
index 0000000..be11dac
--- /dev/null
+++ b/Projek 2/Kasir/src/Kasirku/Kasirku.form
@@ -0,0 +1,502 @@
+
+
+
diff --git a/Projek 2/Kasir/src/Kasirku/Kasirku.java b/Projek 2/Kasir/src/Kasirku/Kasirku.java
new file mode 100644
index 0000000..8262b17
--- /dev/null
+++ b/Projek 2/Kasir/src/Kasirku/Kasirku.java
@@ -0,0 +1,589 @@
+
+package Kasirku;
+
+import Com.Config.MyConfig;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.PreparedStatement;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.JTable;
+
+
+
+public class Kasirku extends javax.swing.JFrame {
+ private Statement St;
+ private Connection Con;
+ private ResultSet Rs;
+ private String sql = "";
+ private DefaultTableModel model;
+
+
+public void clear() {
+ BoxNama.setText("");
+ BoxHarga.setText("");
+ BoxJumlah.setText("");
+ BoxNama.requestFocus();
+ }
+
+public void insertData(){
+ DefaultTableModel model = (DefaultTableModel) TabelProduk.getModel();
+ int row = TabelProduk.getRowCount();
+ model.addRow(new Object[]{
+ row += 1,
+ BoxNama.getText(),
+ BoxHarga.getText(),
+ BoxJumlah.getText()
+ });
+ }
+public double hitungTotal(){
+ DefaultTableModel model = (DefaultTableModel) TabelProduk.getModel();
+// int[] selectedRows = TblBarang.getSelectedRows();
+ int rowCount = model.getRowCount();
+ double total = 0.0;
+
+// double total = 0.0;
+// for(int row : selectedRows){
+// double harga = Double.parseDouble(model.getValueAt(row, 2).toString());
+// int jumlah = Integer.parseInt(model.getValueAt(row, 3).toString());
+// total += harga*jumlah;
+// }
+
+ for(int i = 0; i < rowCount; i++){
+ double harga = Double.parseDouble(model.getValueAt(i, 2).toString());
+ int jumlah = Integer.parseInt(model.getValueAt(i, 3).toString());
+ total += harga*jumlah;
+ }
+ return total;
+ }
+
+ public void Show(){
+ MyConfig connect = new MyConfig();
+ try{
+ Con = connect.getConnect();
+ St = Con.createStatement();
+ Rs = St.executeQuery("SELECT * FROM utils");
+ int i = 1;
+ while(Rs.next()){
+ String[] row = {Integer.toString(i), Rs.getString(2), Rs.getString(3), Rs.getString(4)};
+ model.addRow(row);
+ i++;
+ }
+ }catch(SQLException ex){
+ System.out.print(ex.getMessage());
+ }
+ }
+
+public Kasirku() {
+ initComponents();
+ String [] header = {"ID", "NAMA", "HARGA", "STOK"};
+ model = new DefaultTableModel (header,0);
+ TabelProduk.setModel(model);
+ Show();
+// KoneksiDatabase();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jPanel1 = new javax.swing.JPanel();
+ jLabel1 = new javax.swing.JLabel();
+ LabelHarga = new javax.swing.JLabel();
+ LabelNama = new javax.swing.JLabel();
+ LabelJumlah = new javax.swing.JLabel();
+ BoxNama = new javax.swing.JTextField();
+ BoxHarga = new javax.swing.JTextField();
+ BoxJumlah = new javax.swing.JTextField();
+ jPanel2 = new javax.swing.JPanel();
+ btn_tambah = new javax.swing.JButton();
+ btn_edit = new javax.swing.JButton();
+ btn_delete = new javax.swing.JButton();
+ jPanel3 = new javax.swing.JPanel();
+ LabelTotal = new javax.swing.JLabel();
+ LabelUang = new javax.swing.JLabel();
+ LabelKembalian = new javax.swing.JLabel();
+ BoxTotal = new javax.swing.JTextField();
+ BoxUang = new javax.swing.JTextField();
+ BoxKembalian = new javax.swing.JTextField();
+ btn_bayar = new javax.swing.JButton();
+ btn_simpan = new javax.swing.JButton();
+ jPanel4 = new javax.swing.JPanel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ TabelProduk = new javax.swing.JTable();
+ btn_clear = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+
+ jPanel1.setBackground(new java.awt.Color(0, 204, 204));
+
+ jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
+ jLabel1.setForeground(new java.awt.Color(255, 255, 255));
+ jLabel1.setText("KasirIbel");
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(15, 15, 15)
+ .addComponent(jLabel1)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(30, 30, 30)
+ .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(46, Short.MAX_VALUE))
+ );
+
+ LabelHarga.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ LabelHarga.setText("Harga Barang");
+
+ LabelNama.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ LabelNama.setText("Nama Barang");
+
+ LabelJumlah.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ LabelJumlah.setText("Jumlah Barang");
+
+ BoxNama.setBackground(new java.awt.Color(0, 204, 204));
+ BoxNama.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ BoxNama.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ BoxNamaActionPerformed(evt);
+ }
+ });
+
+ BoxHarga.setBackground(new java.awt.Color(0, 204, 204));
+ BoxHarga.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+
+ BoxJumlah.setBackground(new java.awt.Color(0, 204, 204));
+ BoxJumlah.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+
+ jPanel2.setBackground(new java.awt.Color(0, 204, 204));
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 0, Short.MAX_VALUE)
+ );
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 71, Short.MAX_VALUE)
+ );
+
+ btn_tambah.setBackground(new java.awt.Color(102, 255, 255));
+ btn_tambah.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btn_tambah.setText("Tambah");
+ btn_tambah.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btn_tambahActionPerformed(evt);
+ }
+ });
+
+ btn_edit.setBackground(new java.awt.Color(102, 255, 255));
+ btn_edit.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btn_edit.setText("Edit");
+ btn_edit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btn_editActionPerformed(evt);
+ }
+ });
+
+ btn_delete.setBackground(new java.awt.Color(102, 255, 255));
+ btn_delete.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btn_delete.setText("Delete");
+ btn_delete.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btn_deleteActionPerformed(evt);
+ }
+ });
+
+ jPanel3.setBackground(new java.awt.Color(204, 255, 255));
+
+ LabelTotal.setBackground(new java.awt.Color(0, 204, 204));
+ LabelTotal.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ LabelTotal.setText("Total");
+
+ LabelUang.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ LabelUang.setText("Uang");
+
+ LabelKembalian.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ LabelKembalian.setText("Kembalian");
+
+ BoxTotal.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ BoxTotal.setText("Rp.");
+ BoxTotal.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ BoxTotalActionPerformed(evt);
+ }
+ });
+
+ BoxUang.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ BoxUang.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ BoxUangActionPerformed(evt);
+ }
+ });
+
+ BoxKembalian.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ BoxKembalian.setText("Rp.");
+
+ btn_bayar.setBackground(new java.awt.Color(102, 255, 255));
+ btn_bayar.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btn_bayar.setText("Bayar");
+ btn_bayar.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btn_bayarActionPerformed(evt);
+ }
+ });
+
+ btn_simpan.setBackground(new java.awt.Color(102, 255, 255));
+ btn_simpan.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btn_simpan.setText("Simpan");
+ btn_simpan.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btn_simpanActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(LabelTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(LabelUang, javax.swing.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE))
+ .addComponent(LabelKembalian))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(BoxKembalian, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
+ .addComponent(BoxTotal, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
+ .addComponent(BoxUang)))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addComponent(btn_simpan, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(btn_bayar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap())
+ );
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGap(23, 23, 23)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(LabelTotal)
+ .addComponent(BoxTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(LabelUang)
+ .addComponent(BoxUang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(LabelKembalian)
+ .addComponent(BoxKembalian, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(32, 32, 32)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btn_simpan)
+ .addComponent(btn_bayar))
+ .addContainerGap(87, Short.MAX_VALUE))
+ );
+
+ TabelProduk.setBackground(new java.awt.Color(204, 255, 255));
+ TabelProduk.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "ID", "Nama ", "Harga ", "Jumlah "
+ }
+ ) {
+ Class[] types = new Class [] {
+ java.lang.Integer.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false, false
+ };
+
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
+ });
+ jScrollPane1.setViewportView(TabelProduk);
+
+ javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
+ jPanel4.setLayout(jPanel4Layout);
+ jPanel4Layout.setHorizontalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
+ );
+ jPanel4Layout.setVerticalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
+ );
+
+ btn_clear.setBackground(new java.awt.Color(102, 255, 255));
+ btn_clear.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btn_clear.setText("Clear");
+ btn_clear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btn_clearActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(LabelNama)
+ .addComponent(LabelHarga)
+ .addComponent(LabelJumlah)
+ .addComponent(btn_tambah))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(BoxNama, javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(BoxHarga, javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(BoxJumlah, javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(btn_clear, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(35, 35, 35)
+ .addComponent(btn_edit, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
+ .addComponent(btn_delete, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGap(10, 10, 10)
+ .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(LabelNama)
+ .addComponent(BoxNama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(19, 19, 19)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(BoxHarga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(LabelHarga))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(LabelJumlah)
+ .addComponent(BoxJumlah, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btn_tambah)
+ .addComponent(btn_edit)
+ .addComponent(btn_delete)
+ .addComponent(btn_clear))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(10, 10, 10)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(5, 5, 5))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void BoxUangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BoxUangActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_BoxUangActionPerformed
+
+ private void btn_simpanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_simpanActionPerformed
+ // TODO add your handling code here:
+ try{
+ Connection Con = DriverManager.getConnection("jdbc:mysql://localhost:3306/imeltoko","root","");
+
+ int rowCount = TabelProduk.getRowCount();
+ for(int i = 0; i < rowCount; i++){
+ String Column1 = TabelProduk.getValueAt(i, 1).toString();
+ String Column2 = TabelProduk.getValueAt(i, 2).toString();
+ String Column3 = TabelProduk.getValueAt(i, 3).toString();
+
+ String sql = "INSERT INTO muti_table (NAMMA, HARGA, STOK) VALUES (?,?,?)";
+ PreparedStatement statement = Con.prepareStatement(sql);
+
+ statement.setString(1, Column1);
+ statement.setString(2, Column2);
+ statement.setString(3, Column3);
+
+ statement.executeUpdate();
+ }
+
+ JOptionPane.showMessageDialog(this, "Data berhasil disimpan ke database.");
+ Con.close();
+
+ }catch(SQLException e){
+ JOptionPane.showMessageDialog(this, "Terjadi kesalahan saat menyimpan data ke database.");
+ }
+
+
+ }//GEN-LAST:event_btn_simpanActionPerformed
+
+ private void btn_tambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_tambahActionPerformed
+ // TODO add your handling code here:
+ if(BoxNama.getText().isEmpty()){
+ JOptionPane.showMessageDialog(null, "Nama Barang Belum di Masukan");
+ }else if(BoxHarga.getText().isEmpty()){
+ JOptionPane.showMessageDialog(null, "Harga Barang Belum di Masukan");
+ }else if(BoxJumlah.getText().isEmpty()){
+ JOptionPane.showMessageDialog(null, "Jumlah Barang Belum di Masukan");
+ }else{
+ insertData();
+ clear();
+ }
+
+ }//GEN-LAST:event_btn_tambahActionPerformed
+
+ private void btn_clearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_clearActionPerformed
+ // TODO add your handling code here:
+ clear();
+ }//GEN-LAST:event_btn_clearActionPerformed
+
+ private void btn_editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_editActionPerformed
+ // TODO add your handling code here
+ DefaultTableModel model = (DefaultTableModel) TabelProduk.getModel();
+ int rowSelect = TabelProduk.getSelectedRow();
+
+ if(btn_edit.getText()== "Edit"){
+ btn_tambah.setEnabled(false);
+ btn_delete.setEnabled(false);
+ btn_edit.setText("Update");
+
+ BoxNama.setText(model.getValueAt(rowSelect, 1).toString());
+ BoxHarga.setText(model.getValueAt(rowSelect, 2).toString());
+ BoxJumlah.setText(model.getValueAt(rowSelect, 3).toString());
+
+ }else {
+ btn_tambah.setEnabled(true);
+ btn_delete.setEnabled(true);
+ btn_edit.setText("Edit");
+
+ String name = BoxNama.getText();
+ String price = BoxHarga.getText();
+ String stock = BoxJumlah.getText();
+
+ model.setValueAt(name, rowSelect, 1);
+ model.setValueAt(price, rowSelect, 2);
+ model.setValueAt(stock, rowSelect, 3);
+ }
+ }//GEN-LAST:event_btn_editActionPerformed
+
+ private void btn_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_deleteActionPerformed
+ // TODO add your handling code here:
+ DefaultTableModel model = (DefaultTableModel) TabelProduk.getModel();
+ int rowSelect = TabelProduk.getSelectedRow();
+
+ if(rowSelect == -1){
+ JOptionPane.showMessageDialog(this, "Pilih baris yang ingin dihapus.",
+ "Error", JOptionPane.ERROR_MESSAGE);
+ } else {
+ int confirm = JOptionPane.showConfirmDialog(this, "Apakah anda yakin menghapus data ini?",
+ "Konfirmasi Pengahapusan Data",JOptionPane.YES_NO_OPTION);
+ if(confirm == JOptionPane.YES_OPTION){
+ model.removeRow(rowSelect);
+ }
+ }
+ }//GEN-LAST:event_btn_deleteActionPerformed
+
+ private void BoxTotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BoxTotalActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_BoxTotalActionPerformed
+
+ private void btn_bayarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_bayarActionPerformed
+ // TODO add your handling code here:
+ double total = hitungTotal();
+ BoxTotal.setText("Rp." + String.valueOf(total));
+
+ try {
+ String totalText = BoxTotal.getText().substring(3);
+ double total1 = Double.parseDouble(totalText);
+ double bayar = Double.parseDouble(BoxUang.getText());
+ double kembali = bayar - total1;
+ BoxKembalian.setText("Rp." + String.valueOf(kembali));
+
+ } catch (NumberFormatException e){
+ JOptionPane.showMessageDialog(this, "Input tidak Valid");
+ }
+ }//GEN-LAST:event_btn_bayarActionPerformed
+
+ private void BoxNamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BoxNamaActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_BoxNamaActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ try {
+ for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ javax.swing.UIManager.setLookAndFeel(info.getClassName());
+ break;
+ }
+ }
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(Kasirku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+
+ java.awt.EventQueue.invokeLater(() -> {
+ new Kasirku().setVisible(true);
+ });
+ }
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField BoxHarga;
+ private javax.swing.JTextField BoxJumlah;
+ private javax.swing.JTextField BoxKembalian;
+ private javax.swing.JTextField BoxNama;
+ private javax.swing.JTextField BoxTotal;
+ private javax.swing.JTextField BoxUang;
+ private javax.swing.JLabel LabelHarga;
+ private javax.swing.JLabel LabelJumlah;
+ private javax.swing.JLabel LabelKembalian;
+ private javax.swing.JLabel LabelNama;
+ private javax.swing.JLabel LabelTotal;
+ private javax.swing.JLabel LabelUang;
+ private javax.swing.JTable TabelProduk;
+ private javax.swing.JButton btn_bayar;
+ private javax.swing.JButton btn_clear;
+ private javax.swing.JButton btn_delete;
+ private javax.swing.JButton btn_edit;
+ private javax.swing.JButton btn_simpan;
+ private javax.swing.JButton btn_tambah;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
+ private javax.swing.JPanel jPanel4;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+}