Class 12 Practical File Ip (Information Practices
Class 12 Practical File Ip (Information Practices
Class 12 Practical File Ip (Information Practices
If Post Graduate is checked, the 10+2 & Graduate checkboxes should also get
selected automatically.
If Graduate is checked, the 10+2 checkbox should also get selected.
A Message Box with Hello Mr. .. you are registered or Hello Miss .. you are
registered as per Gender of candidate.
2. When Clear Button is pressed, all the text boxes, check boxes get
cleared, & Male and Science option is selected by default.
import javax.swing.JOptionPane;
private void submitBTNActionPerformed(java.awt.event.ActionEvent evt) {
String str ="Miss ",name=nameTF.getText();
if(postgradCB.isSelected()){
gradCB.setSelected(true);
tenplusCB.setSelected(true);
}
if(gradCB.isSelected())
tenplusCB.setSelected(true);
if(maleRB.isSelected())
if(maleRB.isSelected())
str="Mr.";
JOptionPane.showMessageDialog(this,"Hello "+str+name+"!! You are registered.");// TODO add your handling
code here:
}
private void clearBTNActionPerformed(java.awt.event.ActionEvent evt) {
nameTF.setText(null);
sciRB.setSelected(true);
maleRB.setSelected(true);
tenplusCB.setSelected(false);
gradCB.setSelected(false);
postgradCB.setSelected(false);// TODO add your handling code here:
}
4. When Clear Button is clicked, all the text boxes get cleared & Male
option is selected.
import javax.swing.JOptionPane;
private void caldiscountBTNActionPerformed(java.awt.event.ActionEvent evt) {
int index=modeCB.getSelectedIndex();
double discount=0.05,billamt=Double.parseDouble(billamtTF.getText());
if(index==0)
discount=0.1;
if(index==1)
discount=0.08;
if(billamt>10000)
discount+=0.05;
discountTF.setText(""+(discount*billamt));
calnetamtBTN.setEnabled(true);// TODO add your handling code here:
}
private void calnetamtBTNActionPerformed(java.awt.event.ActionEvent evt) {
double billamt=Double.parseDouble(billamtTF.getText());
double discount=Double.parseDouble(discountTF.getText());
netamtTF.setText(""+(billamt-discount));// TODO add your handling code here:
}
private void exitBTNActionPerformed(java.awt.event.ActionEvent evt) {
int ans=JOptionPane.showConfirmDialog(this,"Are you sure you want to exit?");
if(ans==0)
System.exit(0);// TODO add your handling code here:
}
import javax.swing.JOptionPane;
private void closeBTNActionPerformed(java.awt.event.ActionEvent evt) {
int ans=JOptionPane.showConfirmDialog(this,"Are you sure you want to exit?");
if(ans==0)
System.exit(0);// TODO add your handling code here:
}
private void calBTNActionPerformed(java.awt.event.ActionEvent evt) {
double rate=1000,discount=0.05;
int seat=Integer.parseInt(seatsTF.getText());
if(stallsRB.isSelected())
rate=625;
else if(circleRB.isSelected())
rate=750;
else if(upclassRB.isSelected())
rate=850;
if(cashRB.isSelected())
discount=0.1;
totalamtTF.setText("Rs. "+(rate*seat));
discountTF.setText("Rs. "+(rate*seat*discount));
netamtTF.setText("Rs. "+(rate*seat*(1-discount)));// TODO add your handling code here:
}
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
private void clearlistBTNActionPerformed(java.awt.event.ActionEvent evt) {
colorL.removeAll();// TODO add your handling code here:
}
private void closeBTNActionPerformed(java.awt.event.ActionEvent evt) {
int ans=JOptionPane.showConfirmDialog(this,"Are you sure you want to exit?");
if(ans==0)
System.exit(0);// TODO add your handling code here:
}
private void addBTNActionPerformed(java.awt.event.ActionEvent evt) {
DefaultListModel model=(DefaultListModel)colorL.getModel();
String add=addTF.getText();
model.addElement(add);// TODO add your handling code here:
}
private void removeBTNActionPerformed(java.awt.event.ActionEvent evt) {
DefaultListModel model=(DefaultListModel)colorL.getModel();
String remove=removeTF.getText();
model.removeElement(remove);// TODO add your handling code here:
}
private void colorLValueChanged(javax.swing.event.ListSelectionEvent evt) {
selectionTF.setText(colorL.getSelectedValue());// TODO add your handling code here:
}