手机号码测凶吉,学习阶段,感觉蛮好玩,我是用NetBeansIDE做的

时间:2021-07-24 12:56:24
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 2013-10-12, 15:23:51
 */

package javaapplication3;

/**
 *
 * @author df
 */
public class NewJFrame extends javax.swing.JFrame {

    /** Creates new form NewJFrame */
    public NewJFrame() {
        initComponents();
    }

    /** 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() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        soji = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jieg = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        beij2 = new javax.swing.JLabel();
        BaG = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SouJi");
        setResizable(false);

        jLabel1.setText("请输入您的手机号码:");
        jLabel1.setBounds(50, 110, 140, 15);
        jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setBackground(new java.awt.Color(255, 51, 51));
        jLabel2.setText("手机号码测吉凶。你值得拥有");
        jLabel2.setBounds(50, 70, 200, 15);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        soji.setBackground(new java.awt.Color(241, 237, 237));
        soji.setBounds(120, 150, 210, 21);
        jLayeredPane1.add(soji, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setText("天机:");
        jLabel3.setBounds(50, 190, 70, 15);
        jLayeredPane1.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jieg.setBackground(new java.awt.Color(245, 239, 239));
        jieg.setColumns(20);
        jieg.setRows(5);
        jieg.setSelectedTextColor(new java.awt.Color(204, 204, 204));
        jScrollPane1.setViewportView(jieg);

        jScrollPane1.setBounds(120, 190, 250, 106);
        jLayeredPane1.add(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton1.setText("开始");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jButton1.setBounds(120, 310, 80, 23);
        jLayeredPane1.add(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton2.setText("清空");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jButton2.setBounds(290, 310, 80, 23);
        jLayeredPane1.add(jButton2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        beij2.setBackground(new java.awt.Color(250, 245, 245));
        beij2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/javaapplication3/2.jpg"))); // NOI18N
        beij2.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        beij2.setBounds(30, 50, 360, 300);
        jLayeredPane1.add(beij2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        BaG.setIcon(new javax.swing.ImageIcon(getClass().getResource("/javaapplication3/1.jpg"))); // NOI18N
        BaG.setBounds(0, -10, 450, 420);
        jLayeredPane1.add(BaG, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 413, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    String jiji=soji.getText().trim();//获取手机号码文本框字符缤纷存储到变量jiji中
    if(jiji.length()!=11 && jiji.length()!=7){
           jieg.setText("请正确输入电话号码,谢谢!");}
      else{
        float h4,jie1,xiaos,jie2;
        /*h4是手机后四位数转换成浮点型的变量,jie1是
         存手机后四位除80的结果,xiaos是存除后数值的小数,jie2存小数乘80的结果
         */
        String hm=jiji.substring(7);//hm是存手机后四位的字符
        h4=Float.parseFloat(hm);
        jie1=h4/80;
        xiaos=(jie1*10-(int)jie1*10)/10;//(int)强制转换
        jie2=xiaos*80;

