日历的实现(java语言,包括钟表盘的实现、日历内部的日程提醒)

整理文件发现了大一的时候的作业,先感慨一波时间过得真的快!

手中的这个是一个独立的java文件,可以直接就可以运行,应该是没有什么问题的。不想这个代码就此落灰了,希望可以给友友们带来一点点帮助!

运行前命名为“CalendarDemo.java”并保存就可以运行。

运行界面结果如下:

日程提醒点击某一天就会弹出,填写即可:

 代码如下:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.AffineTransform;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Timer;
import java.lang.Integer;
import java.text.*;
import java.io.*;public class CalendarDemo extends JFrame {public static void main(String[] args) {CalendarDemo cd = new CalendarDemo();cd.show();}public CalendarDemo() {setTitle("xxx的java作业");Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();int width = screenSize.width/2;int height = screenSize.height/2;setSize(width, height);setResizable(true);//窗体可变  setVisible(true);setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);JSplitPane splitPane = new JSplitPane();//分割splitPane.setDividerLocation(500);splitPane.setDividerSize(10);CalendarPanel calenderPanel = new CalendarPanel(this);ColockPanel colockPanel = new ColockPanel();splitPane.setLeftComponent(calenderPanel);splitPane.setRightComponent(colockPanel);Container container = getContentPane();container.add(splitPane);new Thread(colockPanel).start();}
}
//时钟面板
class ColockPanel extends JPanel implements Runnable,ActionListener{private Label cur_clock, cur_week;private JButton cur_day;@Overrideprotected void paintComponent(Graphics g) {Graphics2D g2d = (Graphics2D) g;g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);//去锯齿g2d.setColor(Color.GRAY);g2d.fillRect(0, 0, this.getWidth(), this.getHeight());g2d.setColor(Color.GREEN);int xCenter = this.getWidth() / 2;int yCenter = this.getHeight() / 2; int radius = (int) Math.min(this.getWidth(), this.getHeight() * 0.4); //计算半径for (int i = 1; i <= 12; i++) {double dd = (Math.PI * i) / 6;int x = (int) (Math.sin(dd) * (radius - 20) + xCenter);int y = (int) (yCenter - Math.cos(dd) * (radius - 20));g2d.drawString(Integer.toString(i), x - 5, y + 7);}AffineTransform at = g2d.getTransform();for (int i = 0; i < 60; i++) {int w = i % 5 == 0 ? 3 : 1;int h = i % 5 == 0 ? 8 : 5;g2d.fillRect(xCenter - 2, yCenter - radius, w, h);//绘制矩形g2d.rotate(Math.toRadians(6), xCenter, yCenter);}//获取时间Calendar calendar = Calendar.getInstance();int second = calendar.get(Calendar.SECOND);int minute = calendar.get(Calendar.MINUTE);int hour = calendar.get(Calendar.HOUR_OF_DAY);Date currentTime = new Date();SimpleDateFormat formatter_day = new SimpleDateFormat("yyyy-MM-dd");SimpleDateFormat formatter_clock = new SimpleDateFormat("HH:mm:ss");SimpleDateFormat format_week = new SimpleDateFormat("EEEE");setFont(new Font("宋体", Font.PLAIN, 18));g2d.drawString(format_week.format(currentTime), xCenter - 25, yCenter + (radius / 2));g2d.drawString(formatter_clock.format(currentTime), xCenter - 35, yCenter + (radius / 3));g2d.drawString(formatter_day.format(currentTime), xCenter - 40, yCenter - (radius / 2));int xh = (int) (Math.sin(Math.PI / 360 * (60 * hour + minute)) * (radius / 2) + xCenter);int yh = (int) (yCenter - (Math.cos(Math.PI / 360 * (60 * hour + minute)) * (radius / 2)));int xm = (int) (Math.sin(Math.PI * minute / 30) * ((2 * radius) / 3) + xCenter);int ym = (int) (yCenter - (Math.cos(Math.PI * minute / 30) * ((2 * radius) / 3)));int xs = (int) (Math.sin(Math.PI * second / 30) * ((4 * radius) / 5) + xCenter);int ys = (int) (yCenter - (Math.cos(Math.PI * second / 30) * ((4 * radius) / 5)));//画时针,分针,秒针g2d.setColor(Color.black);g2d.setStroke(new BasicStroke(3.0f));g2d.drawLine(xCenter, yCenter, xh, yh);g2d.setStroke(new BasicStroke(2.0f));g2d.drawLine(xCenter, yCenter, xm, ym);g2d.setStroke(new BasicStroke(1.0f));g2d.drawLine(xCenter, yCenter, xs, ys);g2d.fillOval(xCenter - 5, yCenter - 5, 10, 10);}@Overridepublic void run() {while (true) {try {Thread.sleep(100);} catch (InterruptedException e) {e.printStackTrace();}repaint(0,70,300,500);}}@Overridepublic void actionPerformed(ActionEvent e) {}
}
//日历面板
class CalendarPanel extends JPanel implements ActionListener {private JPanel selectPanel;//月份减少按钮 ,选择月份 年份按钮,月份增加按钮private JPanel showPanel;//该面板有三种显示状态,一种显示日历,一种显示选择月份,一种显示选择年份private JPanel weekdayPanel;//该面板被添加到showPanel,用于静态显示周一到周日private JPanel calshowPanel;//用于显示一月中的每一天private JPanel selectMonth;private JPanel selectYear;private JButton btleft;private JButton btmid;private JButton btright;private JFrame mainframe;private JButton bt;private TextField myText;private Button[] btday = new Button[42];private Button[] btmouth = new Button[12];private Button[] btyear = new Button[12];private Calendar curcalendar;//记录当前日历上显示的日期private JFrame jFrame;public CalendarPanel(JFrame jFrame) {this.jFrame = jFrame;setLayout(null);//设置布局为nullsetBackground(new Color(143, 241, 219));selectPanel = new JPanel();selectPanel.setBackground(new Color(193, 241, 151));selectPanel.setBounds(0, 0, 500, 50);selectPanel.setLayout(null);add(selectPanel);btleft = new JButton("<");btleft.setBounds(50, 10, 50, 30);btleft.addActionListener(this);selectPanel.add(btleft);btmid = new JButton("");btmid.setBounds(175, 10, 150, 30);btmid.addActionListener(this);selectPanel.add(btmid);btright = new JButton(">");btright.setBounds(400, 10, 50, 30);btright.addActionListener(this);selectPanel.add(btright);weekdayPanel = new JPanel();weekdayPanel.setBounds(0, 0, 490, 20);weekdayPanel.setBackground(new Color(83, 199, 241));weekdayPanel.setLayout(new GridLayout(1, 7));weekdayPanel.setBorder(BorderFactory.createLineBorder(Color.black));weekdayPanel.add(new JLabel("日", JLabel.CENTER));weekdayPanel.add(new JLabel("一", JLabel.CENTER));weekdayPanel.add(new JLabel("二", JLabel.CENTER));weekdayPanel.add(new JLabel("三", JLabel.CENTER));weekdayPanel.add(new JLabel("四", JLabel.CENTER));weekdayPanel.add(new JLabel("五", JLabel.CENTER));weekdayPanel.add(new JLabel("六", JLabel.CENTER));calshowPanel = new JPanel();calshowPanel.setBounds(0, 130, 500,430);calshowPanel.setLayout(new GridLayout(6, 7));for (int i = 0; i < 42; i++) {btday[i] = new Button();btday[i].setBackground(new Color(202,211,221));btday[i].setFont(new Font("宋体", 4, 14));btday[i].addActionListener(this);}curcalendar = Calendar.getInstance();int monthday = curcalendar.get(Calendar.DAY_OF_MONTH);int weekday = curcalendar.get(Calendar.DAY_OF_WEEK);int startcol = 7 - (monthday - weekday) % 7;//当月第一天是一个星期中的第几天if (startcol > 7) {startcol = startcol%7;}System.out.println(startcol);String midbt_lab = curcalendar.get(Calendar.YEAR) + "年" + (curcalendar.get(Calendar.MONTH) + 1) + "月";btmid.setText(midbt_lab);Calendar lastcalendar = (Calendar) curcalendar.clone();lastcalendar.set(Calendar.DAY_OF_MONTH, 1);lastcalendar.add(Calendar.DAY_OF_MONTH, -startcol);int tablestart = lastcalendar.get(Calendar.DAY_OF_MONTH);//该页日历起始时是当月的第几天int k = 0;for (int i = 0; i < startcol; i++) {btday[k].setForeground(Color.GRAY);btday[k].setLabel((tablestart++) + "");calshowPanel.add(btday[k++]);}for (int i = 1; i <= curcalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {btday[k].setForeground(Color.black);btday[k].setLabel(i + "");if (curcalendar.get(Calendar.DAY_OF_MONTH) == i-4) {btday[i].setBackground(new Color(255, 255, 255));}calshowPanel.add(btday[k++]);}for (int i = 1; i <= 42 - startcol - curcalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {btday[k].setForeground(Color.GRAY);btday[k].setLabel(i + "");calshowPanel.add(btday[k++]);}showPanel = new JPanel();showPanel.setBounds(0, 50, 500, 450);showPanel.setLayout(new BorderLayout());showPanel.setBorder(BorderFactory.createLineBorder(Color.black));showPanel.add(weekdayPanel, BorderLayout.NORTH);showPanel.add(calshowPanel, BorderLayout.CENTER);add(showPanel);selectMonth = new JPanel(new GridLayout(3, 4));  //选择月份selectMonth.setBounds(0, 70, 500, 370);for (int i = 0; i < 12; i++) {btmouth[i] = new Button((i + 1) + "月");btmouth[i].addActionListener(this);btmouth[i].setBackground(new Color(202,211,221));btmouth[i].setFont(new Font("Dialog",5,18));selectMonth.add(btmouth[i]);}selectYear = new JPanel(new GridLayout(3, 4));//选择年份selectYear.setBounds(0, 45, 500, 400);for (int i = 0; i < 12; i++) {btyear[i] = new Button((curcalendar.get(Calendar.YEAR) - 6 + i) + "");btyear[i].addActionListener(this);btyear[i].setBackground(new Color(202,211,221));btyear[i].setFont(new Font("Dialog",5,18));selectYear.add(btyear[i]);}}//更新日历方法private void updatebtday() {int monthday = curcalendar.get(Calendar.DAY_OF_MONTH);//当前日期(在一月中的第几天)int weekday = curcalendar.get(Calendar.DAY_OF_WEEK);//(在一周中的第几天)int startcol = 7 - (monthday - weekday) % 7;//第一天是星期几if (startcol > 7) {startcol = startcol%7;}Calendar lastcalendar = (Calendar) curcalendar.clone();lastcalendar.set(Calendar.DAY_OF_MONTH, 1);lastcalendar.add(Calendar.DAY_OF_MONTH, -startcol);int tablestart = lastcalendar.get(Calendar.DAY_OF_MONTH);String midbt_lab = curcalendar.get(Calendar.YEAR) + "年" + (curcalendar.get(Calendar.MONTH) + 1) + "月";btmid.setText(midbt_lab);int k = 0;for (int i = 0; i < startcol; i++) {btday[k].setForeground(Color.GRAY);btday[k++].setLabel((tablestart++) + "");}for (int i = 1; i <= curcalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {btday[k].setForeground(Color.black);btday[k++].setLabel(i + "");}for (int i = 1; i <= 42 - startcol - curcalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {btday[k].setForeground(Color.GRAY);btday[k++].setLabel(i + "");}}private int parseTime(String str) throws ParseException{int i = 0, months=0,days=0;int ch;ch = str.charAt(i);while (i < str.length() && ch != '-') {if (ch < '0' || ch > '9')   throw new ParseException(str, i);months= months*10+ch - '0';i++;if (i < str.length())ch = str.charAt(i);elsethrow new ParseException(str, i);}i++;ch = str.charAt(i);while (i < str.length() ) {if (ch < '0' || ch > '9')  throw new ParseException(str, i);days=days*10+ch - '0';i++;if (i < str.length())ch = str.charAt(i);}if (months > 12 || days>31) throw new ParseException(str, i);return months*30+days;}public String TimeToString(Date day) {Formatter fmt = new Formatter();fmt.format("%tF"+"   "+"%tT",day,day);return fmt.toString();}JLabel component1=new JLabel("");JTextField component3=new JTextField("");int times;class refresh extends TimerTask{int i=0;public refresh(){super();}public void run(){Date day=new Date();TimeToString(day);component1.setText(TimeToString(day));i++;if(i==3600*24){times--;i-=3600*24;}}}public void show(){JFrame jf=new JFrame("日程");jf.setSize(450,300);jf.setLocationRelativeTo(null);jf.setDefaultCloseOperation(3);jf.setResizable(false);Date today = new Date(); JTextField component14=new JTextField();JLabel component15=new JLabel("地点");JLabel component4=new JLabel("指定日期");JTextField component5=new JTextField("00:00-24:00");JLabel component6=new JLabel("提醒时间");JTextField component7=new JTextField();JLabel   component8=new JLabel("事件");JButton component9=new JButton("清空内容");JButton component10=new JButton("确定");JButton component11=new JButton("取消");JCheckBox component12=new JCheckBox("弹窗提醒");    JLabel component2=new JLabel("倒计时"+"    "+"天");GridBagLayout gridBagLayout=new GridBagLayout(); //实例化布局对象jf.setLayout(gridBagLayout);                     //jf窗体对象设置为GridBagLayout布局GridBagConstraints gridBagConstraints=new GridBagConstraints();//实例化这个对象用来对组件进行管理gridBagConstraints.fill=GridBagConstraints.BOTH;//BOTH实现填充component9.addMouseListener(new java.awt.event.MouseAdapter() {public void mouseClicked(java.awt.event.MouseEvent e) {component7.setText("");}});component11.addMouseListener(new java.awt.event.MouseAdapter() {public void mouseClicked(java.awt.event.MouseEvent e) {jf.setVisible(false);}});component10.addMouseListener(new java.awt.event.MouseAdapter() {public void mouseClicked(java.awt.event.MouseEvent e) {int endtime;int curtime=(today.getMonth()+1)*30+today.getDate();try{endtime=parseTime(component3.getText())-curtime; times=endtime;component2.setText("倒计时"+" "+endtime+" "+"天");if(endtime==0&&component12.isSelected()) jf.setState(JFrame.NORMAL);else jf.setState(JFrame.ICONIFIED);}catch(ParseException el){JOptionPane.showMessageDialog(jf, "指定日期有错误");}}});gridBagConstraints.gridx=1;gridBagConstraints.gridy=3;gridBagConstraints.gridwidth=2;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component14, gridBagConstraints);gridBagConstraints.gridx=3;gridBagConstraints.gridy=3;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component15, gridBagConstraints);gridBagConstraints.gridx=1;gridBagConstraints.gridy=2;gridBagConstraints.gridwidth=4;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component1, gridBagConstraints);gridBagConstraints.gridx=1;gridBagConstraints.gridy=4;gridBagConstraints.gridwidth=2;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component3, gridBagConstraints);gridBagConstraints.gridx=3;gridBagConstraints.gridy=4;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component4, gridBagConstraints);gridBagConstraints.gridx=1;gridBagConstraints.gridy=5;gridBagConstraints.gridwidth=2;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component5, gridBagConstraints);gridBagConstraints.gridx=3;gridBagConstraints.gridy=5;gridBagConstraints.gridwidth=2;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component6, gridBagConstraints);gridBagConstraints.gridx=1;gridBagConstraints.gridy=6;gridBagConstraints.gridwidth=4;                                             gridBagConstraints.gridheight=4;            gridBagLayout.setConstraints(component7, gridBagConstraints);gridBagConstraints.gridx=5;gridBagConstraints.gridy=6;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component8, gridBagConstraints);gridBagConstraints.gridx=1;gridBagConstraints.gridy=10;gridBagConstraints.gridwidth=2;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component9, gridBagConstraints);gridBagConstraints.gridx=4;gridBagConstraints.gridy=10;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component2, gridBagConstraints);gridBagConstraints.gridx=1;gridBagConstraints.gridy=11;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component10, gridBagConstraints);gridBagConstraints.gridx=2;gridBagConstraints.gridy=11;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component11, gridBagConstraints);gridBagConstraints.gridx=4;gridBagConstraints.gridy=11;gridBagConstraints.gridwidth=1;                                             gridBagConstraints.gridheight=1;            gridBagLayout.setConstraints(component12, gridBagConstraints);       jf.add(component1);jf.add(component14);jf.add(component15); jf.add(component2);jf.add(component3);jf.add(component4);jf.add(component5);jf.add(component6);jf.add(component7);jf.add(component8);jf.add(component9);jf.add(component10);jf.add(component11);jf.add(component12);jf.setVisible(true);}@Overridepublic void actionPerformed(ActionEvent e) {if (e.getSource() == btmid) {//中间按钮JPanel getPanel = (JPanel) showPanel.getComponent(0);if (getPanel == weekdayPanel) {btmid.setText(curcalendar.get(Calendar.YEAR) + "");showPanel.removeAll();showPanel.add(selectMonth);} else if (getPanel == selectMonth){showPanel.removeAll();showPanel.add(selectYear);btmid.setText((curcalendar.get(Calendar.YEAR) - 6) + "-" + (curcalendar.get(Calendar.YEAR) + 5));}jFrame.setVisible(true);} else if (e.getSource() == btleft) {//左边按钮JPanel getPanel = (JPanel) showPanel.getComponent(0);//获取容器中的第1个组件if (getPanel == weekdayPanel) {int month1 = curcalendar.get(Calendar.MONTH);curcalendar.set(Calendar.MONTH, month1 - 1);updatebtday();} else if (getPanel == selectMonth) {int year = curcalendar.get(Calendar.YEAR);curcalendar.set(Calendar.YEAR, year - 1);btmid.setText(curcalendar.get(Calendar.YEAR) + "");} else {String str = btyear[0].getLabel();int first = Integer.parseInt(str);for (int i = 11; i >= 0; i--) {btyear[i].setLabel((--first) + "");}btmid.setText(first + "-" + (first + 11));}} else if (e.getSource() == btright) {JPanel getPanel = (JPanel) showPanel.getComponent(0);if (getPanel == weekdayPanel) {//如得到的组件是星期Panel,那么更新日历int month1 = curcalendar.get(Calendar.MONTH);curcalendar.set(Calendar.MONTH, month1 + 1);updatebtday();} else if (getPanel == selectMonth) {//如果得到的组件是月份的Panel,那么更新年份int year = curcalendar.get(Calendar.YEAR);curcalendar.set(Calendar.YEAR, year + 1);btmid.setText(curcalendar.get(Calendar.YEAR) + "");} else {	//如果是选择年份界面,那么改变年份和mid按钮String str = btyear[11].getLabel();int last = Integer.parseInt(str);for (int i = 0; i < 12; i++) {btyear[i].setLabel((++last) + "");}btmid.setText((last - 11) + "-" + last);}} else if (((Button) e.getSource()).getForeground() == Color.GRAY) {//如果发生事件的为灰色按钮String command = e.getActionCommand();int com_int = Integer.parseInt(command);if (com_int > 20) {//大于20表明是上个月的,设置月份,调用更新月份的方法int month3 = curcalendar.get(Calendar.MONTH); curcalendar.set(Calendar.MONTH, month3 - 1);} else if (com_int < 20) {//小于20为下个月的int month3 = curcalendar.get(Calendar.MONTH);curcalendar.set(Calendar.MONTH, month3 + 1);}updatebtday();} else if (((Button) e.getSource()).getForeground() == Color.black) {show();String str = e.getActionCommand();component3.setText("01"+'-'+str);Date d = new Date();Timer tmr = new Timer();tmr.schedule(new refresh(),1000,1000); ((Button) e.getSource()).setBackground(Color.RED);} else if (e.getSource() == btyear[0]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[1]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[2]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[3]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[4]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[5]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[6]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[7]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[8]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[9]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[10]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else if (e.getSource() == btyear[11]) {String str = e.getActionCommand();int year = Integer.parseInt(str);curcalendar.set(Calendar.YEAR, year);showPanel.removeAll();showPanel.add(selectMonth);btmid.setText(str);} else {switch (e.getActionCommand()) {case "1月":curcalendar.set(Calendar.MONTH, 0);break;case "2月":curcalendar.set(Calendar.MONTH, 1);break;case "3月":curcalendar.set(Calendar.MONTH, 2);break;case "4月":curcalendar.set(Calendar.MONTH, 3);break;case "5月":curcalendar.set(Calendar.MONTH, 4);break;case "6月":curcalendar.set(Calendar.MONTH, 5);break;case "7月":curcalendar.set(Calendar.MONTH, 6);break;case "8月":curcalendar.set(Calendar.MONTH, 7);break;case "9月":curcalendar.set(Calendar.MONTH, 8);break;case "10月":curcalendar.set(Calendar.MONTH, 9);break;case "11月":curcalendar.set(Calendar.MONTH, 10);break;case "12月":curcalendar.set(Calendar.MONTH, 11);break;}showPanel.removeAll();updatebtday();showPanel.add(weekdayPanel,BorderLayout.NORTH);showPanel.add(calshowPanel,BorderLayout.CENTER);jFrame.setVisible(true);}}
}

可能会存在一点bug,不过影响应该不大,希望可以起到微薄帮助! 加油!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/644582.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

避免邮件进入垃圾箱的实用技巧:提高邮件接收率的策略

邮件进垃圾邮箱一部分原因是IP地址出现了问题&#xff0c;一部分是邮件内容。那我们应该怎么避免邮件进入垃圾邮箱呢&#xff1f; 1、邮件内容 1&#xff09;邮件标题 邮件标题是影响邮件打开率非常重要的因素&#xff0c;所以大家可能会在标题上放置一些吸引人的符号或者词…

聚道云连接器助力钉钉与金蝶云星辰无缝对接,实现多维度数据同步

客户介绍 某企业服务有限公司专注于为企业提供全方位、高质量的企业服务&#xff0c;致力于于企业管理咨询、企业形象策划、市场营销策划、财务管理咨询等方面。该公司拥有一支经验丰富、专业化的团队&#xff0c;他们深入了解企业需求&#xff0c;为客户提供个性化的解决方案…

列表的创建与删除

Python 中列表可以动态地添加、修改和删除元素&#xff0c;是 Python 编程中不可或缺的一部分。本文将介绍如何使用 Python 创建和删除列表&#xff0c;以及常用的方法和技巧。 创建列表 在 Python 中&#xff0c;我们可以使用一对方括号 [ ] 来创建一个空列表&#xff0c;也可…

开源免费无广告Gopeed,现代化的高速下载器,支持(HTTP、BitTorrent、Magnet)等多种协议下载,开源免费、无广告、高度可定制、不限速。

目录 特点 支持的平台 一键部署 体验 特点 全平台支持、开源免费&#xff0c;不限速、无广告 遵循 GPL-3.0 开源协议 支持&#xff08;HTTP、BitTorrent、Magnet&#xff09;协议下载 高速下载&#xff0c;底层使用golang协程并发下载 每日自动更新 tracker 列表 去中心…

IPv4 over IPv6简介

在IPv4 Internet向IPv6 Internet过渡的后期&#xff0c;IPv6网络已被大量部署&#xff0c;此时可能出现IPv4孤岛。利用隧道技术可在IPv6网络上创建隧道&#xff0c;从而实现IPv4孤岛的互连。这类似于在IP网络上利用隧道技术部署VPN。在IPv6网络上用于连接IPv4孤岛的隧道&#x…

Oracle触发器简单应用示例

目录 一、应用描述 【1】、应用场景&#xff1a; 【2】、具体场景&#xff1a; 二、表结构介绍 【1】表名介绍&#xff1a; 【2】表结构&#xff1a; 三、设置触发器 一、应用描述 【1】、应用场景&#xff1a; 现有一张库存明细以及销售明细表&#xff0c;销售明细表发生…

知识图谱符号表示比较:特性图、RDF和OWL

目录 前言1 特性图&#xff1a;灵活的图结构表示1.1 优势与灵活性1.2 存储优化与查询优势1.3 挑战&#xff1a;缺乏工业标准支持 2 RDF&#xff08;Resource Description Framework&#xff09;&#xff1a;面向Web的数据标准2.1 三元组结构的优势2.2 语义标准与词汇丰富性2.3 …

elment-plus如何引入scss文件实现自定义主题色

elment-plus如何引入scss文件实现自定义主题色&#xff01;如果您想修改elementPlus的默认主题色调&#xff0c;使用自定义的色调&#xff0c;可以考虑使用官方提供的解决办法。 第一步你需要在项目内安装sass插件包。 npm i sass -D 如图&#xff0c;安装完成后&#xff0c;你…

gdzwfw某省公共资源交易平台逆向学习

声明&#xff1a;本文中网站仅为学习技术使用&#xff0c;请勿暴力爬取数据。 学习地址&#xff1a;aHR0cHM6Ly95Z3AuZ2R6d2Z3Lmdvdi5jbi8jLzQ0L2p5Z2c 此网站采用请求头反爬&#xff0c;难点是请求头中几个参数是如何生成的&#xff08;别问为什么知道是请求头&#xff0c;一…

java进阶-jvm精讲及实战

深入了解jvm及实战 1.引言2.jvm概念理解1.1什么是jvm1.2 jvm功能1.3 jvm规范及主流版本1.4 jre jdk jvm的区别和联系1.5 jvm组成 2.jvm-字节码文件class2.1 java和class无关性2.2 字节码应用场景2.4 字节码文件打开方式2.3 字节码文件组成2.3.1 一般信息2.3.2 常量池2.3.3 方法…

Flutter底部导航栏插件persistent_bottom_nav_bar的使用

flutter 框架中的 persistent_bottom_nav_bar 插件可以让我们快速实现页面底部导航栏&#xff08;也就是 bottomNavigationBar &#xff09;的布局且能拥有多样的切换效果&#xff08;包括但不限于&#xff1a;动画切换效果、中间凸起按钮效果等&#xff09; 插件网址&#xf…

【MySQL·8.0·源码】subquery 子查询处理分析(一)

引言 在 SQL 中&#xff0c;子查询属于 Nested Query 的一种形式&#xff0c;根据 Kim 的分类[1]&#xff0c;Nested Query 即嵌套查询是一种 SQL-like 形式的查询语句嵌套在另一 SQL 中&#xff0c;SQL-like 的嵌套子句可以出现在 SELECT、FROM 和 WHERE 子句的任意位置。 在…

GBASE南大通用分享如何更新row类型表达式

从 SPL 例程内&#xff0c;您可使用 ROW 变量来更新 row 类型表达式。下图展示当员工的基本薪 酬按某一百分比增长时&#xff0c;用于更新 emp_info 表的 SPL 过程 emp_raise。 用于更新 emp_info 表的 SPL 过程。 SELECT 语句将来自 emp_info 表的 salary 列的行选择到 ROW …

Java项目:125SpringBoot教室预约管理系统

博主主页&#xff1a;Java旅途 简介&#xff1a;分享计算机知识、学习路线、系统源码及教程 文末获取源码 一、项目介绍 教室预约管理系统使用SpringBootMybatis进行开发&#xff0c;系统整体分为前台和后台&#xff0c;后台主要对教室&#xff0c;用户等信息进行管理&#xf…

SpringBoot+MyBatis使用pagehelper分页插件及其注意事项(含解决分页不生效问题)

1 前言 近期在做项目的时候&#xff0c;遇到了一个问题&#xff1a;在使用MyBatis的分页插件&#xff08;pagehelper&#xff09;时&#xff0c;发现其分页不生效&#xff0c;找了许多方法才得以解决&#xff0c;故写下这篇文章记录一下&#xff0c;帮助跟我遇到同样问题的同学…

无人机航迹规划(六):七种元启发算法(DBO、LO、SWO、COA、LSO、KOA、GRO)求解无人机路径规划(提供MATLAB代码)

一、七种算法&#xff08;DBO、LO、SWO、COA、LSO、KOA、GRO&#xff09;简介 1、蜣螂优化算法DBO 蜣螂优化算法&#xff08;Dung beetle optimizer&#xff0c;DBO&#xff09;由Jiankai Xue和Bo Shen于2022年提出&#xff0c;该算法主要受蜣螂的滚球、跳舞、觅食、偷窃和繁…

阿赵UE学习笔记——解决UE资源不能正常显示缩略图的问题

阿赵UE学习笔记目录 大家好&#xff0c;我是阿赵。   这里分享一个虚幻引擎使用小技巧。在使用虚幻引擎的过程中&#xff0c;经常会遇到有些资源在重新打开项目的时候&#xff0c;会看不到缩略图&#xff0c;而是显示默认资源的图标&#xff1a; 这个时候&#xff0c;第一种…

java web mvc-06-play framework intro

拓展阅读 Spring Web MVC-00-重学 mvc mvc-01-Model-View-Controller 概览 web mvc-03-JFinal web mvc-04-Apache Wicket web mvc-05-JSF JavaServer Faces web mvc-06-play framework intro web mvc-07-Vaadin web mvc-08-Grails 开源 The jdbc pool for java.(java …

每日一题——LeetCode1331.数组序号转换

方法一 排序哈希Map 首先用一个数组保存排序完的原数组&#xff0c;然后用一个哈希表保存各元素的序号&#xff0c;最后将原属组的元素替换为序号后返回。 var arrayRankTransform function(arr) {let set new Set(arr)let sortArrArray.from(set).sort((a,b)>a-b)let ma…

对Vue有状态组件和无状态组件的理解及使用场景

目录 一、Vue框架 二、Vue的有状态组件 三、Vue的无状态组件 四、有状态组件和无状态组件的区别 一、Vue框架 Vue是一款流行的JavaScript框架&#xff0c;用于构建用户界面。它被设计为易学易用的&#xff0c;同时也具备强大的功能和灵活性。 Vue具有以下特点&#xff1a…