房贷计算器java版

更新时间:2024-11-06 15:23:22 阅读: 评论:0


2023年5月23日发(作者:listen 歌词)

房贷计算器java

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package fang;

import ;

import ;

import t;

import pter;

import nt;

import nPane;

/**

*

* @author Administrator

*/

public class Fang extends

{

//double BAK_YEAR = 5.19;

private static final String[] bankLL = { //银⾏利率

"5.65","5.9", "6.15", "6.55", "6.8","7.05","7.3","7.55","5.4","5.15","4.9","4.65","4.4","4.15"

};

private static final String[] daze = {

"1.3", "1.2", "1.1", "⽆折扣", "9.5", "9", "8.5", "8", "7.5", "7"

};

private static final String[] usaful = { //还款年限初始化

"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"

};

private static final String[] items = { //还款⽅式初始化

"等额本息", "等额本⾦"

};

private static final String[] qian = {

"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"

};

/**

* Creates new form Fang

*/

public Fang()

{

int i;

initComponents();

for (i = 0; i < ; i++) { //为选项条赋值

for (i = 0; i < ; i++) { //为选项条赋值

m(bankLL[i]);

}

for (i = 0; i < ; i++) { //为选项条赋值

m(daze[i]); // jTextField5

}

for (i = 0; i < ; i++) { //为选项条赋值

m(items[i]);

}

for (i = 0; i < ; i++) {

m(usaful[i]);

}

for (i = 0; i < ; i++) {

m(qian[i]);

}

Image img = aultToolkit().getImage("icon/"); //显⽰标题栏的图标

//sor(HAD_CURSOR);

setIconImage(img); //设置标题图标

setLocation(320, 100);

setDefaultCloseOperation(DO_OTHIG_O_CLOSE);

table(false);

table(false);

table(false);

table(false);

t(daze[3]);

ectedIndex(0); //设置条选框默认值为数组中的第0个元素(此为:等额本息)

ectedIndex(9); //设置条选框默认值为数组中的第9个元素(此为:10

ectedIndex(29); //设置条选框默认值为数组中的第29个元素(此为:30

ectedIndex(3);

monic(_M); //设置method按钮的快捷键为ALT+M (method值为"开始计算")

monic(_C);

monic(_A);

monic(_X);

}

public void keyPressed(KeyEvent e)

{ //键按下但未抬起(释放)

//(0);

}

//@Override

public void keyReleased(KeyEvent e)

{ //键按下后抬起(释放)

//if(_SHIFT == Code() && _ESCAPE==Code()) { //不能使⽤

//if(_SHIFT == Code()) {

//设置按CTRL+SHIFT+ALT+F12退出窗⼝

/*if (tDown() && rolDown() && own() && _F12 == Code()) {

(0);

}*/

}

//@Override

public void keyTyped(KeyEvent e)

{ //键敲击(快速)

}

/**

* This method is called from within the constructor to

* initialize the form.

* WARIG: Do OT modify this code. The content of this method is

* always regenerated by the Form Editor.

* always regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// //GE-BEGI:initComponents

private void initComponents() {

jScrollPane1 = new lPane();

jTextArea1 = new rea();

filler1 = new (new ion(2, 0), new ion(2, 0), new ion(2, 32767));

jLabel1 = new ();

jButton1 = new n();

jButton2 = new n();

jButton3 = new n();

jButton4 = new n();

jComboBox1 = new Box();

jComboBox2 = new Box();

jComboBox3 = new Box();

jLabel2 = new ();

jLabel3 = new ();

jLabel4 = new ();

jLabel5 = new ();

jTextField1 = new ield();

jTextField2 = new ield();

jTextField3 = new ield();

jSeparator1 = new ator();

jSeparator2 = new ator();

jTextField4 = new ield();

jComboBox4 = new Box();

jLabel6 = new ();

jLabel7 = new ();

jSeparator3 = new ator();

jLabel8 = new ();

jTextField5 = new ield();

jComboBox5 = new Box();

jPanel1 = new ();

setDefaultCloseOperation(_O_CLOSE);

setTitle("房贷计算器 v1.01");

setCursor(new (T_CURSOR));

setResizable(false);

addKeyListener(new pter() {

public void keyPressed(nt evt) {

formKeyPressed(evt);

}

});

getContentPane().setLayout(new teLayout());

table(false);

kground(new (255, 204, 204));

umns(20);

t(new ("sansserif", 0, 18)); // OI18

eWrap(true);

s(5);

t("欢迎使⽤...");

der(EtchedBorder());

sor(new (_CURSOR));

ectedTextColor(new (255, 255, 204));

ectionColor(new (0, 153, 153));

wportView(jTextArea1);

getContentPane().add(jScrollPane1, new teConstraints(40, 140, 584, 320));

getContentPane().add(filler1, new teConstraints(192, 124, -1, -1));

t(new ("sansserif", 0, 18)); // OI18

eground(new (0, 51, 204));

t("期数 偿还利息 偿还本⾦ ⽉供 剩余本⾦");

t("期数 偿还利息 偿还本⾦ ⽉供 剩余本⾦");

getContentPane().add(jLabel1, new teConstraints(50, 110, 570, 40));

t("开始计算(M)");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jButton1ActionPerformed(evt);

}

});

getContentPane().add(jButton1, new teConstraints(680, 440, 99, -1));

t("清除数据(C)");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jButton2ActionPerformed(evt);

}

});

getContentPane().add(jButton2, new teConstraints(780, 440, 100, -1));

t("关于(A)");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jButton3ActionPerformed(evt);

}

});

getContentPane().add(jButton3, new teConstraints(680, 480, 99, -1));

t("安全退出(X)");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jButton4ActionPerformed(evt);

}

});

getContentPane().add(jButton4, new teConstraints(780, 480, 100, -1));

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jComboBox1ActionPerformed(evt);

}

});

getContentPane().add(jComboBox1, new teConstraints(740, 250, 122, -1));

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jComboBox2ActionPerformed(evt);

}

});

getContentPane().add(jComboBox2, new teConstraints(740, 320, 122, -1));

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jComboBox3ActionPerformed(evt);

}

});

getContentPane().add(jComboBox3, new teConstraints(740, 390, 122, -1));

t(new ("sansserif", 0, 14)); // OI18

eground(new (255, 51, 51));

t("银⾏最新房贷年利率(2015512⽇执⾏): 5.65%");

getContentPane().add(jLabel2, new teConstraints(540, 30, 320, 31));

t("贷款年限:");

getContentPane().add(jLabel3, new teConstraints(680, 220, -1, 20));

t("贷款⽅式:");

getContentPane().add(jLabel4, new teConstraints(680, 290, -1, 20));

t("贷款⾦额(万元):");

getContentPane().add(jLabel5, new teConstraints(650, 360, -1, 20));

kground(new (204, 204, 204));

t("10");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jTextField1ActionPerformed(evt);

}

});

getContentPane().add(jTextField1, new teConstraints(740, 220, 120, -1));

kground(new (204, 204, 204));

t("等额本息");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jTextField2ActionPerformed(evt);

}

});

getContentPane().add(jTextField2, new teConstraints(740, 290, 120, -1));

kground(new (204, 204, 204));

t("30");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jTextField3ActionPerformed(evt);

}

});

getContentPane().add(jTextField3, new teConstraints(740, 360, 120, -1));

getContentPane().add(jSeparator1, new teConstraints(10, 530, 858, 10));

getContentPane().add(jSeparator2, new teConstraints(40, 110, 580, 10));

t("5.65");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jTextField4ActionPerformed(evt);

}

});

getContentPane().add(jTextField4, new teConstraints(740, 80, 120, -1));

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jComboBox4ActionPerformed(evt);

}

});

getContentPane().add(jComboBox4, new teConstraints(740, 110, 120, -1));

t("银⾏利率%:");

getContentPane().add(jLabel6, new teConstraints(680, 80, 64, 20));

n(new con(getClass().getResource("/fang/"))); // OI18

getContentPane().add(jLabel7, new teConstraints(320, 20, -1, -1));

getContentPane().add(jSeparator3, new teConstraints(660, 420, 240, 10));

t("折扣:");

getContentPane().add(jLabel8, new teConstraints(710, 140, -1, 20));

t("⽆打折");

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jTextField5ActionPerformed(evt);

}

});

getContentPane().add(jTextField5, new teConstraints(740, 140, 120, -1));

ionListener(new Listener() {

public void actionPerformed(Event evt) {

jComboBox5ActionPerformed(evt);

}

});

getContentPane().add(jComboBox5, new teConstraints(740, 170, 120, -1));

der(EtchedBorder());

getContentPane().add(jPanel1, new teConstraints(670, 430, 220, 90));

pack();

}// //GE-ED:initComponents

private void jButton4ActionPerformed(Event evt)//GE-FIRST:event_jButton4ActionPerformed

{//GE-HEADERED:event_jButton4ActionPerformed

// TODO add your handling code here:

int yes;

//n(tFrame());

//ssageDialog(null, "你好");

yes = nfirmDialog(null,

"你确认要退出吗?n(退出需要密码.)",

"警告!!", _CACEL_OPTIO);

//aultCloseOperation(DO_OTHIG_O_CLOSE); // 设置对话框关闭按钮⽆效

//tionDialog(rootPane, yes, null, yes, yes, null, items, rootPane)

//n("yes="+yes);

if (yes == 2) { // 取消按钮的值为2,当按取消按钮时返回

return;

}

else if (yes == -1) { // 关闭按钮的值为-1,当按关闭按钮时返回

return;

}

else if (rce().equals((Object) jButton4)) { // the yes = 0,确认按钮的值为0,按确定按钮退出

(0);

}

}//GE-LAST:event_jButton4ActionPerformed

private void jButton3ActionPerformed(Event evt)//GE-FIRST:event_jButton3ActionPerformed

{//GE-HEADERED:event_jButton3ActionPerformed

// TODO add your handling code here:

int yes;

yes = nfirmDialog(null,

"欢迎使⽤本软件,如果发现BUGn Email: fengdos@ n本⼈将⾮常的感谢.n",

"关于", _CACEL_OPTIO);

//n("yes=" + yes);

if (yes == 0) {

return;

}

ssageDialog(null, "这是⼀个错n误对话框", "ERROR_MESSAGE", _MESSAGE);

ssageDialog(null, "这是⼀个内部n信息对话框", "IFORMATIO", ATIO_MESSAGE);

ssageDialog(null, "这是⼀个警n告对话框", "WARIG_MESSAGE", G_MESSAGE);

ssageDialog(null, "这是⼀个询问对话框,n你真的要退出吗?n", "QUESTIO_MESSAGE", O_MESSAGE);

}//GE-LAST:event_jButton3ActionPerformed

private void jButton1ActionPerformed(Event evt)//GE-FIRST:event_jButton1ActionPerformed

{//GE-HEADERED:event_jButton1ActionPerformed

// TODO add your handling code here:

String l;

String m;

String y;

float bankll;

int year;

float money;

l = t();

/*if (("")) {

t("你输⼊的利率不能为空,请重新输⼊!!");

t("");

return;

}*/

if (y()) {

t("你输⼊的利率不能为空,请重新输⼊!!");

return;

}

/*if (!s("[1-9][.][0-9]*")) {

//ssageDialog(null, "你输⼊的利率不能上字符串,请重新输⼊!!");

t("你输⼊的利率必须是伏点数,请重新输⼊!!");

t("");

return;

}

else {

t(l+".0");

}*/

m = t();

y = t();

try {

bankll = loat(l);

}

catch (Exception e) {

//n(sage());

//n(ckTrace());

//tackTrace();

t("你输⼊的利率必须是伏点数,请重新输⼊!!");

t("");

return;

}

/* if(bankll <3 || bankll >8) {

n("输⼊错误,请重新输⼊!!");

t("");

}*/

year = nt(m);

money = loat(y);

//int money = nt(y);

getMethods(money, year, bankll);

}//GE-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(Event evt)//GE-FIRST:event_jButton2ActionPerformed

{//GE-HEADERED:event_jButton2ActionPerformed

// TODO add your handling code here:

//String same = t() + "." + t();

t("");

etPosition(0);

}//GE-LAST:event_jButton2ActionPerformed

private void jTextField2ActionPerformed(Event evt)//GE-FIRST:event_jTextField2ActionPerformed

{//GE-HEADERED:event_jTextField2ActionPerformed

// TODO add your handling code here:

}//GE-LAST:event_jTextField2ActionPerformed

private void jTextField1ActionPerformed(Event evt)//GE-FIRST:event_jTextField1ActionPerformed

{//GE-HEADERED:event_jTextField1ActionPerformed

// TODO add your handling code here:

}//GE-LAST:event_jTextField1ActionPerformed

private void jTextField3ActionPerformed(Event evt)//GE-FIRST:event_jTextField3ActionPerformed

{//GE-HEADERED:event_jTextField3ActionPerformed

// TODO add your handling code here:

}//GE-LAST:event_jTextField3ActionPerformed

private void jComboBox1ActionPerformed(Event evt)//GE-FIRST:event_jComboBox1ActionPerformed

{//GE-HEADERED:event_jComboBox1ActionPerformed

// TODO add your handling code here:

t((String) ectedItem());

}//GE-LAST:event_jComboBox1ActionPerformed

private void jComboBox2ActionPerformed(Event evt)//GE-FIRST:event_jComboBox2ActionPerformed

{//GE-HEADERED:event_jComboBox2ActionPerformed

// TODO add your handling code here:

t((String) ectedItem());

}//GE-LAST:event_jComboBox2ActionPerformed

private void jComboBox3ActionPerformed(Event evt)//GE-FIRST:event_jComboBox3ActionPerformed

{//GE-HEADERED:event_jComboBox3ActionPerformed

// TODO add your handling code here:

t((String) ectedItem());

}//GE-LAST:event_jComboBox3ActionPerformed

private void jComboBox4ActionPerformed(Event evt)//GE-FIRST:event_jComboBox4ActionPerformed

{//GE-HEADERED:event_jComboBox4ActionPerformed

// TODO add your handling code here:

t((String) ectedItem());

}//GE-LAST:event_jComboBox4ActionPerformed

private void jTextField4ActionPerformed(Event evt)//GE-FIRST:event_jTextField4ActionPerformed

{//GE-HEADERED:event_jTextField4ActionPerformed

// TODO add your handling code here:

}//GE-LAST:event_jTextField4ActionPerformed

private void formKeyPressed(nt evt)//GE-FIRST:event_formKeyPressed

{//GE-HEADERED:event_formKeyPressed

// TODO add your handling code here:

/*if (tDown() && rolDown() && own() && _F12 == Code()) {

(0);

}*/

}//GE-LAST:event_formKeyPressed

private void jTextField5ActionPerformed(Event evt)//GE-FIRST:event_jTextField5ActionPerformed

{//GE-HEADERED:event_jTextField5ActionPerformed

// TODO add your handling code here:

}//GE-LAST:event_jTextField5ActionPerformed

private void jComboBox5ActionPerformed(Event evt)//GE-FIRST:event_jComboBox5ActionPerformed

{//GE-HEADERED:event_jComboBox5ActionPerformed

// TODO add your handling code here:

t((String) ectedItem());

}//GE-LAST:event_jComboBox5ActionPerformed

//开始计算的⽅法

public void getMethods(float money, int years, float bankll)

{

int tmp = 1;

float daze;

if (money < 1 || money > 100) {

t("你输⼊的⾦额不正确,请重新输⼊!!");

return;

}

else if (years < 1 || years > 30) {

t("你输⼊的还款年限不正确,请重新输⼊!!");

return;

}

else if (bankll < 3.0f || bankll > 8.0f) {

t("输⼊错误( 输⼊范围: 3.0 8.0 ),请重新输⼊⼩数!!");

return;

}

int k;

double YEAR_LL = 0, MOO_LL = 0, yuegong = 0, FirstCHLX = 0, CHLX = 0, CHBJ = 0, SYBJ = 0;

int year = years, moon = 0;

int i = 0, level = 0;

float r = money, RMB = 0f;

YEAR_LL = bankll / 100;

MOO_LL = YEAR_LL / 12;

RMB = r * 10000;

level = year * 12 + moon;

FirstCHLX = RMB * MOO_LL;

//"1.3", "1.2", "1.1", "⽆折扣", "9.5", "9", "8.5", "8", "7.5", "7"

tmp = ectedIndex();

switch (tmp) {

case 0:

daze = 1.3f;

break;

case 1:

daze = 1.2f;

break;

case 2:

daze = 1.1f;

break;

case 3:

daze = 1.0f;

break;

case 4:

daze = .95f;

break;

case 5:

daze = .9f;

break;

case 6:

daze = .85f;

break;

case 7:

daze = .8f;

break;

case 8:

daze = .75f;

break;

case 9:

daze = .7f;

break;

default:

daze = 1.0f;

}

yuegong = (RMB * MOO_LL * (1 + MOO_LL, year * 12 + moon)) / ((1 + MOO_LL, year * 12 + moon) - 1) * daze;

CHLX = FirstCHLX;

CHBJ = yuegong - FirstCHLX;

SYBJ = RMB - CHBJ;

//n("⾸⽉利息:" + CHLX + " 偿还本⾦:" + CHBJ + " 剩余本⾦:" + SYBJ);

//n("n第⼀年清单:");

//n("期数 偿还利息 偿还本⾦ 剩余本⾦");

t(""); //清空上次内容以备下次显⽰

kground();

eground(ay);

for (k = 0; k < level; k++) {

(("%3dt%.2ft%.2ft%.2ft%.2fn", (k + 1), CHLX, CHBJ, yuegong, SYBJ));

CHLX = SYBJ * MOO_LL;

CHBJ = yuegong - CHLX;

SYBJ = SYBJ - CHBJ;

}

etPosition(0); //显⽰完毕后⾃动回到⽂本⾸⾏

//table(false); //设置禁⽌修改内容

//sor(new Cursor(_CURSOR)); //设置光标不⽂本⽔标

//sor(new Cursor(T_CURSOR)); 恢复光标

//et().setVisible(true); //使Text区的⽂本光标显⽰

}

/**

* @param args the command line arguments

*/

public static void main(String args[])

{

/* Set the imbus look and feel */

//

/* If imbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see /javase/tutorial/uiswing/lookandfeel/

*/

try {

for (dFeelInfo info : talledLookAndFeels()) {

if ("imbus".equals(e())) {

kAndFeel(ssame()); // 设置窗⼝风格(安装imbus风格)

break;

}

}

}

catch (ClassotFoundException ex) {

ger(e()).log(, null, ex);

}

catch (InstantiationException ex) {

ger(e()).log(, null, ex);

}

catch (IllegalAccessException ex) {

ger(e()).log(, null, ex);

}

catch (ortedLookAndFeelException ex) {

ger(e()).log(, null, ex);

}

//

/* Create and display the form */

Fang fr = new Fang();

Listener(new KeyAdapter()

{

@Override

public void keyPressed(KeyEvent e)

{

if (_ESCAPE == Code()) {

if (_ESCAPE == Code()) {

(0);

}

}

});

Later(new Runnable()

{

public void run()

{

new Fang().setVisible(true);

}

});

}

// Variables declaration - do not modify//GE-BEGI:variables

private filler1;

private n jButton1;

private n jButton2;

private n jButton3;

private n jButton4;

private Box jComboBox1;

private Box jComboBox2;

private Box jComboBox3;

private Box jComboBox4;

private Box jComboBox5;

private jLabel1;

private jLabel2;

private jLabel3;

private jLabel4;

private jLabel5;

private jLabel6;

private jLabel7;

private jLabel8;

private jPanel1;

private lPane jScrollPane1;

private ator jSeparator1;

private ator jSeparator2;

private ator jSeparator3;

private rea jTextArea1;

private ield jTextField1;

private ield jTextField2;

private ield jTextField3;

private ield jTextField4;

private ield jTextField5;

// End of variables declaration//GE-ED:variables

}


本文发布于:2023-05-23 23:30:13,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/falv/fa/78/102747.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 站长QQ:55-9-10-26