/*
* 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 java.awt.Color;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JOptionPane;
/**
*
* @author Administrator
*/
public class Fang extends javax.swing.JFrame
{
//double BANK_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 < bankLL.length; i++) { //为选项条赋值
jComboBox4.addItem(bankLL[i]);
}
for (i = 0; i < daze.length; i++) { //为选项条赋值
jComboBox5.addItem(daze[i]); // jTextField5
}
for (i = 0; i < items.length; i++) { //为选项条赋值
jComboBox2.addItem(items[i]);
}
for (i = 0; i < usaful.length; i++) {
jComboBox1.addItem(usaful[i]);
}
for (i = 0; i < qian.length; i++) {
jComboBox3.addItem(qian[i]);
}
Image img = Toolkit.getDefaultToolkit().getImage("icon/logo.jpg"); //显示标题栏的图标
//myFrame.setCursor(HAND_CURSOR);
setIconImage(img); //设置标题图标
setLocation(320, 100);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
jTextField1.setEditable(false);
jTextField2.setEditable(false);
jTextField3.setEditable(false);
jTextField5.setEditable(false);
jTextField5.setText(daze[3]);
jComboBox2.setSelectedIndex(0); //设置条选框默认值为数组中的第0个元素(此为:等额本息)
jComboBox1.setSelectedIndex(9); //设置条选框默认值为数组中的第9个元素(此为:10)
jComboBox3.setSelectedIndex(29); //设置条选框默认值为数组中的第29个元素(此为:30)
jComboBox5.setSelectedIndex(3);
jButton1.setMnemonic(KeyEvent.VK_M); //设置method按钮的快捷键为ALT+M (此method值为"开始计算")
jButton2.setMnemonic(KeyEvent.VK_C);
jButton3.setMnemonic(KeyEvent.VK_A);
jButton4.setMnemonic(KeyEvent.VK_X);
}
public void keyPressed(KeyEvent e)
{ //键按下但未抬起(释放)
//System.exit(0);
}
//@Override
public void keyReleased(KeyEvent e)
{ //键按下后抬起(释放)
//if(KeyEvent.VK_SHIFT == e.getKeyCode() && KeyEvent.VK_ESCAPE==e.getKeyCode()) { //不能使用
//if(KeyEvent.VK_SHIFT == e.getKeyCode()) {
//设置按CTRL+SHIFT+ALT+F12退出窗口
/*if (e.isShiftDown() && e.isControlDown() && e.isAltDown() && KeyEvent.VK_F12 == e.getKeyCode()) {
System.exit(0);
}*/
}
//@Override
public void keyTyped(KeyEvent e)
{ //键敲击(快速)
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(2, 0), new java.awt.Dimension(2, 0), new java.awt.Dimension(2, 32767));
jLa
房贷计算器java版
最新推荐文章于 2022-11-14 20:19:15 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)