Assalamualaikum
W.r W.b
Nama :
Deal Raajudwi Dermawan
NIM :
161011400142
Kelas : 02TPLP001
Untuk
Tugas Kali ini yang ingin saya bahas adalah bagaimana membuat Form Aplikasi
Penjualan Tiket Kereta Api menggunakan Bahasa Pemrograman Java NetBeans. sudah jangan
berbelit belit sok monggo langgung kita praktekkan.
Buat database seperti gambar dibawah
ini :
Untuk
awal design Form Aplikasi Jawa Swing Gui pada Netbeans sebagai berikut :
design Form aplikasi penjualan tiket
kereta api seperti yang diatas
Berikut
ini adalah listing Kodenya : saya jabarkan satu persatu agar temen temen bisa memahami
dan gak pusing ngeliatnya.
package Koneksi
> Jframe Daftar dan List
Package Tiket
> class conek
1.Source Code “conek”
/*
* To change this license header, choose
License Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package Tiket;
import
com.mysql.jdbc.Driver;
import
java.sql.DriverManager;
import
java.sql.Connection;
import
java.sql.DriverManager;
import
java.sql.SQLException;
/**
*
* @author awien
*/
public class
conek {
public static Connection koneksi;
public static Connection GetConnection()throws
SQLException {
if(koneksi==null){
new Driver();
koneksi=DriverManager.getConnection("jdbc:mysql://localhost/dbkereta","root","");
}
return koneksi;
}
}
2. Source Code “Daftar”
/*
* To change this license header, choose
License Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package
koneksi;
import
com.mysql.jdbc.Statement;
import
java.sql.DriverManager;
import
java.sql.Connection;
import
java.sql.ResultSet;
import
java.sql.SQLException;
import
javax.swing.JOptionPane;
import
Tiket.conek;
import
javax.swing.table.DefaultTableModel;
/**
*
* @author awien
*/
public class Daftar
extends javax.swing.JFrame {
int jurusan;
int harga;
int beli;
int total;
int hekonomi,hbisnis;
/**
* Creates new form Daftar
*/
public Daftar() {
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() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
Txt1 = new javax.swing.JTextField();
cmbkode = new
javax.swing.JComboBox<>();
Txt2 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
cmbjurusan = new
javax.swing.JComboBox<>();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
Txt3 = new javax.swing.JTextField();
Txt4 = new javax.swing.JTextField();
Txt5 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
CB3 = new
javax.swing.JComboBox<>();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Nama");
jLabel2.setText("Kode
Kereta");
jLabel3.setText("Nama
Kereta");
cmbkode.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "------",
"KRL001", "KRL002", "KRL003" }));
cmbkode.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
cmbkodeActionPerformed(evt);
}
});
jLabel4.setText("Jurusan");
cmbjurusan.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
cmbjurusanActionPerformed(evt);
}
});
jLabel5.setText("Jenis
Tiket");
jLabel6.setText("Harga");
jLabel7.setText("Jumlah
Beli");
jLabel8.setText("Total");
jButton1.setText("Beli");
jButton1.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
CB3.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "------",
"Ekonomi", "Bisnis" }));
CB3.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
CB3ActionPerformed(evt);
}
});
jButton2.setText("Cek Data");
jButton2.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Exit");
jButton3.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel7)
.addComponent(jLabel6)
.addComponent(jLabel5)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(43, 43, 43)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(33, 33, 33)
.addComponent(jLabel8)
.addGap(18, 18, 18)
.addComponent(Txt5,
javax.swing.GroupLayout.PREFERRED_SIZE, 78,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(79, 79, 79)
.addComponent(jButton2)
.addGap(18, 18, 18)
.addComponent(jButton3))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addComponent(Txt3,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
.addComponent(Txt4,
javax.swing.GroupLayout.Alignment.LEADING))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addComponent(CB3,
javax.swing.GroupLayout.Alignment.LEADING, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmbjurusan, javax.swing.GroupLayout.Alignment.LEADING, 0,
100, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addComponent(Txt2,
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cmbkode,
javax.swing.GroupLayout.Alignment.LEADING, 0, 145, Short.MAX_VALUE)
.addComponent(Txt1,
javax.swing.GroupLayout.Alignment.LEADING)))
.addContainerGap(51,
Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(Txt1,
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(jLabel2)
.addComponent(cmbkode,
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.LEADING)
.addComponent(jLabel3)
.addComponent(Txt2,
javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(cmbjurusan,
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(jLabel5)
.addComponent(CB3,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(Txt3,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(Txt4,
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(jLabel8)
.addComponent(Txt5,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3))
.addContainerGap(48,
Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void
cmbjurusanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(cmbjurusan.getSelectedItem().equals("---- JURUSAN ----")){
}else
if(cmbjurusan.getSelectedItem().equals("PASAR SENEN - SOLO")){
hekonomi=70000;
hbisnis=120000;
Txt3.setText(""+hekonomi);
Txt3.setText(""+hbisnis);
}else
if(cmbjurusan.getSelectedItem().equals("PASAR SENEN - BANDUNG")){
hekonomi=75000;
hbisnis=245000;
Txt3.setText(""+hekonomi);
Txt3.setText(""+hbisnis);
}
else
if(cmbjurusan.getSelectedItem().equals("GAMBIR - YOGYAKARTA")){
hekonomi=70000;
hbisnis=300000;
Txt3.setText(""+hekonomi);
Txt3.setText(""+hbisnis);
}
else
if(cmbjurusan.getSelectedItem().equals("GAMBIR - SURABAYA")){
hekonomi=75000;
hbisnis=275000;
Txt3.setText(""+hekonomi);
Txt3.setText(""+hbisnis);
}
else
if(cmbjurusan.getSelectedItem().equals("GAMBIR-KUTOARJO")){
hekonomi=50000;
hbisnis=100000;
Txt3.setText(""+hekonomi);
Txt3.setText(""+hbisnis);
}
else
if(cmbjurusan.getSelectedItem().equals("GAMBIR-LEMPUYANGAN")){
hekonomi=95000;
hbisnis=1550000;
Txt3.setText(""+hekonomi);
Txt3.setText(""+hbisnis);
}
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
harga=Integer.parseInt(Txt3.getText());
beli=Integer.parseInt(Txt4.getText());
total=beli*harga;
Txt5.setText(String.valueOf(total));
String nama=Txt1.getText();
String namakereta=Txt2.getText();
String
kodekereta=(String)cmbkode.getSelectedItem();
String harga=Txt3.getText();
String jumalhbeli=Txt4.getText();
String total=Txt5.getText();
String
jurusan=(String)cmbjurusan.getSelectedItem();
String
jenistiket=(String)CB3.getSelectedItem();
try{
Statement sta =(Statement)
conek.GetConnection().createStatement();
sta.executeUpdate("INSERT INTO
tiket
VALUES('"+nama+"','"+namakereta+"','"+jenistiket+"','"+kodekereta+"','"+harga+"','"+jumalhbeli+"','"+total+"','"+jurusan+"')");
JOptionPane.showMessageDialog(null,"Data telah tersimpan silahkan Check
untuk melihat data");
}catch(Exception e){
JOptionPane.showMessageDialog(null,"Terjadi kesalahan");
}
}
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new List().show();
dispose();
}
private void
cmbkodeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(cmbkode.getSelectedItem().equals("KRL001")){
Txt2.setText("AMBARAWA");
cmbjurusan.removeAllItems();
cmbjurusan.addItem("---- JURUSAN
----");
cmbjurusan.addItem("PASAR SENEN -
SOLO");
cmbjurusan.addItem("PASAR SENEN -
BANDUNG");
}
else
if(cmbkode.getSelectedItem().equals("KRL002")){
Txt2.setText("BRANTAS");
cmbjurusan.removeAllItems();
cmbjurusan.addItem("---- JURUSAN
----");
cmbjurusan.addItem("GAMBIR -
YOGYAKARTA");
cmbjurusan.addItem("GAMBIR -
SURABAYA");
}
else
if(cmbkode.getSelectedItem().equals("KRL003")){
Txt2.setText("BENGAWAN");
cmbjurusan.removeAllItems();
cmbjurusan.addItem("---- JURUSAN
----");
cmbjurusan.addItem("GAMBIR-KUTOARJO");
cmbjurusan.addItem("GAMBIR-LEMPUYANGAN");
}
else
if(cmbkode.getSelectedItem().equals("---- Pilih Kode ----")){
Txt2.setText("");
cmbjurusan.removeAllItems();
}
}
private void
CB3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
dispose();
}
/**
* @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(Daftar.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Daftar.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Daftar.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch
(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Daftar.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new
Runnable() {
public void run() {
new Daftar().setVisible(true);
}
});
}
// Variables declaration - do not
modify
private javax.swing.JComboBox<String>
CB3;
private javax.swing.JTextField Txt1;
private javax.swing.JTextField Txt2;
private javax.swing.JTextField Txt3;
private javax.swing.JTextField Txt4;
private javax.swing.JTextField Txt5;
private javax.swing.JComboBox<String>
cmbjurusan;
private javax.swing.JComboBox<String>
cmbkode;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
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.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
// End of variables declaration
}
3. Source Code “List”
/*
* To change this license header, choose
License Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package
koneksi;
import
com.mysql.jdbc.Statement;
import
java.sql.DriverManager;
import
java.sql.Connection;
import
java.sql.ResultSet;
import
java.sql.SQLException;
import
javax.swing.JOptionPane;
import
Tiket.conek;
import
javax.swing.table.DefaultTableModel;
/**
*
* @author awien
*/
public class
List extends javax.swing.JFrame {
/**
* Creates new form List
*/
public List() {
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() {
jScrollPane1 = new
javax.swing.JScrollPane();
table = new javax.swing.JTable();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
table.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 [] {
"Title 1",
"Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(table);
jButton2.setText("Refresh");
jButton2.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Keluar");
jButton3.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton1.setText("Kembali");
jButton1.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.DEFAULT_SIZE, 801, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jButton2)
.addGap(26, 26, 26)
.addComponent(jButton3)
.addGap(0, 0,
Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton3)
.addComponent(jButton1))
.addGap(46, 46, 46)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 187,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
DefaultTableModel tbl = new
DefaultTableModel();
tbl.addColumn("Nama");
tbl.addColumn("Nama Kereta");
tbl.addColumn("Kode Kereta");
tbl.addColumn("Jurusan");
tbl.addColumn("Jenis Tiket");
tbl.addColumn("Harga");
tbl.addColumn("Jumlah Beli");
tbl.addColumn("Total");
table.setModel(tbl);
try{
Statement sta=(Statement)
conek.GetConnection().createStatement();
ResultSet
res=sta.executeQuery("SELECT * FROM tiket");
while(res.next())
{
tbl.addRow(new Object[]{
res.getString("nama"),
res.getString("kodekereta"),
res.getString("namakereta"),
res.getString("jurusan"),
res.getString("jenistiket"),
res.getString("harga"),
res.getString("jumalhbeli"),
res.getString("total")
});
table.setModel(tbl);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null,"Terjadi
Kesalahan saat menampilkan data");
}
}
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
dispose();
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new Daftar().show();
dispose();
}
/**
* @param args the command line arguments
*/
public void datatable(){
DefaultTableModel tbl = new
DefaultTableModel();
tbl.addColumn("Nama");
tbl.addColumn("Nama Kereta");
tbl.addColumn("Kode Kereta");
tbl.addColumn("Jurusan");
tbl.addColumn("Jenis Tiket");
tbl.addColumn("Harga");
tbl.addColumn("Jumlah Beli");
tbl.addColumn("Total");
table.setModel(tbl);
try{
Statement sta=(Statement)
conek.GetConnection().createStatement();
ResultSet
res=sta.executeQuery("SELECT * FROM tiket");
while(res.next())
{
tbl.addRow(new Object[]{
res.getString("nama"),
res.getString("kodekereta"),
res.getString("namakereta"),
res.getString("jurusan"),
res.getString("jenistiket"),
res.getString("harga"),
res.getString("jumalhbeli"),
res.getString("total")
});
table.setModel(tbl);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null,"Terjadi Kesalahan saat
menampilkan data");
}
}
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(List.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(List.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(List.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch
(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(List.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new
Runnable() {
public void run() {
new List().setVisible(true);
}
});
}
// Variables declaration - do not
modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JScrollPane
jScrollPane1;
private javax.swing.JTable table;
// End of variables declaration
}
Jika sudah Run Aplikasi dengan cara
Shift + f6
Maka Akan
muncul tampilan dibawah ini :
From List
Nah
selesai sudah tugas saya kali ini, mohon maaf ada kesalahan dalam menjelaskan
program yang diatas in, semoga tidak mengecewakan Dosen saya, . Baiklah temen
Temen semua semoga menginspirasi dan berguna untuk temen temen yang sedang
belajar.
Wassalamualaikum
w.r w.b