java万年历

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;



public class wanNianLi extends JFrame {
    public wanNianLi() throws ParseException {
        this.setSize(800, 800);
        this.setLocation(100, 100);
        this.setLocationRelativeTo(null);
        this.setTitle("万年历");
//        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setIconImage(new ImageIcon("wnl.png").getImage());

        JPanel jp = new JPanel(new BorderLayout(0, 15));
        JButton jp1 = new JButton();
        jp1.setOpaque(false);
        jp1.setBackground(Color.BLUE);
        jp1.setBorderPainted(false);

        JButton jp2 = new JButton();
        jp2.setOpaque(false);
        jp2.setBackground(Color.BLUE);
        jp2.setBorderPainted(false);

        JPanel jba = new JPanel(new GridLayout(1, 6, 10, 10));
        JPanel jb = new JPanel(new GridLayout(7, 7, 15, 15));//行数,列数,行间距,列间距

        JButton jba1 = new JButton("请输入年:");
        jba1.setFont(new Font("楷体", Font.BOLD, 16));
        jba1.setBackground(Color.BLUE);
        jba1.setOpaque(false);
        jba1.setBorderPainted(false);

        JButton jba4 = new JButton();
        jba4.setBackground(Color.BLUE);
        jba4.setOpaque(false);
        jba4.setBorderPainted(false);

        JTextField year1 = new JTextField(5);
        jba4.add(year1);

        JButton jba2 = new JButton("请输入月:");
        jba2.setFont(new Font("楷体", Font.BOLD, 16));
        jba2.setBackground(Color.BLUE);
        jba2.setOpaque(false);
        jba2.setBorderPainted(false);

        JButton jba5 = new JButton();
        jba5.setOpaque(false);
        jba5.setBackground(Color.BLUE);
        jba5.setBorderPainted(false);

        JTextField month1 = new JTextField(5);
        jba5.add(month1);

        JButton jba3 = new JButton("查找");

        JButton jba6 = new JButton("回到今天");


        jba.add(jba1);
        jba.add(jba4);
        jba.add(jba2);
        jba.add(jba5);
        jba.add(jba3);
        jba.add(jba6);

        Color c = new Color(0, 0, 0);
        JButton jb1 = new JButton("按钮1");
//        jb1.setSize(50,50);
//        jb1.setBounds(1,1,20,20);//设置按钮坐标,大小
        jb1.setBackground(c);
        jb1.setOpaque(false);//消除背景颜色
        jb1.setBorderPainted(false);//消除边框颜色

        JPanel fl1 = new JPanel(new GridLayout(2, 1));
        JButton yl1 = new JButton();
        yl1.setBackground(c);
        yl1.setOpaque(false);
        yl1.setBorderPainted(false);
        JButton nl1 = new JButton();
        nl1.setBackground(c);
        nl1.setOpaque(false);
        nl1.setBorderPainted(false);
        jb1.add(fl1);
        fl1.add(yl1);
        fl1.add(nl1);


        JButton jb2 = new JButton("按钮2");
        jb2.setBackground(c);
        jb2.setOpaque(false);
        jb2.setBorderPainted(false);
        JPanel fl2 = new JPanel(new GridLayout(2, 1));
        JButton yl2 = new JButton();
        yl2.setBackground(c);
        yl2.setOpaque(false);
        yl2.setBorderPainted(false);
        JButton nl2 = new JButton();
        nl2.setBackground(c);
        nl2.setOpaque(false);
        nl2.setBorderPainted(false);
        jb2.add(fl2);
        fl2.add(yl2);
        fl2.add(nl2);


        JButton jb3 = new JButton("按钮3");
        jb3.setBackground(c);
        jb3.setOpaque(false);
        jb3.setBorderPainted(false);
        JPanel fl3 = new JPanel(new GridLayout(2, 1));
        JButton yl3 = new JButton();
        yl3.setBackground(c);
        yl3.setOpaque(false);
        yl3.setBorderPainted(false);
        JButton nl3 = new JButton();
        nl3.setBackground(c);
        nl3.setOpaque(false);
        nl3.setBorderPainted(false);
        jb3.add(fl3);
        fl3.add(yl3);
        fl3.add(nl3);


        JButton jb4 = new JButton("按钮4");
        jb4.setBackground(c);
        jb4.setOpaque(false);
        jb4.setBorderPainted(false);
        JPanel fl4 = new JPanel(new GridLayout(2, 1));
        JButton yl4 = new JButton();
        yl4.setBackground(c);
        yl4.setOpaque(false);
        yl4.setBorderPainted(false);
        JButton nl4 = new JButton("");
        nl4.setBackground(c);
        nl4.setOpaque(false);
        nl4.setBorderPainted(false);
        jb4.add(fl4);
        fl4.add(yl4);
        fl4.add(nl4);


        JButton jb5 = new JButton("按钮5");
        jb5.setBackground(c);
        jb5.setOpaque(false);//消除背景颜色
        jb5.setBorderPainted(false);//消除边框颜色
        JPanel fl5 = new JPanel(new GridLayout(2, 1));
        JButton yl5 = new JButton();
        yl5.setBackground(c);
        yl5.setOpaque(false);
        yl5.setBorderPainted(false);
        JButton nl5 = new JButton();
        nl5.setBackground(c);
        nl5.setOpaque(false);
        nl5.setBorderPainted(false);
        jb5.add(fl5);
        fl5.add(yl5);
        fl5.add(nl5);


        JButton jb6 = new JButton("按钮6");
        jb6.setBackground(Color.pink);//按钮中背景颜色
        jb6.setForeground(Color.red);//按钮中字体颜色
        jb6.setBorderPainted(false);
        JPanel fl6 = new JPanel(new GridLayout(2, 1));
        JButton yl6 = new JButton();
        yl6.setBackground(Color.pink);//按钮中背景颜色
        yl6.setForeground(Color.red);//按钮中字体颜色
        yl6.setBorderPainted(false);
        JButton nl6 = new JButton();
        nl6.setBackground(Color.pink);//按钮中背景颜色
        nl6.setForeground(Color.red);//按钮中字体颜色
        nl6.setBorderPainted(false);
        jb6.add(fl6);
        fl6.add(yl6);
        fl6.add(nl6);


        JButton jb7 = new JButton("模板模板模板模板模板模板模板");
//        jb.setFont(new Font());
        jb7.setBackground(Color.pink);//按钮中背景颜色
        jb7.setForeground(Color.red);//按钮中字体颜色
//        jb7.setOpaque(false);
        jb7.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        jb7.setBorderPainted(false);
        JPanel fl7 = new JPanel(new GridLayout(2, 1));
        JButton yl7 = new JButton();
        yl7.setBackground(Color.pink);//按钮中背景颜色
        yl7.setForeground(Color.red);//按钮中字体颜色
//        yl7.setOpaque(false);
        yl7.setBorderPainted(false);
        JButton nl7 = new JButton();
        nl7.setBackground(Color.pink);//按钮中背景颜色
        nl7.setForeground(Color.red);//按钮中字体颜色
//        nl7.setBorder((Border) Color.green);
//        nl7.setOpaque(false);
        nl7.setBorderPainted(false);//按钮边框
        jb7.add(fl7);
        fl7.add(yl7);
        fl7.add(nl7);

        JButton jb8 = new JButton("按钮1");
        jb8.setBackground(c);
        jb8.setOpaque(false);//消除背景颜色
        jb8.setBorderPainted(false);//消除边框颜色
        JPanel fl8 = new JPanel(new GridLayout(2, 1));
        JButton yl8 = new JButton();
        yl8.setBackground(c);
        yl8.setOpaque(false);
        yl8.setBorderPainted(false);
        JButton nl8 = new JButton();
        nl8.setBackground(c);
        nl8.setOpaque(false);
        nl8.setBorderPainted(false);
        jb8.add(fl8);
        fl8.add(yl8);
        fl8.add(nl8);


        JButton jb9 = new JButton("按钮2");
        jb9.setBackground(c);
        jb9.setOpaque(false);//消除背景颜色
        jb9.setBorderPainted(false);//消除边框颜色
        JPanel fl9 = new JPanel(new GridLayout(2, 1));
        JButton yl9 = new JButton();
        yl9.setBackground(c);
        yl9.setOpaque(false);
        yl9.setBorderPainted(false);
        JButton nl9 = new JButton();
        nl9.setBackground(c);
        nl9.setOpaque(false);
        nl9.setBorderPainted(false);
        jb9.add(fl9);
        fl9.add(yl9);
        fl9.add(nl9);


        JButton jb10 = new JButton("按钮3");
        jb10.setBackground(c);
        jb10.setOpaque(false);//消除背景颜色
        jb10.setBorderPainted(false);//消除边框颜色
        JPanel fl10 = new JPanel(new GridLayout(2, 1));
        JButton yl10 = new JButton();
        yl10.setBackground(c);
        yl10.setOpaque(false);
        yl10.setBorderPainted(false);
        JButton nl10 = new JButton();
        nl10.setBackground(c);
        nl10.setOpaque(false);
        nl10.setBorderPainted(false);
        jb10.add(fl10);
        fl10.add(yl10);
        fl10.add(nl10);


        JButton jb11 = new JButton("按钮4");
        jb11.setBackground(c);
        jb11.setOpaque(false);//消除背景颜色
        jb11.setBorderPainted(false);//消除边框颜色
        JPanel fl11 = new JPanel(new GridLayout(2, 1));
        JButton yl11 = new JButton();
        yl11.setBackground(c);
        yl11.setOpaque(false);
        yl11.setBorderPainted(false);
        JButton nl11 = new JButton();
        nl11.setBackground(c);
        nl11.setOpaque(false);
        nl11.setBorderPainted(false);
        jb11.add(fl11);
        fl11.add(yl11);
        fl11.add(nl11);


        JButton jb12 = new JButton("按钮5");
        jb12.setBackground(c);
        jb12.setOpaque(false);//消除背景颜色
        jb12.setBorderPainted(false);//消除边框颜色
        JPanel fl12 = new JPanel(new GridLayout(2, 1));
        JButton yl12 = new JButton();
        yl12.setBackground(c);
        yl12.setOpaque(false);
        yl12.setBorderPainted(false);
        JButton nl12 = new JButton();
        nl12.setBackground(c);
        nl12.setOpaque(false);
        nl12.setBorderPainted(false);
        jb12.add(fl12);
        fl12.add(yl12);
        fl12.add(nl12);


        JButton jb13 = new JButton("按钮6");
        jb13.setBackground(Color.pink);//按钮中背景颜色
        jb13.setForeground(Color.red);//按钮中字体颜色
        jb13.setBorderPainted(false);
        JPanel fl13 = new JPanel(new GridLayout(2, 1));
        JButton yl13 = new JButton();
        yl13.setBackground(Color.pink);//按钮中背景颜色
        yl13.setForeground(Color.red);//按钮中字体颜色
        yl13.setBorderPainted(false);
        JButton nl13 = new JButton();
        nl13.setBackground(Color.pink);//按钮中背景颜色
        nl13.setForeground(Color.red);//按钮中字体颜色
        nl13.setBorderPainted(false);
        jb13.add(fl13);
        fl13.add(yl13);
        fl13.add(nl13);


        JButton jb14 = new JButton("按钮7");
        jb14.setBackground(Color.pink);//按钮中背景颜色
        jb14.setForeground(Color.red);//按钮中字体颜色
        jb14.setBorderPainted(false);
        JPanel fl14 = new JPanel(new GridLayout(2, 1));
        JButton yl14 = new JButton();
        yl14.setBackground(Color.pink);//按钮中背景颜色
        yl14.setForeground(Color.red);//按钮中字体颜色
        yl14.setBorderPainted(false);
        JButton nl14 = new JButton();
        nl14.setBackground(Color.pink);//按钮中背景颜色
        nl14.setForeground(Color.red);//按钮中字体颜色
        nl14.setBorderPainted(false);
        jb14.add(fl14);
        fl14.add(yl14);
        fl14.add(nl14);
        jb14.setPreferredSize(new Dimension(80, 20));


        JButton jb15 = new JButton("按钮一");
        jb15.setBackground(c);
        jb15.setOpaque(false);
        jb15.setBorderPainted(false);
        JPanel fl15 = new JPanel(new GridLayout(2, 1));
        JButton yl15 = new JButton();
        yl15.setBackground(c);
        yl15.setOpaque(false);
        yl15.setBorderPainted(false);
        JButton nl15 = new JButton();
        nl15.setBackground(c);
        nl15.setOpaque(false);
        nl15.setBorderPainted(false);
        jb15.add(fl15);
        fl15.add(yl15);
        fl15.add(nl15);


        JButton jb16 = new JButton("按钮2");
        jb16.setBackground(c);
        jb16.setOpaque(false);//消除背景颜色
        jb16.setBorderPainted(false);//消除边框颜色
        JPanel fl16 = new JPanel(new GridLayout(2, 1));
        JButton yl16 = new JButton();
        yl16.setBackground(c);
        yl16.setOpaque(false);
        yl16.setBorderPainted(false);
        JButton nl16 = new JButton();
        nl16.setBackground(c);
        nl16.setOpaque(false);
        nl16.setBorderPainted(false);
        jb16.add(fl16);
        fl16.add(yl16);
        fl16.add(nl16);


        JButton jb17 = new JButton("按钮3");
        jb17.setBackground(c);
        jb17.setOpaque(false);//消除背景颜色
        jb17.setBorderPainted(false);//消除边框颜色
        JPanel fl17 = new JPanel(new GridLayout(2, 1));
        JButton yl17 = new JButton();
        yl17.setBackground(c);
        yl17.setOpaque(false);
        yl17.setBorderPainted(false);
        JButton nl17 = new JButton();
        nl17.setBackground(c);
        nl17.setOpaque(false);
        nl17.setBorderPainted(false);
        jb17.add(fl17);
        fl17.add(yl17);
        fl17.add(nl17);


        JButton jb18 = new JButton("按钮4");
        jb18.setBackground(c);
        jb18.setOpaque(false);//消除背景颜色
        jb18.setBorderPainted(false);//消除边框颜色
        JPanel fl18 = new JPanel(new GridLayout(2, 1));
        JButton yl18 = new JButton();
        yl18.setBackground(c);
        yl18.setOpaque(false);
        yl18.setBorderPainted(false);
        JButton nl18 = new JButton();
        nl18.setBackground(c);
        nl18.setOpaque(false);
        nl18.setBorderPainted(false);
        jb18.add(fl18);
        fl18.add(yl18);
        fl18.add(nl18);


        JButton jb19 = new JButton("按钮5");
        jb19.setBackground(c);
        jb19.setOpaque(false);//消除背景颜色
        jb19.setBorderPainted(false);//消除边框颜色
        JPanel fl19 = new JPanel(new GridLayout(2, 1));
        JButton yl19 = new JButton();
        yl19.setBackground(c);
        yl19.setOpaque(false);
        yl19.setBorderPainted(false);
        JButton nl19 = new JButton();
        nl19.setBackground(c);
        nl19.setOpaque(false);
        nl19.setBorderPainted(false);
        jb19.add(fl19);
        fl19.add(yl19);
        fl19.add(nl19);


        JButton jb20 = new JButton("按钮6");
        jb20.setBackground(Color.pink);//按钮中背景颜色
        jb20.setForeground(Color.red);//按钮中字体颜色
        jb20.setBorderPainted(false);
        JPanel fl20 = new JPanel(new GridLayout(2, 1));
        JButton yl20 = new JButton();
        yl20.setBackground(Color.pink);//按钮中背景颜色
        yl20.setForeground(Color.red);//按钮中字体颜色
        yl20.setBorderPainted(false);
        JButton nl20 = new JButton();
        nl20.setBackground(Color.pink);//按钮中背景颜色
        nl20.setForeground(Color.red);//按钮中字体颜色
        nl20.setBorderPainted(false);
        jb20.add(fl20);
        fl20.add(yl20);
        fl20.add(nl20);


        JButton jb21 = new JButton("按钮7");
        jb21.setBackground(Color.pink);//按钮中背景颜色
        jb21.setForeground(Color.red);//按钮中字体颜色
        jb21.setBorderPainted(false);
        JPanel fl21 = new JPanel(new GridLayout(2, 1));
        JButton yl21 = new JButton();
        yl21.setBackground(Color.pink);//按钮中背景颜色
        yl21.setForeground(Color.red);//按钮中字体颜色
        yl21.setBorderPainted(false);
        JButton nl21 = new JButton();
        nl21.setBackground(Color.pink);//按钮中背景颜色
        nl21.setForeground(Color.red);//按钮中字体颜色
        nl21.setBorderPainted(false);
        jb21.add(fl21);
        fl21.add(yl21);
        fl21.add(nl21);


        JButton jb22 = new JButton("按钮1");
        jb22.setBackground(c);
        jb22.setOpaque(false);//消除背景颜色
        jb22.setBorderPainted(false);//消除边框颜色
        JPanel fl22 = new JPanel(new GridLayout(2, 1));
        JButton yl22 = new JButton();
        yl22.setBackground(c);
        yl22.setOpaque(false);
        yl22.setBorderPainted(false);
        JButton nl22 = new JButton();
        nl22.setBackground(c);
        nl22.setOpaque(false);
        nl22.setBorderPainted(false);
        jb22.add(fl22);
        fl22.add(yl22);
        fl22.add(nl22);


        JButton jb23 = new JButton("按钮2");
        jb23.setBackground(c);
        jb23.setOpaque(false);//消除背景颜色
        jb23.setBorderPainted(false);//消除边框颜色
        JPanel fl23 = new JPanel(new GridLayout(2, 1));
        JButton yl23 = new JButton();
        yl23.setBackground(c);
        yl23.setOpaque(false);
        yl23.setBorderPainted(false);
        JButton nl23 = new JButton();
        nl23.setBackground(c);
        nl23.setOpaque(false);
        nl23.setBorderPainted(false);
        jb23.add(fl23);
        fl23.add(yl23);
        fl23.add(nl23);


        JButton jb24 = new JButton("按钮3");
        jb24.setBackground(c);
        jb24.setOpaque(false);//消除背景颜色
        jb24.setBorderPainted(false);//消除边框颜色
        JPanel fl24 = new JPanel(new GridLayout(2, 1));
        JButton yl24 = new JButton();
        yl24.setBackground(c);
        yl24.setOpaque(false);
        yl24.setBorderPainted(false);
        JButton nl24 = new JButton();
        nl24.setBackground(c);
        nl24.setOpaque(false);
        nl24.setBorderPainted(false);
        jb24.add(fl24);
        fl24.add(yl24);
        fl24.add(nl24);


        JButton jb25 = new JButton("按钮4");
        jb25.setBackground(c);
        jb25.setOpaque(false);//消除背景颜色
        jb25.setBorderPainted(false);//消除边框颜色
        JPanel fl25 = new JPanel(new GridLayout(2, 1));
        JButton yl25 = new JButton();
        yl25.setBackground(c);
        yl25.setOpaque(false);
        yl25.setBorderPainted(false);
        JButton nl25 = new JButton();
        nl25.setBackground(c);
        nl25.setOpaque(false);
        nl25.setBorderPainted(false);
        jb25.add(fl25);
        fl25.add(yl25);
        fl25.add(nl25);


        JButton jb26 = new JButton("按钮5");
        jb26.setBackground(c);
        jb26.setOpaque(false);//消除背景颜色
        jb26.setBorderPainted(false);//消除边框颜色
        JPanel fl26 = new JPanel(new GridLayout(2, 1));
        JButton yl26 = new JButton();
        yl26.setBackground(c);
        yl26.setOpaque(false);
        yl26.setBorderPainted(false);
        JButton nl26 = new JButton();
        nl26.setBackground(c);
        nl26.setOpaque(false);
        nl26.setBorderPainted(false);
        jb26.add(fl26);
        fl26.add(yl26);
        fl26.add(nl26);


        JButton jb27 = new JButton("按钮6");
        jb27.setBackground(Color.pink);//按钮中背景颜色
        jb27.setForeground(Color.red);//按钮中字体颜色
        jb27.setBorderPainted(false);
        JPanel fl27 = new JPanel(new GridLayout(2, 1));
        JButton yl27 = new JButton();
        yl27.setBackground(Color.pink);//按钮中背景颜色
        yl27.setForeground(Color.red);//按钮中字体颜色
        yl27.setBorderPainted(false);
        JButton nl27 = new JButton();
        nl27.setBackground(Color.pink);//按钮中背景颜色
        nl27.setForeground(Color.red);//按钮中字体颜色
        nl27.setBorderPainted(false);
        jb27.add(fl27);
        fl27.add(yl27);
        fl27.add(nl27);


        JButton jb28 = new JButton("按钮7");
        jb28.setBackground(Color.pink);//按钮中背景颜色
        jb28.setForeground(Color.red);//按钮中字体颜色
        jb6.setBorderPainted(false);
        JPanel fl28 = new JPanel(new GridLayout(2, 1));
        JButton yl28 = new JButton();
        yl28.setBackground(Color.pink);//按钮中背景颜色
        yl28.setForeground(Color.red);//按钮中字体颜色
        yl28.setBorderPainted(false);
        JButton nl28 = new JButton();
        nl28.setBackground(Color.pink);//按钮中背景颜色
        nl28.setForeground(Color.red);//按钮中字体颜色
        nl28.setBorderPainted(false);
        jb28.add(fl28);
        fl28.add(yl28);
        fl28.add(nl28);


        JButton jb29 = new JButton("按钮1");
        jb29.setBackground(c);
        jb29.setOpaque(false);//消除背景颜色
        jb29.setBorderPainted(false);//消除边框颜色
        JPanel fl29 = new JPanel(new GridLayout(2, 1));
        JButton yl29 = new JButton();
        yl29.setBackground(c);
        yl29.setOpaque(false);
        yl29.setBorderPainted(false);
        JButton nl29 = new JButton();
        nl29.setBackground(c);
        nl29.setOpaque(false);
        nl29.setBorderPainted(false);
        jb29.add(fl29);
        fl29.add(yl29);
        fl29.add(nl29);


        JButton jb30 = new JButton("按钮2");
        jb30.setBackground(c);
        jb30.setOpaque(false);//消除背景颜色
        jb30.setBorderPainted(false);//消除边框颜色
        JPanel fl30 = new JPanel(new GridLayout(2, 1));
        JButton yl30 = new JButton();
        yl30.setBackground(c);
        yl30.setOpaque(false);
        yl30.setBorderPainted(false);
        JButton nl30 = new JButton();
        nl30.setBackground(c);
        nl30.setOpaque(false);
        nl30.setBorderPainted(false);
        jb30.add(fl30);
        fl30.add(yl30);
        fl30.add(nl30);


        JButton jb31 = new JButton("按钮3");
        jb31.setBackground(c);
        jb31.setOpaque(false);//消除背景颜色
        jb31.setBorderPainted(false);//消除边框颜色
        JPanel fl31 = new JPanel(new GridLayout(2, 1));
        JButton yl31 = new JButton();
        yl31.setBackground(c);
        yl31.setOpaque(false);
        yl31.setBorderPainted(false);
        JButton nl31 = new JButton();
        nl31.setBackground(c);
        nl31.setOpaque(false);
        nl31.setBorderPainted(false);
        jb31.add(fl31);
        fl31.add(yl31);
        fl31.add(nl31);


        JButton jb32 = new JButton("按钮4");
        jb32.setBackground(c);
        jb32.setOpaque(false);//消除背景颜色
        jb32.setBorderPainted(false);//消除边框颜色
        JPanel fl32 = new JPanel(new GridLayout(2, 1));
        JButton yl32 = new JButton();
        yl32.setBackground(c);
        yl32.setOpaque(false);
        yl32.setBorderPainted(false);
        JButton nl32 = new JButton();
        nl32.setBackground(c);
        nl32.setOpaque(false);
        nl32.setBorderPainted(false);
        jb32.add(fl32);
        fl32.add(yl32);
        fl32.add(nl32);


        JButton jb33 = new JButton("按钮5");
        jb33.setBackground(c);
        jb33.setOpaque(false);//消除背景颜色
        jb33.setBorderPainted(false);//消除边框颜色
        JPanel fl33 = new JPanel(new GridLayout(2, 1));
        JButton yl33 = new JButton();
        yl33.setBackground(c);
        yl33.setOpaque(false);
        yl33.setBorderPainted(false);
        JButton nl33 = new JButton();
        nl33.setBackground(c);
        nl33.setOpaque(false);
        nl33.setBorderPainted(false);
        jb33.add(fl33);
        fl33.add(yl33);
        fl33.add(nl33);


        JButton jb34 = new JButton("按钮6");
        jb34.setForeground(Color.red);//按钮中字体颜色
        jb34.setBorderPainted(false);
        jb34.setOpaque(false);
        jb34.setBackground(Color.red);
        JPanel fl34 = new JPanel(new GridLayout(2, 1));
        JButton yl34 = new JButton();
        yl34.setForeground(Color.red);//按钮中字体颜色
        yl34.setBorderPainted(false);
        yl34.setOpaque(false);
        yl34.setBackground(Color.red);
        JButton nl34 = new JButton();
        nl34.setForeground(Color.red);//按钮中字体颜色
        nl34.setBorderPainted(false);
        nl34.setOpaque(false);
        nl34.setBackground(Color.red);
        jb34.add(fl34);
        fl34.add(yl34);
        fl34.add(nl34);


        JButton jb35 = new JButton("按钮7");
        jb35.setOpaque(false);
        jb35.setBackground(Color.red);
        jb35.setForeground(Color.red);//按钮中字体颜色
        jb35.setBorderPainted(false);
        JPanel fl35 = new JPanel(new GridLayout(2, 1));
        JButton yl35 = new JButton();
        yl35.setOpaque(false);
        yl35.setBackground(Color.red);
        yl35.setBackground(Color.pink);//按钮中背景颜色
        yl35.setForeground(Color.red);//按钮中字体颜色
        yl35.setBorderPainted(false);
        JButton nl35 = new JButton();
        nl35.setOpaque(false);
        nl35.setBackground(Color.red);
        nl35.setBackground(Color.pink);//按钮中背景颜色
        nl35.setForeground(Color.red);//按钮中字体颜色
        nl35.setBorderPainted(false);
        jb35.add(fl35);
        fl35.add(yl35);
        fl35.add(nl35);

        JButton jb36 = new JButton("按钮1");
        jb36.setBackground(c);
        jb36.setOpaque(false);//消除背景颜色
        jb36.setBorderPainted(false);//消除边框颜色
        JPanel fl36 = new JPanel(new GridLayout(2, 1));
        JButton yl36 = new JButton();
        yl36.setBackground(c);
        yl36.setOpaque(false);
        yl36.setBorderPainted(false);
        JButton nl36 = new JButton();
        nl36.setBackground(c);
        nl36.setOpaque(false);
        nl36.setBorderPainted(false);
        jb36.add(fl36);
        fl36.add(yl36);
        fl36.add(nl36);


        JButton jb37 = new JButton("按钮2");
        jb37.setBackground(c);
        jb37.setOpaque(false);//消除背景颜色
        jb37.setBorderPainted(false);//消除边框颜色
        JPanel fl37 = new JPanel(new GridLayout(2, 1));
        JButton yl37 = new JButton();
        yl37.setBackground(c);
        yl37.setOpaque(false);
        yl37.setBorderPainted(false);
        JButton nl37 = new JButton();
        nl37.setBackground(c);
        nl37.setOpaque(false);
        nl37.setBorderPainted(false);
        jb37.add(fl37);
        fl37.add(yl37);
        fl37.add(nl37);


        JButton jb38 = new JButton("按钮3");
        jb38.setBackground(c);
        jb38.setOpaque(false);//消除背景颜色
        jb38.setBorderPainted(false);//消除边框颜色
        JPanel fl38 = new JPanel(new GridLayout(2, 1));
        JButton yl38 = new JButton();
        yl38.setBackground(c);
        yl38.setOpaque(false);
        yl38.setBorderPainted(false);
        JButton nl38 = new JButton();
        nl38.setBackground(c);
        nl38.setOpaque(false);
        nl38.setBorderPainted(false);
        jb38.add(fl38);
        fl38.add(yl38);
        fl38.add(nl38);


        JButton jb39 = new JButton("按钮4");
        jb39.setBackground(c);
        jb39.setOpaque(false);//消除背景颜色
        jb39.setBorderPainted(false);//消除边框颜色
        JPanel fl39 = new JPanel(new GridLayout(2, 1));
        JButton yl39 = new JButton();
        yl39.setBackground(c);
        yl39.setOpaque(false);
        yl39.setBorderPainted(false);
        JButton nl39 = new JButton();
        nl39.setBackground(c);
        nl39.setOpaque(false);
        nl39.setBorderPainted(false);
        jb39.add(fl39);
        fl39.add(yl39);
        fl39.add(nl39);


        JButton jb40 = new JButton("按钮5");
        jb40.setBackground(c);
        jb40.setOpaque(false);//消除背景颜色
        jb40.setBorderPainted(false);//消除边框颜色
        JPanel fl40 = new JPanel(new GridLayout(2, 1));
        JButton yl40 = new JButton();
        yl40.setBackground(c);
        yl40.setOpaque(false);
        yl40.setBorderPainted(false);
        JButton nl40 = new JButton();
        nl40.setBackground(c);
        nl40.setOpaque(false);
        nl40.setBorderPainted(false);
        jb40.add(fl40);
        fl40.add(yl40);
        fl40.add(nl40);


        JButton jb41 = new JButton("按钮6");
        jb41.setOpaque(false);
        jb41.setBackground(Color.red);
        jb41.setForeground(Color.red);//按钮中字体颜色
        jb41.setBorderPainted(false);
        JPanel fl41 = new JPanel(new GridLayout(2, 1));
        JButton yl41 = new JButton();
        yl41.setOpaque(false);
        yl41.setBackground(Color.red);
        yl41.setForeground(Color.red);//按钮中字体颜色
        yl41.setBorderPainted(false);
        JButton nl41 = new JButton();
        nl41.setOpaque(false);
        nl41.setBackground(Color.red);
        nl41.setBackground(Color.pink);//按钮中背景颜色
        nl41.setForeground(Color.red);//按钮中字体颜色
        nl41.setBorderPainted(false);
        jb41.add(fl41);
        fl41.add(yl41);
        fl41.add(nl41);


        JButton jb42 = new JButton("按钮7");
        jb42.setOpaque(false);
        jb42.setBackground(Color.red);
        jb42.setForeground(Color.red);//按钮中字体颜色
        jb42.setBorderPainted(false);
        JPanel fl42 = new JPanel(new GridLayout(2, 1));
        JButton yl42 = new JButton();
        yl42.setOpaque(false);
        yl42.setBackground(Color.red);
        yl42.setForeground(Color.red);//按钮中字体颜色
        yl42.setBorderPainted(false);
        JButton nl42 = new JButton();
        nl42.setOpaque(false);
        nl42.setBackground(Color.red);
        nl42.setForeground(Color.red);//按钮中字体颜色
        nl42.setBorderPainted(false);
        jb42.add(fl42);
        fl42.add(yl42);
        fl42.add(nl42);


        JButton xq1 = new JButton("星期一");
        xq1.setForeground(Color.red);//按钮中字体颜色
        xq1.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
//        xq1.setBounds(10,10,10,10);
        xq1.setBackground(c);
        xq1.setOpaque(false);
        xq1.setBorderPainted(false);

        JButton xq2 = new JButton("星期二");
        xq2.setForeground(Color.red);//按钮中字体颜色
        xq2.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        xq2.setBackground(c);
        xq2.setOpaque(false);
        xq2.setBorderPainted(false);

        JButton xq3 = new JButton("星期三");
        xq3.setForeground(Color.red);//按钮中字体颜色
        xq3.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        xq3.setBackground(c);
        xq3.setOpaque(false);
        xq3.setBorderPainted(false);

        JButton xq4 = new JButton("星期四");
        xq4.setForeground(Color.red);//按钮中字体颜色
        xq4.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        xq4.setBackground(c);
        xq4.setOpaque(false);
        xq4.setBorderPainted(false);

        JButton xq5 = new JButton("星期五");
        xq5.setForeground(Color.red);//按钮中字体颜色
        xq5.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        xq5.setBackground(c);
        xq5.setOpaque(false);
        xq5.setBorderPainted(false);

        JButton xq6 = new JButton("星期六");
        xq6.setForeground(Color.red);//按钮中字体颜色
        xq6.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        xq6.setBackground(Color.pink);//按钮中背景颜色
        xq6.setForeground(Color.red);//按钮中字体颜色
        xq6.setBorderPainted(false);

        JButton xq7 = new JButton("星期日");
        xq7.setForeground(Color.red);//按钮中字体颜色
        xq7.setFont(new Font("楷体", Font.BOLD, 16));//设置字体类型,格式,大小
        xq7.setBackground(Color.pink);//按钮中背景颜色
        xq7.setForeground(Color.red);//按钮中字体颜色
        xq7.setBorderPainted(false);


        jp.add(jp1);
        jb.add(xq1);
        jb.add(xq2);
        jb.add(xq3);
        jb.add(xq4);
        jb.add(xq5);
        jb.add(xq6);
        jb.add(xq7);
        jb.add(jb1);
        jb.add(jb2);
        jb.add(jb3);
        jb.add(jb4);
        jb.add(jb5);
        jb.add(jb6);
        jb.add(jb7);
        jb.add(jb8);
        jb.add(jb9);
        jb.add(jb10);
        jb.add(jb11);
        jb.add(jb12);
        jb.add(jb13);
        jb.add(jb14);
        jb.add(jb15);
        jb.add(jb16);
        jb.add(jb17);
        jb.add(jb18);
        jb.add(jb19);
        jb.add(jb20);
        jb.add(jb21);
        jb.add(jb22);
        jb.add(jb23);
        jb.add(jb24);
        jb.add(jb25);
        jb.add(jb26);
        jb.add(jb27);
        jb.add(jb28);
        jb.add(jb29);
        jb.add(jb30);
        jb.add(jb31);
        jb.add(jb32);
        jb.add(jb33);
        jb.add(jb34);
        jb.add(jb35);
        jb.add(jb36);
        jb.add(jb37);
        jb.add(jb38);
        jb.add(jb39);
        jb.add(jb40);
        jb.add(jb41);
        jb.add(jb42);


        jp.add(jp1, BorderLayout.NORTH);
        jp.add(jp2);
        this.add(jp);
        jp1.add(jba);
        jp2.add(jb);


        this.setVisible(true);
        SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间
        SimpleDateFormat sdf1 = new SimpleDateFormat();
        sdf.applyPattern("yyyy");
        sdf1.applyPattern("MM");
        Date date = new Date();// 获取当前时间
        String ye = sdf.format(date);
        String mo = sdf1.format(date);
        int yea = Integer.parseInt(ye);
        int mot = Integer.parseInt(mo);
        int totaldays = 0;
        for (int i = 1900; i < yea; i++) {    //
            if ((i % 400 == 0) || (i % 4 == 0 && i % 100 != 0)) {
                totaldays += 366;
            } else {
                totaldays += 365;
            }
        }
        totaldays += monthdays(mot, yea);
        int x = 1 + totaldays % 7;

        if (x == 7) {
            x = 0;
        }
        int days = monthday(mot, yea);
        int n, a = 1;
        Calendar today = Calendar.getInstance();
        SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        Mbin lunar;
        String s;

        for (int i = x; i < days + x; i++) {

            switch (i) {
                case 1:
                    yl1.setText("" + a);
                    s = yea + "年" + mo + "月" + a + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl1.setText(String.valueOf(lunar));
                    break;
                case 2:
                    yl2.setText("" + a);
                    s = yea + "年" + mo + "月" + a + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl2.setText(String.valueOf(lunar));
                    break;
                case 3:
                    yl3.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl3.setText(String.valueOf(lunar));
                    break;
                case 4:
                    yl4.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl4.setText(String.valueOf(lunar));
                    break;
                case 5:
                    yl5.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);

                    nl5.setText(String.valueOf(lunar));
                    break;
                case 6:
                    yl6.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl6.setText(String.valueOf(lunar));
                    break;
                case 7:
                    yl7.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl7.setText(String.valueOf(lunar));
                    break;
                case 8:
                    yl8.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl8.setText(String.valueOf(lunar));
                    break;
                case 9:
                    yl9.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl9.setText(String.valueOf(lunar));
                    break;
                case 10:
                    yl10.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl10.setText(String.valueOf(lunar));
                    break;
                case 11:
                    yl11.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl11.setText(String.valueOf(lunar));
                    break;
                case 12:
                    yl12.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl12.setText(String.valueOf(lunar));
                    break;
                case 13:
                    yl13.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl13.setText(String.valueOf(lunar));
                    break;
                case 14:
                    yl14.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl14.setText(String.valueOf(lunar));
                    break;
                case 15:
                    yl15.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl15.setText(String.valueOf(lunar));
                    break;
                case 16:
                    yl16.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl16.setText(String.valueOf(lunar));
                    break;
                case 17:
                    yl17.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl17.setText(String.valueOf(lunar));
                    break;
                case 18:
                    yl18.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl18.setText(String.valueOf(lunar));
                    break;
                case 19:
                    yl19.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl19.setText(String.valueOf(lunar));
                    break;
                case 20:
                    yl20.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl20.setText(String.valueOf(lunar));
                    break;
                case 21:
                    yl21.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl21.setText(String.valueOf(lunar));
                    break;
                case 22:
                    yl22.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl22.setText(String.valueOf(lunar));
                    break;
                case 23:
                    yl23.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl23.setText(String.valueOf(lunar));
                    break;
                case 24:
                    yl24.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl24.setText(String.valueOf(lunar));
                    break;
                case 25:
                    yl25.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl25.setText(String.valueOf(lunar));
                    break;
                case 26:
                    yl26.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl26.setText(String.valueOf(lunar));
                    break;
                case 27:
                    yl27.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl27.setText(String.valueOf(lunar));
                    break;
                case 28:
                    yl28.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl28.setText(String.valueOf(lunar));
                    break;
                case 29:
                    yl29.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl29.setText(String.valueOf(lunar));
                    break;
                case 30:
                    yl30.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl30.setText(String.valueOf(lunar));
                    break;
                case 31:
                    yl31.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl31.setText(String.valueOf(lunar));
                    break;
                case 32:
                    yl32.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl32.setText(String.valueOf(lunar));
                    break;
                case 33:
                    yl33.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl33.setText(String.valueOf(lunar));
                    break;
                case 34:
                    yl34.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl34.setText(String.valueOf(lunar));
                    jb34.setOpaque(true);
                    jb34.setBackground(Color.pink);//按钮中背景颜色
                    yl34.setOpaque(true);
                    yl34.setBackground(Color.pink);
                    nl34.setOpaque(true);
                    nl34.setBackground(Color.pink);
                    break;
                case 35:
                    yl35.setText("" + a);
                    s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl35.setText(String.valueOf(lunar));
                    jb35.setOpaque(true);
                    jb35.setBackground(Color.pink);//按钮中背景颜色
                    yl35.setOpaque(true);
                    yl35.setBackground(Color.pink);
                    nl35.setOpaque(true);
                    nl35.setBackground(Color.pink);
                    break;
                case 36:
                    yl36.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl36.setText(String.valueOf(lunar));
                    break;
                case 37:
                    yl37.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl37.setText(String.valueOf(lunar));
                    break;
                case 38:
                    yl38.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl38.setText(String.valueOf(lunar));
                    break;
                case 39:
                    yl39.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl39.setText(String.valueOf(lunar));
                    break;
                case 40:
                    yl40.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl40.setText(String.valueOf(lunar));
                    break;
                case 41:
                    yl41.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl41.setText(String.valueOf(lunar));
                    jb41.setOpaque(true);
                    jb41.setBackground(Color.pink);//按钮中背景颜色
                    yl41.setOpaque(true);
                    yl41.setBackground(Color.pink);
                    nl41.setOpaque(true);
                    nl41.setBackground(Color.pink);
                    break;
                case 42:
                    yl42.setText("" + a);
                    s = yea + "年" + mo + "月" + String.valueOf(a) + "日";
                    today.setTime(chineseDateFormat.parse(s));
                    lunar = new Mbin(today);
                    nl42.setText(String.valueOf(lunar));
                    jb42.setOpaque(true);
                    jb42.setBackground(Color.pink);//按钮中背景颜色
                    yl42.setOpaque(true);
                    yl42.setBackground(Color.pink);
                    nl42.setOpaque(true);
                    nl42.setBackground(Color.pink);
                    break;
            }

            a++;

        }
        try {
            jba3.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    String year = year1.getText();
                    String month = month1.getText();

                    if (year.length() == 0) {
                        JOptionPane.showMessageDialog(null, "年份不能为空", "系统提示", JOptionPane.WARNING_MESSAGE);
                        return ;
                    }
                    if (month.length() == 0) {
                        JOptionPane.showMessageDialog(null, "月份不能为空");
                        return ;
                    }
                    int y = Integer.parseInt(year);
                    int m = Integer.parseInt(month);
                    if (y < 1900) {
                        JOptionPane.showMessageDialog(null, "年份不能小于1900年");
                    }
                    if (m < 1 || m > 12)
                        JOptionPane.showMessageDialog(null, "月份请输入1-12月");

                    int totaldays = 0;
                    for (int i = 1900; i < y; i++) {    //
                        if ((i % 400 == 0) || (i % 4 == 0 && i % 100 != 0)) {
                            totaldays += 366;
                        } else {
                            totaldays += 365;
                        }
                    }
                    totaldays += monthdays(m, y);
                    int x = 1 + totaldays % 7;

                    if (x == 7) {
                        x = 0;
                    }
                    int days = monthday(m, y);
                    int n, a = 1;


                    yl1.setText("");
                    yl2.setText("");
                    yl3.setText("");
                    yl4.setText("");
                    yl5.setText("");
                    yl6.setText("");
                    yl7.setText("");
                    yl8.setText("");
                    yl9.setText("");
                    yl10.setText("");
                    yl11.setText("");
                    yl12.setText("");
                    yl13.setText("");
                    yl14.setText("");
                    yl15.setText("");
                    yl16.setText("");
                    yl17.setText("");
                    yl18.setText("");
                    yl19.setText("");
                    yl20.setText("");
                    yl21.setText("");
                    yl22.setText("");
                    yl23.setText("");
                    yl24.setText("");
                    yl25.setText("");
                    yl26.setText("");
                    yl27.setText("");
                    yl28.setText("");
                    yl29.setText("");
                    yl30.setText("");
                    yl31.setText("");
                    yl32.setText("");
                    yl33.setText("");
                    yl34.setText("");
                    yl35.setText("");
                    yl36.setText("");
                    yl37.setText("");
                    yl38.setText("");
                    yl39.setText("");
                    yl40.setText("");
                    yl41.setText("");
                    yl42.setText("");
                    nl1.setText("");
                    nl2.setText("");
                    nl3.setText("");
                    nl4.setText("");
                    nl5.setText("");
                    nl6.setText("");
                    nl7.setText("");
                    nl8.setText("");
                    nl9.setText("");
                    nl10.setText("");
                    nl11.setText("");
                    nl12.setText("");
                    nl13.setText("");
                    nl14.setText("");
                    nl15.setText("");
                    nl16.setText("");
                    nl17.setText("");
                    nl18.setText("");
                    nl19.setText("");
                    nl20.setText("");
                    nl21.setText("");
                    nl22.setText("");
                    nl23.setText("");
                    nl24.setText("");
                    nl25.setText("");
                    nl26.setText("");
                    nl27.setText("");
                    nl28.setText("");
                    nl29.setText("");
                    nl30.setText("");
                    nl31.setText("");
                    nl32.setText("");
                    nl33.setText("");
                    nl34.setText("");
                    nl35.setText("");
                    nl36.setText("");
                    nl37.setText("");
                    nl38.setText("");
                    nl39.setText("");
                    nl40.setText("");
                    nl41.setText("");
                    nl42.setText("");
                    Calendar today = Calendar.getInstance();
                    SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
                    Mbin lunar;
                    String s;
                    try {


                        for (int i = x; i < days + x; i++) {

                            switch (i) {
                                case 1:
                                    yl1.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl1.setText(String.valueOf(lunar));
                                    break;
                                case 2:
                                    yl2.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl2.setText(String.valueOf(lunar));
                                    break;
                                case 3:
                                    yl3.setText("" + a);  
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl3.setText(String.valueOf(lunar));
                                    break;
                                case 4:
                                    yl4.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl4.setText(String.valueOf(lunar));
                                    break;
                                case 5:
                                    yl5.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl5.setText(String.valueOf(lunar));
                                    break;
                                case 6:
                                    yl6.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl6.setText(String.valueOf(lunar));
                                    break;
                                case 7:
                                    yl7.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl7.setText(String.valueOf(lunar));
                                    break;
                                case 8:
                                    yl8.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl8.setText(String.valueOf(lunar));
//                                    nl8.setText(nljq(m,a));
//                                    System.out.println(nljq(m,a));
                                    break;
                                case 9:
                                    yl9.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl9.setText(String.valueOf(lunar));
                                    break;
                                case 10:
                                    yl10.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl10.setText(String.valueOf(lunar));
                                    break;
                                case 11:
                                    yl11.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl11.setText(String.valueOf(lunar));
                                    break;
                                case 12:
                                    yl12.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl12.setText(String.valueOf(lunar));
                                    break;
                                case 13:
                                    yl13.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl13.setText(String.valueOf(lunar));
                                    break;
                                case 14:
                                    yl14.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl14.setText(String.valueOf(lunar));
                                    break;
                                case 15:
                                    yl15.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl15.setText(String.valueOf(lunar));
                                    break;
                                case 16:
                                    yl16.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl16.setText(String.valueOf(lunar));
                                    break;
                                case 17:
                                    yl17.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl17.setText(String.valueOf(lunar));
                                    break;
                                case 18:
                                    yl18.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl18.setText(String.valueOf(lunar));
                                    break;
                                case 19:
                                    yl19.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl19.setText(String.valueOf(lunar));
                                    break;
                                case 20:
                                    yl20.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl20.setText(String.valueOf(lunar));
                                    break;
                                case 21:
                                    yl21.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl21.setText(String.valueOf(lunar));
                                    break;
                                case 22:
                                    yl22.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl22.setText(String.valueOf(lunar));
                                    break;
                                case 23:
                                    yl23.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl23.setText(String.valueOf(lunar));
                                    break;
                                case 24:
                                    yl24.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl24.setText(String.valueOf(lunar));
                                    break;
                                case 25:
                                    yl25.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl25.setText(String.valueOf(lunar));
                                    break;
                                case 26:
                                    yl26.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl26.setText(String.valueOf(lunar));
                                    break;
                                case 27:
                                    yl27.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl27.setText(String.valueOf(lunar));
                                    break;
                                case 28:
                                    yl28.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl28.setText(String.valueOf(lunar));
                                    break;
                                case 29:
                                    yl29.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl29.setText(String.valueOf(lunar));
                                    break;
                                case 30:
                                    yl30.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl30.setText(String.valueOf(lunar));
                                    break;
                                case 31:
                                    yl31.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl31.setText(String.valueOf(lunar));
                                    break;
                                case 32:
                                    yl32.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl32.setText(String.valueOf(lunar));
                                    break;
                                case 33:
                                    yl33.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl33.setText(String.valueOf(lunar));
                                    break;
                                case 34:
                                    yl34.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl34.setText(String.valueOf(lunar));
                                    jb34.setOpaque(true);
                                    jb34.setBackground(Color.pink);//按钮中背景颜色
                                    yl34.setOpaque(true);
                                    yl34.setBackground(Color.pink);
                                    nl34.setOpaque(true);
                                    nl34.setBackground(Color.pink);
                                    break;
                                case 35:
                                    yl35.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl35.setText(String.valueOf(lunar));
                                    jb35.setOpaque(true);
                                    jb35.setBackground(Color.pink);//按钮中背景颜色
                                    yl35.setOpaque(true);
                                    yl35.setBackground(Color.pink);
                                    nl35.setOpaque(true);
                                    nl35.setBackground(Color.pink);
                                    break;
                                case 36:
                                    yl36.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl36.setText(String.valueOf(lunar));
                                    break;
                                case 37:
                                    yl37.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl37.setText(String.valueOf(lunar));
                                    break;
                                case 38:
                                    yl38.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl38.setText(String.valueOf(lunar));
                                    break;
                                case 39:
                                    yl39.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl39.setText(String.valueOf(lunar));
                                    break;
                                case 40:
                                    yl40.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl40.setText(String.valueOf(lunar));
                                    break;
                                case 41:
                                    yl41.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl41.setText(String.valueOf(lunar));
                                    jb41.setOpaque(true);
                                    jb41.setBackground(Color.pink);//按钮中背景颜色
                                    yl41.setOpaque(true);
                                    yl41.setBackground(Color.pink);
                                    nl41.setOpaque(true);
                                    nl41.setBackground(Color.pink);
                                    break;
                                case 42:
                                    yl42.setText("" + a);
                                    s = y + "年" + m + "月" + a + "日";
                                    today.setTime(chineseDateFormat.parse(s));
                                    lunar = new Mbin(today);
                                    nl42.setText(String.valueOf(lunar));
                                    jb42.setOpaque(true);
                                    jb42.setBackground(Color.pink);//按钮中背景颜色
                                    yl42.setOpaque(true);
                                    yl42.setBackground(Color.pink);
                                    nl42.setOpaque(true);
                                    nl42.setBackground(Color.pink);
                                    break;
                            }

                            a++;
                        }
                    }catch (Exception e2){

                    }

                }
            });
        } catch (Exception e1) {
            JOptionPane.showMessageDialog(null, "运行异常");
        }
        jba6.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                yl1.setText("");
                yl2.setText("");
                yl3.setText("");
                yl4.setText("");
                yl5.setText("");
                yl6.setText("");
                yl7.setText("");
                yl8.setText("");
                yl9.setText("");
                yl10.setText("");
                yl11.setText("");
                yl12.setText("");
                yl13.setText("");
                yl14.setText("");
                yl15.setText("");
                yl16.setText("");
                yl17.setText("");
                yl18.setText("");
                yl19.setText("");
                yl20.setText("");
                yl21.setText("");
                yl22.setText("");
                yl23.setText("");
                yl24.setText("");
                yl25.setText("");
                yl26.setText("");
                yl27.setText("");
                yl28.setText("");
                yl29.setText("");
                yl30.setText("");
                yl31.setText("");
                yl32.setText("");
                yl33.setText("");
                yl34.setText("");
                yl35.setText("");
                yl36.setText("");
                yl37.setText("");
                yl38.setText("");
                yl39.setText("");
                yl40.setText("");
                yl41.setText("");
                yl42.setText("");
                nl1.setText("");
                nl2.setText("");
                nl3.setText("");
                nl4.setText("");
                nl5.setText("");
                nl6.setText("");
                nl7.setText("");
                nl8.setText("");
                nl9.setText("");
                nl10.setText("");
                nl11.setText("");
                nl12.setText("");
                nl13.setText("");
                nl14.setText("");
                nl15.setText("");
                nl16.setText("");
                nl17.setText("");
                nl18.setText("");
                nl19.setText("");
                nl20.setText("");
                nl21.setText("");
                nl22.setText("");
                nl23.setText("");
                nl24.setText("");
                nl25.setText("");
                nl26.setText("");
                nl27.setText("");
                nl28.setText("");
                nl29.setText("");
                nl30.setText("");
                nl31.setText("");
                nl32.setText("");
                nl33.setText("");
                nl34.setText("");
                nl35.setText("");
                nl36.setText("");
                nl37.setText("");
                nl38.setText("");
                nl39.setText("");
                nl40.setText("");
                nl41.setText("");
                nl42.setText("");

                String ye = sdf.format(date);
                String mo = sdf1.format(date);
                int yea = Integer.parseInt(ye);
                int mot = Integer.parseInt(mo);
                year1.setText("" + yea);
                month1.setText("" + mo);
                int totaldays = 0;
                for (int i = 1900; i < yea; i++) {    //
                    if ((i % 400 == 0) || (i % 4 == 0 && i % 100 != 0)) {
                        totaldays += 366;
                    } else {
                        totaldays += 365;
                    }
                }
                totaldays += monthdays(mot, yea);
                int x = 1 + totaldays % 7;

                if (x == 7) {
                    x = 0;
                }
                int days = monthday(mot, yea);
                int n, a = 1;
                Calendar today = Calendar.getInstance();
                SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
                Mbin lunar;
                String s;
                try {
                    for (int i = x; i < days + x; i++) {

                        switch (i) {
                            case 1:
                                yl1.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl1.setText(String.valueOf(lunar));
                                break;
                            case 2:
                                yl2.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl2.setText(String.valueOf(lunar));
                                break;
                            case 3:
                                yl3.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl3.setText(String.valueOf(lunar));
                                break;
                            case 4:
                                yl4.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl4.setText(String.valueOf(lunar));
                                break;
                            case 5:
                                yl5.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl5.setText(String.valueOf(lunar));
                                break;
                            case 6:
                                yl6.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl6.setText(String.valueOf(lunar));
                                break;
                            case 7:
                                yl7.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl7.setText(String.valueOf(lunar));
                                break;
                            case 8:
                                yl8.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl8.setText(String.valueOf(lunar));
                                break;
                            case 9:
                                yl9.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl9.setText(String.valueOf(lunar));
                                break;
                            case 10:
                                yl10.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl10.setText(String.valueOf(lunar));
                                break;
                            case 11:
                                yl11.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl11.setText(String.valueOf(lunar));
                                break;
                            case 12:
                                yl12.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl12.setText(String.valueOf(lunar));
                                break;
                            case 13:
                                yl13.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl13.setText(String.valueOf(lunar));
                                break;
                            case 14:
                                yl14.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl14.setText(String.valueOf(lunar));
                                break;
                            case 15:
                                yl15.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl15.setText(String.valueOf(lunar));
                                break;
                            case 16:
                                yl16.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl16.setText(String.valueOf(lunar));
                                break;
                            case 17:
                                yl17.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl17.setText(String.valueOf(lunar));
                                break;
                            case 18:
                                yl18.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl18.setText(String.valueOf(lunar));
                                break;
                            case 19:
                                yl19.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl19.setText(String.valueOf(lunar));
                                break;
                            case 20:
                                yl20.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl20.setText(String.valueOf(lunar));
                                break;
                            case 21:
                                yl21.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl21.setText(String.valueOf(lunar));
                                break;
                            case 22:
                                yl22.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl22.setText(String.valueOf(lunar));
                                break;
                            case 23:
                                yl23.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl23.setText(String.valueOf(lunar));
                                break;
                            case 24:
                                yl24.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl24.setText(String.valueOf(lunar));
                                break;
                            case 25:
                                yl25.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl25.setText(String.valueOf(lunar));
                                break;
                            case 26:
                                yl26.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl26.setText(String.valueOf(lunar));
                                break;
                            case 27:
                                yl27.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl27.setText(String.valueOf(lunar));
                                break;
                            case 28:
                                yl28.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl28.setText(String.valueOf(lunar));
                                break;
                            case 29:
                                yl29.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl29.setText(String.valueOf(lunar));
                                break;
                            case 30:
                                yl30.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl30.setText(String.valueOf(lunar));
                                break;
                            case 31:
                                yl31.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl31.setText(String.valueOf(lunar));
                                break;
                            case 32:
                                yl32.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl32.setText(String.valueOf(lunar));
                                break;
                            case 33:
                                yl33.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl33.setText(String.valueOf(lunar));
                                break;
                            case 34:
                                yl34.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl34.setText(String.valueOf(lunar));
                                jb34.setOpaque(true);
                                jb34.setBackground(Color.pink);//按钮中背景颜色
                                yl34.setOpaque(true);
                                yl34.setBackground(Color.pink);
                                nl34.setOpaque(true);
                                nl34.setBackground(Color.pink);
                                break;
                            case 35:
                                yl35.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl35.setText(String.valueOf(lunar));
                                jb35.setOpaque(true);
                                jb35.setBackground(Color.pink);//按钮中背景颜色
                                yl35.setOpaque(true);
                                yl35.setBackground(Color.pink);
                                nl35.setOpaque(true);
                                nl35.setBackground(Color.pink);
                                break;
                            case 36:
                                yl36.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl36.setText(String.valueOf(lunar));
                                break;
                            case 37:
                                yl37.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl37.setText(String.valueOf(lunar));
                                break;
                            case 38:
                                yl38.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl38.setText(String.valueOf(lunar));
                                break;
                            case 39:
                                yl39.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl39.setText(String.valueOf(lunar));
                                break;
                            case 40:
                                yl40.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl40.setText(String.valueOf(lunar));
                                break;
                            case 41:
                                yl41.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl41.setText(String.valueOf(lunar));
                                jb41.setOpaque(true);
                                jb41.setBackground(Color.pink);//按钮中背景颜色
                                yl41.setOpaque(true);
                                yl41.setBackground(Color.pink);
                                nl41.setOpaque(true);
                                nl41.setBackground(Color.pink);
                                break;
                            case 42:
                                yl42.setText("" + a);
                                s = ye + "年" + mo + "月" + String.valueOf(a) + "日";
                                today.setTime(chineseDateFormat.parse(s));
                                lunar = new Mbin(today);
                                nl42.setText(String.valueOf(lunar));
                                jb42.setOpaque(true);
                                jb42.setBackground(Color.pink);//按钮中背景颜色
                                yl42.setOpaque(true);
                                yl42.setBackground(Color.pink);
                                nl42.setOpaque(true);
                                nl42.setBackground(Color.pink);
                                break;
                        }

                        a++;
                    }
                }catch (Exception e3){
                    return;
                }
            }
        });
    }

    public static int monthdays(int month, int year) {
        int totaldays = 0;
        for (int i = 1; i < month; i++) {
            totaldays += monthday(i, year);
        }
        return   totaldays;
    }


    public static int monthday(int month, int year) {

        if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
            int[] arr = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
            return  arr[month];
        } else {
            int[] arr = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
            return arr[month];
        }

    }

    public String nljq(int month, int day){

        String xh = "小寒", dh = "大寒", lc = "立春",
                ys = "雨水", jz = "惊蛰", cf = "春分", qm = "清明", gy = "谷雨", lx = "立夏", xm = "小满", mz = "芒种", xz = "夏至", xs = "小暑", ds = "大暑",
                lq = "立秋", cs = "处暑", bl = "白露", qf = "秋分", hl = "寒露", sj = "霜降", ld = "立冬", xx = "小雪",dx =  "大雪", dz = "冬至";
        String sum = null;



        if(month==2&&day==4) sum =  lc;
        if(month==2&&day==19) sum =  ys;
        if(month==3&&day==6) sum =  jz;
        if(month==3&&day==21) sum =  cf;
        if(month==4&&day==5) sum =  qm;
        if(month==4&&day==21) sum =  gy;
        if(month==5&&day==6) sum =  lx;
        if(month==5&&day==21) sum =  xm;
        if(month==6&&day==6) sum =  mz;
        if(month==6&&day==22) sum =  xz;
        if(month==7&&day==7) sum =  xs;
        if(month==7&&day==23) sum =  ds;
        if(month==8&&day==8) sum =  lq;
        if(month==8&&day==23) sum =  cs;
        if(month==9&&day==8) sum =  bl;
        if(month==9&&day==23) sum =  qf;
        if(month==10&&day==8) sum =  hl;
        if(month==10&&day==23) sum =  sj;
        if(month==11&&day==8) sum =  ld;
        if(month==11&&day==23) sum =  xx;
        if(month==12&&day==8) sum =  dx;
        if(month==12&&day==21) sum =  dz;
        if(month==1&&day==6) sum =  xh;
        if(month==1&&day==21) sum =  dh;
        if(month==1&&day==1) sum = "正月";
        if(month==2&&day==1) sum = "二月";
        if(month==3&&day==1) sum = "三月";
        if(month==4&&day==1) sum = "四月";
        if(month==5&&day==1) sum = "五月";
        if(month==6&&day==1) sum = "六月";
        if(month==7&&day==1) sum = "七月";
        if(month==8&&day==1) sum = "八月";
        if(month==9&&day==1) sum = "九月";
        if(month==10&&day==1) sum = "十月";
        if(month==11&&day==1) sum = "冬月";
        if(month==12&&day==1) sum = "腊月";


        return sum;
    }

    public static void main(String[] args) throws ParseException {
        wanNianLi jFrame = new wanNianLi();

    }
}


