SCRIPT :
/*
* To change this
template, choose Tools | Templates
* and open the
template in the editor.
*/
/*
* tugas_java.java
*
* Created on Apr 21,
2012, 8:39:39 AM
*/
/**
*
* @author Chitra Poespa Prihartini
*/
public class tugas_java extends javax.swing.JFrame {
/** Creates new
form tugas_java */
public
tugas_java() {
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() {
buttonGroup1 =
new javax.swing.ButtonGroup();
jPanel1 = new
javax.swing.JPanel();
jLabel1 = new
javax.swing.JLabel();
jLabel2 = new
javax.swing.JLabel();
jTharga = new
javax.swing.JTextField();
jComboBox1 =
new javax.swing.JComboBox();
jPanel2 = new
javax.swing.JPanel();
jCheckBox1 =
new javax.swing.JCheckBox();
jCheckBox2 =
new javax.swing.JCheckBox();
jCheckBox3 =
new javax.swing.JCheckBox();
jTjog = new
javax.swing.JTextField();
jTswim = new
javax.swing.JTextField();
jTgym = new
javax.swing.JTextField();
jPanel3 = new
javax.swing.JPanel();
jRadioButton1
= new javax.swing.JRadioButton();
jRadioButton2
= new javax.swing.JRadioButton();
jTbay = new
javax.swing.JTextField();
jLabel3 = new
javax.swing.JLabel();
jTtot = new
javax.swing.JTextField();
jButton1 = new
javax.swing.JButton();
jButton2 = new
javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Data
Rumah"));
jLabel1.setText("Lokasi");
jLabel2.setText("Harga Dasar");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"Blok A", "Blok B", "Blok C" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(84, 84, 84)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jTharga, javax.swing.GroupLayout.DEFAULT_SIZE, 127,
Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTharga, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Fasilitas
Rumah"));
jCheckBox1.setText("Jogging Track");
jCheckBox1.addActionListener(new
java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
jCheckBox2.setText("Swimming Pool");
jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox2ActionPerformed(evt);
}
});
jCheckBox3.setText("Gymnasium");
jCheckBox3.addActionListener(new java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox3ActionPerformed(evt);
}
});
javax.swing.GroupLayout
jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox1)
.addComponent(jCheckBox2)
.addComponent(jCheckBox3))
.addGap(73, 73, 73)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(jTgym)
.addComponent(jTswim)
.addComponent(jTjog, javax.swing.GroupLayout.DEFAULT_SIZE, 73,
Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox1)
.addComponent(jTjog, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox2)
.addComponent(jTswim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox3)
.addComponent(jTgym, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Cara
Pembayaran"));
buttonGroup1.add(jRadioButton1);
jRadioButton1.setText("Bank Mandiri");
jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
buttonGroup1.add(jRadioButton2);
jRadioButton2.setText("Other Bank");
jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82,
Short.MAX_VALUE)
.addComponent(jTbay, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jRadioButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jRadioButton2))
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTbay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
);
jLabel3.setText("Total");
jButton1.setText("BERSIH");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("KELUAR");
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)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel3)
.addGap(113, 113, 113)
.addComponent(jTtot, javax.swing.GroupLayout.PREFERRED_SIZE, 76,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(89, 89, 89))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addContainerGap()))))
.addGroup(layout.createSequentialGroup()
.addGap(89,
89, 89)
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jButton2)
.addContainerGap(119, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTtot,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addContainerGap(16, Short.MAX_VALUE))
);
pack();
}//
</editor-fold>
private void
jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
if
(jComboBox1.getSelectedItem().equals("Blok A"))
{
jTharga.setText("2000000");
}
else if
(jComboBox1.getSelectedItem().equals("Blok B"))
{
jTharga.setText("3000000");
}
else
{
jTharga.setText("4000000");
}
}
private void
jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
int
a,b,c,d,e,f;
if(jRadioButton1.isSelected())
{
jTbay.setText("10000");
}
a=Integer.parseInt(jTharga.getText());
b=Integer.parseInt(jTjog.getText());
c=Integer.parseInt(jTswim.getText());
d=Integer.parseInt(jTgym.getText());
e=Integer.parseInt(jTbay.getText());
f=a+b+c+d+e;
String
hasil=String.valueOf(f);
jTtot.setText(hasil);
}
private void
jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
int
a,b,c,d,e,f;
if(jRadioButton2.isSelected())
{
jTbay.setText("50000");
}
a=Integer.parseInt(jTharga.getText());
b=Integer.parseInt(jTjog.getText());
c=Integer.parseInt(jTswim.getText());
d=Integer.parseInt(jTgym.getText());
e=Integer.parseInt(jTbay.getText());
f=a+b+c+d+e;
String
hasil=String.valueOf(f);
jTtot.setText(hasil);
}
private void
jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
if(jCheckBox1.isSelected())
{
jTjog.setText("100000");
}
}
private void
jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
if(jCheckBox2.isSelected())
{
jTswim.setText("200000");
}
}
private void
jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
if(jCheckBox3.isSelected())
{
jTgym.setText("300000");
}
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
jTharga.setText("");
jTjog.setText("");
jTswim.setText("");
jTgym.setText("");
jTbay.setText("");
jTtot.setText("");
jRadioButton1.isSelected();
}
/**
* @param args the
command line arguments
*/
public static void
main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public
void run() {
new
tugas_java().setVisible(true);
}
});
}
// Variables
declaration - do not modify
private
javax.swing.ButtonGroup buttonGroup1;
private
javax.swing.JButton jButton1;
private
javax.swing.JButton jButton2;
private javax.swing.JCheckBox
jCheckBox1;
private
javax.swing.JCheckBox jCheckBox2;
private
javax.swing.JCheckBox jCheckBox3;
private
javax.swing.JComboBox jComboBox1;
private
javax.swing.JLabel jLabel1;
private
javax.swing.JLabel jLabel2;
private
javax.swing.JLabel jLabel3;
private
javax.swing.JPanel jPanel1;
private
javax.swing.JPanel jPanel2;
private
javax.swing.JPanel jPanel3;
private
javax.swing.JRadioButton jRadioButton1;
private
javax.swing.JRadioButton jRadioButton2;
private
javax.swing.JTextField jTbay;
private
javax.swing.JTextField jTgym;
private
javax.swing.JTextField jTharga;
private
javax.swing.JTextField jTjog;
private
javax.swing.JTextField jTswim;
private
javax.swing.JTextField jTtot;
// End of variables declaration
}