Gambar ini adalah project sederhana saya yaitu membuat menu. Saya membuat program ini menggunakan bahasa pemrograman berbasis java
Jika anda tertarik dan ingin tau cara membutanya berikut saya lampirkan source kodenya
smoga bermanfaat sedikit ilmu yang saya bagikan.
baca selengkapnya...
Ini Source Kodenya untuk menampilkan tab-tab yang sudah di buat (tab.mahasiswa, tab wali, murid,dan tab login). Kode ini diletakkan pada tab utamanya (tempat pertama kali kita membuat design pada gambar di atas yang berbackground hitam adalah tab utaman)
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Login lo=new Login();
d1.add(lo);
lo.show();
}
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Mahasiswa ma=new Mahasiswa();
d1.add(ma);
ma.show();
}
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
WaliMurid wm=new WaliMurid();
d1.add(wm);
wm.show();
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int jawab = JOptionPane.showConfirmDialog(rootPane, "Anda yakin mau keluar?", "Konfirmasi", JOptionPane.YES_NO_CANCEL_OPTION);
if (jawab == JOptionPane.YES_OPTION){
System.exit(0);
}else{
}
Ini merupakan source kode dari tab.mahasiswa, pada tab mahasiswa di bagian source ketikkan kode-kode berikut ini
private void txtnamaKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if (evt.getKeyCode() == 10){
txtnrp.requestFocus();
}
}
private void txtnrpKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if (evt.getKeyCode() ==10){
txtjur.requestFocus();
}
}
private void btnresetActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
txtnama.setText("");
txtnrp.setText("");
txtjur.setText("");
}
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jRadioButton1.setSelected(true);
jRadioButton2.setSelected(false);
}
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jRadioButton1.setSelected(false);
jRadioButton2.setSelected(true);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
for (int a=1;a<=31;a++){
jComboBox1.addItem(a);
}
for (int b=1;b<=12;b++){
jComboBox2.addItem(b);
}
for (int c=1960;c<=2010;c++){
jComboBox3.addItem(c);
}
}
Ini merupakan source kode dari tab.wali murid, pada tab mahasiswa di bagian source ketikkan kode-kode berikut ini
private void txtnama2KeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if (evt.getKeyCode() == 10){
txtalamat.requestFocus();
}
}
private void txtalamatKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if (evt.getKeyCode() == 10){
txttlp.requestFocus();
}
}
private void btnreset2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
txtnama2.setText("");
txtalamat.setText("");
txttlp.setText("");
}
private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jRadioButton3.setSelected(true);
jRadioButton4.setSelected(false);
jRadioButton5.setSelected(false);
}
private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jRadioButton3.setSelected(false);
jRadioButton4.setSelected(true);
jRadioButton5.setSelected(false);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
for(int i=1;i<=31;i++){
jComboBox4.addItem(i);
}
for (int j=1;j<=12;j++){
jComboBox6.addItem(j);
}
for (int k=1945;k<=2010;k++){
jComboBox7.addItem(k);
}
}
private void jRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jRadioButton3.setSelected(false);
jRadioButton4.setSelected(false);
jRadioButton5.setSelected(true);
}


Tidak ada komentar:
Posting Komentar