农历算法

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public  class Mbin {
    private int year;
    private int month;
    private int day;
    private boolean leap;
    final static String chineseNumber[] = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"};
    static SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
    final static long[] lunarInfo = new long[]
            {0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
                    0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
                    0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
                    0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,
                    0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557,
                    0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0,
                    0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0,
                    0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6,
                    0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570,
                    0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0,
                    0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5,
                    0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,
                    0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530,
                    0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,
                    0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0};

    //====== 传回农历 y年的总天数
    final private static int yearDays(int y) {
        int i, sum = 348;
        for (i = 0x8000; i > 0x8; i >>= 1) {
            if ((lunarInfo[y - 1900] & i) != 0) sum += 1;
        }
        return (sum + leapDays(y));
    }

    //====== 传回农历 y年闰月的天数
    final private static int leapDays(int y) {
        if (leapMonth(y) != 0) {
            if ((lunarInfo[y - 1900] & 0x10000) != 0)
                return 30;
            else
                return 29;
        } else
            return 0;
    }

    //====== 传回农历 y年闰哪个月 1-12 , 没闰传回 0
    final private static int leapMonth(int y) {
        return (int) (lunarInfo[y - 1900] & 0xf);
    }

    //====== 传回农历 y年m月的总天数
    final private static int monthDays(int y, int m) {
        if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)
            return 29;
        else
            return 30;
    }

    //====== 传回农历 y年的生肖
    final public String animalsYear() {
        final String[] Animals = new String[]{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"};
        return Animals[(year - 4) % 12];
    }

    //====== 传入 月日的offset 传回干支, 0=甲子
    final private static String cyclicalm(int num) {
        final String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"};
        final String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"};
        return (Gan[num % 10] + Zhi[num % 12]);
    }

    //====== 传入 offset 传回干支, 0=甲子
    final public String cyclical() {
        int num = year - 1900 + 36;
        return (cyclicalm(num));
    }

    /** */
    /**
     * 传出y年m月d日对应的农历.
     * yearCyl3:农历年与1864的相差数              ?
     * monCyl4:从1900年1月31日以来,闰月数
     * dayCyl5:与1900年1月31日相差的天数,再加40      ?
     *
     * @param cal
     * @return
     */
    public Mbin(Calendar cal) {
        @SuppressWarnings("unused") int yearCyl, monCyl, dayCyl;
        int leapMonth = 0;
        Date baseDate = null;
        try {
            baseDate = chineseDateFormat.parse("1900年1月31日");
        } catch (ParseException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }

        //求出和1900年1月31日相差的天数
        int offset = (int) ((cal.getTime().getTime() - baseDate.getTime()) / 86400000L);
        dayCyl = offset + 40;
        monCyl = 14;

        //用offset减去每农历年的天数
        // 计算当天是农历第几天
        //i最终结果是农历的年份
        //offset是当年的第几天
        int iYear, daysOfYear = 0;
        for (iYear = 1900; iYear < 2050 && offset > 0; iYear++) {
            daysOfYear = yearDays(iYear);
            offset -= daysOfYear;
            monCyl += 12;
        }
        if (offset < 0) {
            offset += daysOfYear;
            iYear--;
            monCyl -= 12;
        }
        //农历年份
        year = iYear;

        yearCyl = iYear - 1864;
        leapMonth = leapMonth(iYear); //闰哪个月,1-12
        leap = false;

        //用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天
        int iMonth, daysOfMonth = 0;
        for (iMonth = 1; iMonth < 13 && offset > 0; iMonth++) {
            //闰月
            if (leapMonth > 0 && iMonth == (leapMonth + 1) && !leap) {
                --iMonth;
                leap = true;
                daysOfMonth = leapDays(year);
            } else
                daysOfMonth = monthDays(year, iMonth);

            offset -= daysOfMonth;
            //解除闰月
            if (leap && iMonth == (leapMonth + 1)) leap = false;
            if (!leap) monCyl++;
        }
        //offset为0时,并且刚才计算的月份是闰月,要校正
        if (offset == 0 && leapMonth > 0 && iMonth == leapMonth + 1) {
            if (leap) {
                leap = false;
            } else {
                leap = true;
                --iMonth;
                --monCyl;
            }
        }
        //offset小于0时,也要校正
        if (offset < 0) {
            offset += daysOfMonth;
            --iMonth;
            --monCyl;
        }
        month = iMonth;
        day = offset + 1;
    }

    public static String getChinaDayString(int day) {
        String chineseTen[] = {"初", "十", "廿", "卅"};
        int n = day % 10 == 0 ? 9 : day % 10 - 1;
        if (day > 30)
            return "";
        if (day == 10)
            return "初十";
        else
            return chineseTen[day / 10] + chineseNumber[n];
    }

    public String toString() {
        return /*year + "年" + (leap ? "闰" : "") + chineseNumber[month - 1] + "月" + */getChinaDayString(day);
    }
}
/*
    public static void main(String[] args) throws ParseException {

        Scanner in = new Scanner(System.in);
        int yea = in.nextInt();
        int mot = in.nextInt();
        int a = in.nextInt();
        Calendar today = Calendar.getInstance();
//        SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy年MM月dd日");

        String s = yea + "年" + mot + "月" + a + "日";
        today.setTime(chineseDateFormat.parse(s));
        Mbin lunar = new Mbin(today);
//        nl1.setText(String.valueOf(lunar));
        System.out.println(String.valueOf(lunar));

    }
}
*/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值