Minggu, 20 Maret 2011

Seri bahasa jawa: latihan



private void cmbKodeItemStateChanged(java.awt.event.ItemEvent evt) {
if (cmbKode.getSelectedIndex()==0) {
txtNama.setText("Avanza");
txtHarga.setText("35000");
}
if (cmbKode.getSelectedIndex()==1) {
txtNama.setText("Kijang Super");
txtHarga.setText("25000");
}
if (cmbKode.getSelectedIndex()==2) {
txtNama.setText("Toyota");
txtHarga.setText("45000");
}
}


private void rdCashMouseClicked(java.awt.event.MouseEvent evt) {
if (rdCash.isSelected()){
harga = Double.parseDouble(txtHarga.getText());
txtKredit.setText("0");
//dp = Integer.parseInt(txtKredit.getText());
total = harga;
txtTotal.setText(String.valueOf(total));
}
}

private void txtKreditKeyPressed(java.awt.event.KeyEvent evt) {
// if(rdKredit.isSelected()){
// harga = Double.parseDouble(txtHarga.getText());
// dp = Double.parseDouble(txtKredit.getText());
// total =(harga-dp);
// txtTotal.setText(String.valueOf(total));
// }

}

private void txtKreditKeyReleased(java.awt.event.KeyEvent evt) {
if(rdKredit.isSelected()){
harga = Double.parseDouble(txtHarga.getText());
dp = Double.parseDouble(txtKredit.getText());
total =(harga-dp);
txtTotal.setText(String.valueOf(total));
}

}

private void cmdHariActionPerformed(java.awt.event.ActionEvent evt) {
cmbKode.setSelectedIndex(0);
txtNama.setText("");
txtHarga.setText("");
txtHari.setText("");
txtKredit.setText("");
//rdCash.isSelected();
txtTotal.setText("");
}

Tidak ada komentar:

Home Again

Bismillah Waktunya pulang.. Alhamdulillah