1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| package client;
import hw.AmortissementRemote;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.Color;
import java.util.Properties;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Amortissement extends JApplet {
private JTextField textField;
private JTextField textField_4;
/**
* Create the applet.
*/
public Amortissement() {
getContentPane().setLayout(null);
JLabel lblNewLabel = new JLabel("Votre Tableau d'amortissement");
lblNewLabel.setFont(new Font("Arial Black", Font.BOLD, 14));
lblNewLabel.setBounds(0, 0, 306, 14);
getContentPane().add(lblNewLabel);
JLabel lblretrouverLeDtail = new JLabel("<html>Retrouver <bold> le d\u00E9tail de vos remboursements sur toutes la dur\u00E9e de vos pr\u00EAs immobilier .</bold>Un \u00E9cch\u00E9ancier annuel et mensuel qui met en \u00E9vidence l'\u00E9volutiondu montantdes int\u00E9r\u00EAts de votre pr\u00EAt immobilier et la part de capital amorti.</html>");
lblretrouverLeDtail.setBounds(0, 25, 471, 59);
getContentPane().add(lblretrouverLeDtail);
JLabel lblsommeEmprunt = new JLabel("*Somme emprunt\u00E9");
lblsommeEmprunt.setFont(new Font("Tahoma", Font.BOLD, 11));
lblsommeEmprunt.setBounds(88, 88, 120, 14);
getContentPane().add(lblsommeEmprunt);
JLabel lblDateDeDbut = new JLabel("Date de d\u00E9but de remboursement");
lblDateDeDbut.setFont(new Font("Tahoma", Font.BOLD, 11));
lblDateDeDbut.setBounds(20, 110, 198, 14);
getContentPane().add(lblDateDeDbut);
JLabel lblDureDuPrt = new JLabel("Dur\u00E9e du pr\u00EAt");
lblDureDuPrt.setFont(new Font("Tahoma", Font.BOLD, 11));
lblDureDuPrt.setBounds(130, 176, 78, 14);
getContentPane().add(lblDureDuPrt);
JLabel lblTauxAnnuel = new JLabel("Taux annuel");
lblTauxAnnuel.setFont(new Font("Tahoma", Font.BOLD, 11));
lblTauxAnnuel.setBounds(140, 201, 78, 14);
getContentPane().add(lblTauxAnnuel);
textField = new JTextField();
textField.setBounds(228, 88, 140, 14);
getContentPane().add(textField);
textField.setColumns(10);
textField_4 = new JTextField();
textField_4.setColumns(10);
textField_4.setBounds(228, 201, 140, 14);
getContentPane().add(textField_4);
JButton btnNewButton = new JButton("Envoyer");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
btnNewButton.setBackground(new Color(255, 165, 0));
btnNewButton.setForeground(Color.WHITE);
btnNewButton.setBounds(228, 226, 89, 23);
getContentPane().add(btnNewButton);
JLabel lblNewLabel_1 = new JLabel("\u20AC");
lblNewLabel_1.setBounds(374, 88, 46, 14);
getContentPane().add(lblNewLabel_1);
JComboBox comboBox = new JComboBox();
comboBox.setBounds(228, 110, 140, 23);
getContentPane().add(comboBox);
JComboBox comboBox_1 = new JComboBox();
comboBox_1.setModel(new DefaultComboBoxModel(new String[] {""}));
comboBox_1.setToolTipText("");
comboBox_1.setBounds(228, 145, 140, 14);
getContentPane().add(comboBox_1);
JLabel lblAns = new JLabel("ans");
lblAns.setBounds(374, 176, 46, 14);
getContentPane().add(lblAns);
JComboBox comboBox_2 = new JComboBox();
comboBox_2.setModel(new DefaultComboBoxModel(new String[] {""}));
comboBox_2.setBounds(228, 176, 140, 14);
getContentPane().add(comboBox_2);
JLabel label = new JLabel("%");
label.setBounds(374, 201, 46, 14);
getContentPane().add(label);
}
// Connexion au serveur et lookup du bean
private static AmortissementRemote lookupRemoteStatelessAmortissement() throws NamingException {
AmortissementRemote remote=null;
try {
Properties jndiProps = new Properties();
jndiProps.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
InitialContext ctx = new InitialContext(jndiProps);
remote = (AmortissementRemote) ctx.lookup("ejb:/AmortissementEJB/Amortissement!hw.AmortissementRemote");
} catch (Exception e) {
e.printStackTrace();
}
return remote;
}
public static void main(String[] args) throws Exception {
// Appel du stateless bean
AmortissementRemote Amortissement = lookupRemoteStatelessAmortissement();
System.out.println(Amortissement.CalculAmortissement());
}
} |
Partager