Samiludin La ResiTugas&Praktik - PBO - Pertemuan10
Samiludin La ResiTugas&Praktik - PBO - Pertemuan10
Samiludin La ResiTugas&Praktik - PBO - Pertemuan10
Hari Kamis
Tanggal 14-12-1023
Ruang Zoom
Materi Jform
/**
* Creates new form Jform11
*/
public Jform11() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
tabel.addRow(new Object[] {
Nama_input.getText(),
Asal_input.getText(),
(String)Agama_input.getSelectedItem()
});
Tabel_Biodata.setModel(tabel);
Nama_input.setText("");
Asal_input.setText("");
}
private javax.swing.JComboBox<String> Agama_input;
private javax.swing.JTextField Asal_input;
private javax.swing.JTextField Nama_input;
private javax.swing.JTable Tabel_Biodata;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JScrollPane jScrollPane1;
int baris = 0;
static Object kolom[] = {"Nama", "Asal", "Agama"};
DefaultTableModel tabel = new DefaultTableModel(kolom, baris);
import javax.swing.table.DefaultTableModel;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
/**
*
* @author ACER
*/
public class SamiludinLR extends javax.swing.JFrame {
/**
* Creates new form SamiludinLR
*/
public SamiludinLR() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel4.setText("Tanggal");
Tanggal_input.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Tanggal_inputActionPerformed(evt);
}
});
jLabel2.setText("Nama Pemesan");
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Form Pemesanan Tiket Konser xxxtentacion");
Acara_input.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Acara_inputActionPerformed(evt);
}
});
jLabel3.setText("Cara Pembayaran");
jLabel5.setText("Jumlah Tiket");
jButton1.setText("ADD");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Delate");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
Table_Konser.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Nama Acara", "Tanggal", "Jumlah Tiket", "Cara Pembayaran"
}
){
boolean[] canEdit = new boolean [] {
false, false, true, false
};
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
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 ex) {
java.util.logging.Logger.getLogger(SamiludinLR.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(SamiludinLR.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(SamiludinLR.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(SamiludinLR.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>
2. Buat formulir pemesanan tiket acara dengan JForm di NetBeans. Formulir tersebut harus mencakup
input untuk nama acara, tanggal, jumlah tiket, dan cara pembayaran.
3. Lakukan penambahan pada tabel sebanyak 15 baris data dan Capture hasil project Anda