Loan.java
Import javax.swing.*;
Import java.awt.*;
Import java.awt.event.*;
Import java.beans.*;
public class Loan extends JPanel implements ActionListener
{
JLabel ltype,lamount,lmonth,linstlmnt;
JTextField tamount,tmonth,tinstlmnt;
JList Ttype;
JButton submit;
String Loantype;
String[] interestrates={"5", "5", "4"};
Public string[] Getinterestrates ()
{
return interestrates;
}
public void Setinterestrates (string[] interestrates)
{
This.interestrates=interestrates;
}
Public Loan ()
{
Ltype=new JLabel ("Loan type:");
Lamount=new JLabel ("Loan Amount:");
Lmonth=new JLabel ("Number of loan months:");
Linstlmnt=new JLabel ("Monthly payable Amount:");
Tamount=new JTextField (10);
Tmonth=new JTextField (10);
Tinstlmnt=new JTextField (10);
String[] type={"housing", "Personal", "Car"};
Ttype=new JList (Type);
Submit=new JButton ("È?¶¨");
SetLayout (New GridLayout (5,2));
Add (Ltype); Add (Ttype);
Add (Lamount); Add (Tamount);
Add (lmonth); add (Tmonth);
Add (linstlmnt); add (TINSTLMNT);
Add (Submit);
Linstlmnt.setvisible (FALSE);
Tinstlmnt.setvisible (FALSE);
Submit.addactionlistener (this);
}
public void actionperformed (ActionEvent evt)
{
float intlmnt=0;
int carloan=0;
int personalloan=0;
int houseloan=0;
int amount;
int noofmonth;
JButton source= (JButton) Evt.getsource ();
Amount=integer.parseint (Tamount.gettext ());
Noofmonth=integer.parseint (Tmonth.gettext ());
Loantype = (String) ttype.getselectedvalue ();
Tinstlmnt.settext ("sample");
int amtpermonth=amount/noofmonth;
if (!) ( Interestrates[0]). Equals (""))
{
Carloan=integer.parseint (Interestrates[0]);
}
if (!) ( Interestrates[1]). Equals (""))
{
Personalloan=integer.parseint (Interestrates[1]);
}
if (!) ( Interestrates[2]). Equals (""))
{
Houseloan=integer.parseint (interestrates[2]);
}
Loantype= (String) ttype.getselectedvalue ();
if (Loantype.equals ("Personal"))
{
Intlmnt= (Personalloan*amount)/(100*noofmonth);
}
if (Loantype.equals ("housing"))
{
Intlmnt= (Houseloan*amount)/(100*noofmonth);
}
if (Loantype.equals ("Car"))
{
Intlmnt= (Carloan*amount)/(100*noofmonth);
}
Tinstlmnt.settext (string.valueof (intlmnt+amtpermonth));
Linstlmnt.setvisible (TRUE);
Tinstlmnt.setvisible (TRUE);
Tinstlmnt.setenabled (FALSE);
}
}
Loaneditor.java
Import java.beans.*;
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
public class Loaneditor extends JPanel implements Propertyeditor,actionlistener
{
JLabel Lcar,lpersonal,lhouse;
JTextField Tcar,tpersonal,thouse;
String[] interestrates={"", "" "," "};
JPanel Panel;
Public Object GetValue ()
{
Interestrates[0]=tcar.gettext ();
Interestrates[1]=tpersonal.gettext ();
Interestrates[2]=thouse.gettext ();
return interestrates;
}
public void SetValue (Object ctemp)
{
Interestrates= (string[]) ctemp;
Tcar.settext (Interestrates[0]);
Tpersonal.settext (Interestrates[1]);
Thouse.settext (interestrates[2]);
}
Public Component Getcustomeditor () {return this;}
Public Loaneditor ()
{
Lcar=new JLabel ("æû³µ´û¿î");
Lpersonal=new JLabel ("¸öèë´û¿î");
Lhouse=new JLabel ("? ¿îý´û¿î");
Tcar=new JTextField (10);
Tpersonal=new JTextField (10);
Thouse=new JTextField (10);
SetLayout (New BorderLayout ());
Panel=new JPanel ();
Panel.setlayout (New GridLayout (3,2));
Panel.add (Lcar); Panel.add (Tcar);
Panel.add (lpersonal); Panel.add (tpersonal);
Panel.add (Lhouse); Panel.add (Thouse);
Add (New JPanel (), borderlayout.west);
Add (New JPanel (), borderlayout.east);
Add (Panel,borderlayout.center);
Tcar.addactionlistener (this);
Tpersonal.addactionlistener (this);
Thouse.addactionlistener (this);
}
public void actionperformed (ActionEvent evt)
{
Interestrates[0]=tcar.gettext ();
Interestrates[1]=tpersonal.gettext ();
Interestrates[2]=thouse.gettext ();
}
public Boolean ispaintable () {return true;}
public void PaintValue (Graphics g,rectangle r) {}
Public String getjavainitializationstring () {return null;}
Public String Getastext () {return null;}
public void Setastext (String s) throws
illegalargumentexception{}
Public string[] GetTags () {return null;}
public Boolean supportscustomeditor () {return true;}
}
Loanbeaninfo.java
Import java.beans.*;
Import java.awt.*;
public class Loanbeaninfo extends Simplebeaninfo
{
Public propertydescriptor[] Getpropertydescriptors ()
{
Try
{
PropertyDescriptor interestrates=new PropertyDescriptor ("Interestrates", Loan.class);
Interestrates.setpropertyeditorclass (Loaneditor.class);
PropertyDescriptor arr[]=new propertydescriptor[1];
Arr[0]=interestrates;
return arr;
}
catch (Exception e)
{
System.out.println (e);
return null;
}
}
}
Loan.mft
Name:Loan.class
Java-bean:true
Name:LoanEditor.class
Java-bean:false
Name:LoanBeanInfo.class
Java-bean:false
Packaging program jar CVFM Loan.jar loan.mft *.class