public class test extends javax.swing.JFrame {
/**
* Creates new form test
*/
public test() {
initComponents();
for(int i=1;i<32;i++){
cmbTanggal.addItem(""+i);
}
for(int i=1;i<13;i++){
cmbBulan.addItem(""+i);
}
for(int i=1900;i<2000;i++){
cmbTahun.addItem(""+i);
}
}
/**
*
*/
public void total(int golongan){
float total=0;
int defaultTotal=2000000;
if (golongan==1){
total=defaultTotal;
}else if (golongan==2){
total=defaultTotal+200000;
}else{
total=defaultTotal+300000;
}
txtTotal.setText(""+total);
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
txtNama = new javax.swing.JTextField();
cmbTanggal = new javax.swing.JComboBox();
cmbBulan = new javax.swing.JComboBox();
cmbTahun = new javax.swing.JComboBox();
jek1 = new javax.swing.JRadioButton();
jek2 = new javax.swing.JRadioButton();
berenang = new javax.swing.JCheckBox();
badminton = new javax.swing.JCheckBox();
sepakBola = new javax.swing.JCheckBox();
bolaVoli = new javax.swing.JCheckBox();
bolaBasket = new javax.swing.JCheckBox();
game = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
gol1 = new javax.swing.JRadioButton();
gol2 = new javax.swing.JRadioButton();
gol3 = new javax.swing.JRadioButton();
jLabel7 = new javax.swing.JLabel();
txtTotal = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
exitMenu = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
jLabel1.setText("Formulir Pendaftaran Siswa Baru");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel2.setText("Nama");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel3.setText("Jenis Kelamin");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setText("Hobi");
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel5.setText("Tanggal Lahir");
cmbTanggal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmbTanggalActionPerformed(evt);
}
});
buttonGroup1.add(jek1);
jek1.setText("Laki laki");
buttonGroup1.add(jek2);
jek2.setText("Perempuan");
berenang.setText("Berenang");
badminton.setText("Badminton");
sepakBola.setText("Sepak Bola");
bolaVoli.setText("Bola Voli");
bolaBasket.setText("Bola Basket");
game.setText("Bermain Game");
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setText("Golongan");
buttonGroup2.add(gol1);
gol1.setText("Golongan 1");
gol1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gol1ActionPerformed(evt);
}
});
buttonGroup2.add(gol2);
gol2.setText("Golongan 2");
gol2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gol2ActionPerformed(evt);
}
});
buttonGroup2.add(gol3);
gol3.setText("Golongan 3");
gol3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gol3ActionPerformed(evt);
}
});
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setText("Total");
txtTotal.setEditable(false);
txtTotal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtTotalActionPerformed(evt);
}
});
jButton1.setText("Submit");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jMenu1.setText("File");
exitMenu.setText("exit");
exitMenu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuActionPerformed(evt);
}
});
jMenu1.add(exitMenu);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(140, 140, 140)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel2)))
.addGap(60, 60, 60)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNama, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(cmbTanggal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(cmbBulan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(cmbTahun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jek1)
.addGap(18, 18, 18)
.addComponent(jek2))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(berenang)
.addComponent(bolaVoli))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(badminton)
.addComponent(bolaBasket))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(game)
.addComponent(sepakBola)))
.addGroup(layout.createSequentialGroup()
.addComponent(gol1)
.addGap(18, 18, 18)
.addComponent(gol2)
.addGap(18, 18, 18)
.addComponent(gol3))
.addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 529, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(130, 130, 130)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jLabel6)
.addComponent(jButton1))))
.addContainerGap(148, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(45, 45, 45)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtNama, 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(cmbTanggal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbBulan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbTahun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jek1)
.addComponent(jek2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(berenang)
.addComponent(badminton)
.addComponent(sepakBola))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bolaVoli)
.addComponent(bolaBasket)
.addComponent(game))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(gol1)
.addComponent(gol2)
.addComponent(gol3))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void exitMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuActionPerformed
System.exit(0);
}//GEN-LAST:event_exitMenuActionPerformed
private void cmbTanggalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTanggalActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cmbTanggalActionPerformed
private void txtTotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTotalActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtTotalActionPerformed
private void gol1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gol1ActionPerformed
total(1);
}//GEN-LAST:event_gol1ActionPerformed
private void gol2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gol2ActionPerformed
total(2);
}//GEN-LAST:event_gol2ActionPerformed
private void gol3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gol3ActionPerformed
total(3);
}//GEN-LAST:event_gol3ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
JOptionPane.showMessageDialog(null,"Data Berhasil dimasukkan");
txtNama.setText("");
berenang.setSelected(false);
bolaVoli.setSelected(false);
sepakBola.setSelected(false);
bolaBasket.setSelected(false);
badminton.setSelected(false);
game.setSelected(false);
jek1.setSelected(true);
gol1.setSelected(true);
txtTotal.setText("");
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @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(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(test.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 test().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox badminton;
private javax.swing.JCheckBox berenang;
private javax.swing.JCheckBox bolaBasket;
private javax.swing.JCheckBox bolaVoli;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JComboBox cmbBulan;
private javax.swing.JComboBox cmbTahun;
private javax.swing.JComboBox cmbTanggal;
private javax.swing.JMenuItem exitMenu;
private javax.swing.JCheckBox game;
private javax.swing.JRadioButton gol1;
private javax.swing.JRadioButton gol2;
private javax.swing.JRadioButton gol3;
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.JLabel jLabel7;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JRadioButton jek1;
private javax.swing.JRadioButton jek2;
private javax.swing.JCheckBox sepakBola;
private javax.swing.JTextField txtNama;
private javax.swing.JTextField txtTotal;
// End of variables declaration//GEN-END:variables
}
Leonardo's Blog
Tuesday, May 6, 2014
Friday, October 5, 2012
Tugas Pak Agus algoritma Sessi 2
1.Flow Chart
2. Coding with JAVA
import java.util.Scanner;
class volumeKubus
{
public static void main(String[] args)
{
Scanner obj=new Scanner (System.in);
System.out.println("Masukkan Sisinya!");
int Sisi=obj.nextInt();
int Volume=(Sisi*Sisi*Sisi);
System.out.println("Volume Kubus nya adalah "+Volume+"");
System.out.println("Terima kasih telah mencoba");
}
};
Subscribe to:
Posts (Atom)