        switch((int)jie2){
            case 1:
                jieg.setText("吉!大展鸿图,信用得固,无远弗界,可获成功");break;
            case 2:
                jieg.setText("凶!根基不固,摇摇欲坠,一盛一衰,劳而无功");break;
            case 3:
                jieg.setText("吉!根深蒂固,蒸蒸日上,如意吉祥,百事顺遂");break;
            case 4:
                jieg.setText("凶!坎坷前途,苦难折磨,非有毅力,难望成功");break;
            case 5:
                jieg.setText("吉!阴阳和合,生意欣荣,名利双收,后福重重");break;
            case 6:
                jieg.setText("吉!万宝云集,天降幸运,立志奋发,可成大功");break;
            case 7:
                jieg.setText("吉!专心经营,和气致祥,排除万难,必获成功");break;
            case 8:
                jieg.setText("吉!努力发达,贯彻志望,不忘进退,成功可期");break;
            case 9:
                jieg.setText("凶!虽抱奇才,有才无命,独营无力,财利无望");break;
            case 10:
                jieg.setText("凶!乌云遮月,暗淡无光,空费心力,徒劳无功");break;
            case 11:
                jieg.setText("吉!草木逢春,枯叶沾露,稳健着实,必得人望");break;
            case 12:
                jieg.setText("凶!薄弱无力,孤立无摇,外祥内苦,谋事难成");break;
            case 13:
                jieg.setText("吉!天赋吉运,能得人望,善用智慧,必获成功");break;
            case 14:
                jieg.setText("凶!忍得苦难,必有后福,是成是败,惟靠坚毅");break;
            case 15:
                jieg.setText("吉!谦恭做事,必得人和,大事成就,一定兴隆");break;
            case 16:
                jieg.setText("吉!能获众望,成就大业,名利双收,盟主四方");break;
            case 17:
                jieg.setText("吉!排除万难,有贵人助,把握时机,可得成功");break;
            case 18:
                jieg.setText("吉!经商做事,顺利昌隆,如能慎始,百事亨通");break;
            case 19:
                jieg.setText("凶!成功虽早,慎防空亏,内外不合,障碍重重");break;
            case 20:
                jieg.setText("凶!智高志大,历尽艰难,焦心忧劳,进退两难");break;
            case 21:
                jieg.setText("吉!专心经营,善用智慧,霜雪梅花,春来怒放");break;
            case 22:
                jieg.setText("凶!秋草逢霜,怀才不遇,忧愁怨苦,事不如意");break;
            case 23:
                jieg.setText("吉!旭日升天,名显四方,渐次进展,终成大业");break;
            case 24:
                jieg.setText("吉!锦绣前程,须靠自力,多用智谋,能奏大功");break;
            case 25:
                jieg.setText("吉!天时地利,再得人格,讲信修睦,即可成功");break;
            case 26:
                jieg.setText("凶!波澜起伏,千变万化,凌驾万难,必可成功");break;
            case 27:
                jieg.setText("凶!带吉!一成一败,一盛一衰,惟靠谨慎,可守成功");break;
            case 28:
                jieg.setText("凶!鱼临旱地,难逃恶运,此数大凶,不如更名");break;
            case 29:
                jieg.setText("吉!如龙得云,青云直上,智谋奋进,才略奏功");break;
            case 30:
                jieg.setText("凶!吉凶参半,得失相伴,投机取巧,如赛一样");break;
            case 31:
                jieg.setText("吉!此数大吉,名利双收,渐进向上,大业成就");break;
            case 32:
                jieg.setText("吉!池中之龙,风云际会,一跃上天,成功可望");break;
            case 33:
                jieg.setText("吉!不可意气,善用智慧,如能慎始,必可昌隆");break;
            case 34:
                jieg.setText("凶!灾难不绝,难望成功,此数大凶,不如更名");break;
            case 35:
                jieg.setText("吉!中吉之数,进退保守,生意安稳,成就可期");break;
            case 36:
                jieg.setText("凶!波澜重迭,常陷穷困,动不如静,有才无命");break;
            case 37:
                jieg.setText("吉!逢凶化吉,吉人天相,风条雨顺,生意兴隆");break;
            case 38:
                jieg.setText("凶带吉!名虽可得,利则难获,艺界发展,可望成功");break;
            case 39:
                jieg.setText("吉!云开见月,虽有劳碌,光明坦途,指日可期");break;
            case 40:
                jieg.setText("吉带凶!一胜一衰,浮沉不定,知难而退,自获天佑");break;
            case 41:
                jieg.setText("吉!天赋吉运,德望兼备,继续努力,前途无限");
                break;
            case 42:
                jieg.setText("吉带凶!事业不专,十九不成,专心进取,可望成功");
                break;
            case 43:
                jieg.setText("吉带凶!雨夜之花,外祥内苦,忍耐自重,转凶为吉");
                break;
            case 44:
                jieg.setText("凶!虽用心计,事难遂愿,贪功好进,必招失败");
                break;
            case 45:
                jieg.setText("吉!杨柳遇春,绿叶发枝,冲破难关,一举成名");
                break;
            case 46:
                jieg.setText("凶!坎坷不平,艰难重重,若无耐心,难望有成");
                break;
            case 47:
                jieg.setText("吉!有贵人助,可成大业,虽遇不幸,浮沉不大");
                break;
            case 48:
                jieg.setText("吉!美化丰实,鹤立鸡群,名利俱全,繁荣富贵");
                break;
            case 49:
                jieg.setText("凶!遇吉则吉,遇凶则凶,惟靠谨慎,逢凶化吉");
                break;
            case 50:
                jieg.setText("吉带凶!吉凶互见,一成一败,凶中有吉,吉中有凶");
                break;
            case 51:
                jieg.setText("吉带凶!一盛一衰,浮沉不常,自重自处,可保平安");
                break;
            case 52:
                jieg.setText("吉!草木逢春,雨过天晴,渡过难关,即获成功");
                break;
            case 53:
                jieg.setText("吉带凶!盛衰参半,外祥内苦,先吉后凶,先凶后吉");
                break;
            case 54:
                jieg.setText("凶!虽倾全力,难望成功,此数大凶,最好改名");
                break;
            case 55:
                jieg.setText("吉带凶!外观隆昌,内隐祸患,克服难关,开出泰运");
                break;
            case 56:
                jieg.setText("凶!事与愿违,终难成功,欲速不达,有始有终");
                break;
            case 57:
                jieg.setText("吉!努力经营,时来运转,旷野枯草,春来花开");
                break;
            case 58:
                jieg.setText("凶带吉!带吉!半凶半吉,浮沉多端,始凶终吉,能保成功");
                break;
            case 59:
                jieg.setText("凶!遇事犹疑,难望成事,大刀阔斧,始可有成");
                break;
            case 60:
                jieg.setText("凶!黑暗无光,心迷意乱,出尔反尔,难定方针");
                break;
            case 61:
                jieg.setText("吉带凶!云遮半月,百隐风波,应自谨慎,始保平安");
                break;
            case 62:
                jieg.setText("凶!烦闷懊恼,事事难展,自防灾祸,始免困境");
                break;
            case 63:
                jieg.setText("吉!万物化育,繁荣之象,专心一意,始能成功");
                break;
            case 64:
                jieg.setText("凶!见异思迁,十九不成,徒劳无功,不如更名");
                break;
            case 65:
                jieg.setText("吉!吉运自来,能享盛名,把握机会,必获成功");
                break;
            case 66:
                jieg.setText("凶!黑夜漫长,进退维谷,内外不合,信用缺乏");
                break;
            case 67:
                jieg.setText("吉!时来运转,事事如意,功成名就,富贵自来");
                break;
            case 68:
                jieg.setText("吉!思虑周详,计划力行,不失先机,可望成功");
                break;
            case 69:
                jieg.setText("凶!动摇不安,常陷逆境,不得时运,难得利润");
                break;
            case 70:
                jieg.setText("凶!惨淡经营,难免贫困,此数不吉,最好改名");
                break;
            case 71:
                jieg.setText("吉带凶!吉凶参半,惟赖勇气,贯彻力行,始可成功");
                break;
            case 72:
                jieg.setText("凶!利害混集,凶多吉少,得而复失,难以安顺");
                break;
            case 73:
                jieg.setText("吉!安乐自来,自然吉祥,力行不懈,终必成功");
                break;
            case 74:
                jieg.setText("凶!利不及费,坐食山空,如无智谋,难望成功");
                break;
            case 75:
                jieg.setText("吉带凶!吉中带凶,欲速不达,进不如守,可保安详");
                break;
            case 76:
                jieg.setText("凶!此数大凶,破产之象,宜速改名,以避厄运");
                break;
            case 77:
                jieg.setText("吉带凶!先苦后甘,先甘后苦,如能守成,不致失败");
                break;
            case 78:
                jieg.setText("吉带凶!有得有失,华而不实,须防劫财,始保平安");
                break;
            case 79:
                jieg.setText("凶!如走夜路,前途无光,希望不大,劳而无功");
                break;
            case 80:
                jieg.setText("吉带凶!得而复失,枉费心机,守成无贪,可保安稳");
                break;
            case 81:
                jieg.setText("吉!最极之数,还本归元,能得繁业,发达成功");
                break;
        }
    }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        soji.setText("");
        jieg.setText("");
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel BaG;
    private javax.swing.JLabel beij2;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jieg;
    private javax.swing.JTextField soji;
    // End of variables declaration//GEN-END:variables

}
手机号码测凶吉,学习阶段,感觉蛮好玩,我是用NetBeansIDE做的