Saya disini menjelaskan cara untuk membuat Aplikasi
RENATAL MOBIL sederhana menggunakan Netbeans , berikut dibawah ini tahapan-tahapan
pengerjaan nya dan atribut yang di gunakan :
·
Combo Box
·
Menu Bar
·
Radio Button
·
Check Box
1. Untuk projec yang saya buat tampilannya seperti
gambar berikut
2. membuat frame Login Tampilannya seperti gambar di bawah
Sourse code Pada Buton Login
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String user = "LexyLumiling";
String pas = "161011400103";
String username = usser.getText();
String pasword = pass.getText();
if (username.equals(user) && pasword.equals(pas)) {
this.setVisible(false);
new Data_Mobil().setVisible(true);
} else {
javax.swing.JOptionPane.showMessageDialog(null, "Maaf user atau "
+ "password anda salah");
usser.setText("");
pass.setText("");
usser.requestFocus();
}
}
3. membuat frame Data_Mobil Tampilannya seperti gambar
di bawah
Sourse code Pada pilihan mobil
-
AVANZA
private void AvanzaMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
a1.setText("001");
b1.setText("AVANZA");
c1.setText("Rp 500.000 /
hari");
}
-
INOVA
private void InovaMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
a2.setText("002");
b2.setText("INOVA");
c2.setText("Rp 550.000 /
hari");
}
-
FORTUNER
private void
jCheckBox1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
a3.setText("001");
b3.setText("FORTUNER");
c3.setText("Rp 600.000 /
hari");
}
Sourse
code Pada Buton Simpan
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
new
Data_Peminjam().show();
}
Sourse
code Pada Buton Hapus
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
a1.setText(" ");
a2.setText(" ");
a3.setText("
");
b1.setText(" ");
b2.setText(" ");
b3.setText(" ");
c1.setText(" ");
c2.setText(" ");
c3.setText(" ");
}
4. Membuat frame Data_Peminjam Tampilannya seperti gambar di bawah
Sourse
code Pada Buton Hitung
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
int a1 =
Integer.parseInt(tarif.getText());
int a2 =
Integer.parseInt(hari.getText());
int
total1 = a1*a2;
total.setText(" "+total1);
}
Sourse
code Pada Buton Hapus
private void
BtnHapusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
nama.setText(" ");
pria.setSelected(false);
wanita.setSelected(false);
alamat.setText(" ");
hari.setText(" ");
tarif.setText(" ");
total.setText(" ");
hp.setText(" ");
}
Sourse
code Pada Buton Simpan
private void
BtnSimpanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
JOptionPane.showMessageDialog(rootPane,"Data
Tesimpan");
}
Sourse
code Pada Buton Keluar
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO
add your handling code here:
if
(JOptionPane.showConfirmDialog(null,
"Anda Yakin?","Confirmation Dialog",
JOptionPane.YES_NO_OPTION)==
JOptionPane.YES_OPTION){
System.exit(0);
}
}
5.
membuat frame menu utama “Rental_Mobil” Tampilannya seperti gambar di bawah
Sourse
code pada menu Login untuk memanggil tampilan frame “Login”
private void
Menu_LoginActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Login Flogin =new Login();
Flogin.setLocationRelativeTo(Flogin);
Flogin.setVisible(true);
}
Sourse
code untuk menu Close
private void
MenuCloseActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
dispose();
}
Sourse
code pada menu Data Mobil untuk memanggil tampilan frame “Data_Mobil”
private void
MenuDataMobilActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Data_Mobil Fmobil =new Data_Mobil();
Fmobil.setLocationRelativeTo(Fmobil);
Fmobil.setVisible(true);
Sourse
code pada menu Data Peminjam untuk memanggil tampilan frame “Data_Peminjam”
private void
MenuDataPeminjamActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Data_Peminjam Fmobil =new
Data_Peminjam();
Fmobil.setLocationRelativeTo(Fmobil);
Fmobil.setVisible(true);
}