求Java 日历的小程序的源代码

求Java 日历的小程序的源代码,第1张

也不知埋拦道你具体需求是什么,以前改过一个日历程序,一共四个java类,放在同一个包里。经测试可以运行。

//Start.java

import java.awt.*

import javax.swing.*

class Start{

public static void main(String [] args){

DateFrame frame=new DateFrame()

frame.setLocationRelativeTo(frame)

frame.setResizable(false)

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

frame.setVisible(true)

}

}

//DateInfo.java

import java.util.*

public class DateInfo{

private int mYear, mMonth

private int mDayOfMonth, mFristWeek

public DateInfo(int year, int month) throws DateException{

mYear = year

if (month <0 || month >12){

throw (new DateException())

}

mMonth = month

mDayOfMonth = getDayOfMonth(mYear, mMonth)

mFristWeek = getFristWeek(mYear, mMonth)

}

private int getDayOfMonth(int year, int month){

int[][] ary = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},

{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}

return (ary[isLeapYear(year)][month])

}

private int isLeapYear(int year){

if (year % 4 == 0 &&year % 100 != 0 ||year % 400 == 0){

return (1)

}

else{

return (0)

}

}

private int getFristWeek(int year, int month){

java.util.Calendar cal = Calendar.getInstance()

cal.set(year, month - 1, 1)

return (cal.get(Calendar.DAY_OF_WEEK) - 1)

}

public String toString(){

String str

str = "\t\t" + mYear + "年" + mMonth + "月\n"

str += "日\t一\t二\t三\t四\t五\t六\n"

int i

for (i = 1i <= mFristWeeki++){

str += " \t"

}

for (int j = 1j <= mDayOfMonthj++, i++){

str +=j+"\t"

if (i % 7 == 0){

str += "\n"

}

}

return (str)

}

}

//DateFrame.java

import java.awt.*

import java.awt.event.*

import javax.swing.*

import java.util.Calendar

class DateFrame extends JFrame implements Runnable{

Calendar date=Calendar.getInstance()

String[] str={"1","2","枣禅3","4","5","6","7","8","9","10","11","12"}

JLabel lblYear=new JLabel("年 "弯岩胡)

JLabel lblMonth=new JLabel("月 ")

JLabel lblDate=new JLabel("现在的时间是:")

JLabel lblShowDate=new JLabel()

// javax.swing.JTextField trxt =new JTextField(10)

// trxt.setHorizontalAlignment(JTextField.RIGHT) //设置文本从右边输入

JComboBox cboMonth=new JComboBox(str)

JComboBox cboYear=new JComboBox()

JTextArea txaShow=new JTextArea()

JPanel pnlNorth=new JPanel()

JPanel pnlSOUTH=new JPanel()

JButton btnShow=new JButton("显示")

JButton btnClose=new JButton("关闭")

JScrollPane jsp=new JScrollPane(txaShow)

Container c=this.getContentPane()

public DateFrame(){

Thread thread=new Thread(this)

thread.start()

this.setTitle("玩玩日历拉!!!")

this.setSize(300,260)

for (int i = 1990i<=2025i++) {

cboYear.addItem(""+i)

}

cboYear.setSelectedItem(""+(date.get(Calendar.YEAR)))

cboMonth.setSelectedItem(""+(date.get(Calendar.MONTH)+1))

pnlNorth.add(cboYear)

txaShow.setTabSize(4) //设置tab键的距离

txaShow.setForeground(Color.GREEN)

pnlNorth.add(lblYear)

pnlNorth.add(cboMonth)

pnlNorth.add(lblMonth)

pnlNorth.add(lblDate)

pnlNorth.add(lblShowDate)

c.add(pnlNorth,BorderLayout.NORTH)

c.add(jsp)

pnlSOUTH.add(btnShow)

pnlSOUTH.add(btnClose)

c.add(pnlSOUTH,BorderLayout.SOUTH)

btnShow.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

int year=Integer.parseInt((String)cboYear.getSelectedItem())

int month=Integer.parseInt((String)cboMonth.getSelectedItem())

try {

DateInfo date=new DateInfo(year,month)

txaShow.setText(""+date)

}

catch (DateException ex) {

ex.printStackTrace()

}

}

})

btnClose.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

System.exit(0)

}

})

}

public void run(){

try {

while(true){

Thread.sleep(1000)

int hour=date.get(Calendar.HOUR)

int minute=date.get(Calendar.MINUTE)

int second=date.get(Calendar.SECOND)

String str=hour+":"+minute+":"+second

lblShowDate.setText(str)

//this.repaint()

}

}

catch (Exception ex) {

ex.printStackTrace()

}

}

}

//DateException.java

public class DateException extends Exception{

public DateException(){

super("日期数据不合法.")

}

}

微信小程序怎么看源码,可采用以下步骤:

1、微信小程序是一个免除下载安装直接使用的应用,使用微信【扫一扫】或者是【搜一搜】就可以打开应用。

2、微信小程序如今存在线下扫码、公众号关注、消息通知等多种功能。

3、在微信小程序中,可以向有所了解的技术员寻求帮助。他们会为客户查找微信小程序源码,这样我们就可以看到微信小程序源码了。

4、现如今各大企业项目公司都会培养一些专业的工作人员。闭物汪他们会运用现有的技术查看源码。

5、查找小蚂雀程序源码很简单,并且该源码轿仔会跟销售产品量成正比关系。

6、给我们的信息可以告诉我们查看微信小程序源码很有必要且又很有重要性。

7、对于查看微信小程序源码以及它的价值,跟客户需求量很有关系。

8、如今网络市场发展十分迅速,微信小程序就是其中一个热门市场点,查看源码就是微信小程序最重要的地方。

1:仿豆瓣电影微信小程序

https://github.com/zce/weapp-demo

2:微信小程序移动端商城

https://github.com/liuxuanqiang/wechat-weapp-mall

3:Gank微信小程序

https://github.com/lypeer/wechat-weapp-gank

4:微信小程序高仿QQ应用

https://github.com/xiehui999/SmallAppForQQ

5:微信中的知乎

https://github.com/RebeccaHanjw/weapp-wechat-zhihu

6:实现一个移动端小商城

https://github.com/skyvow/m-mall

7:微信小程序demo

https://github.com/web-Marker/wechat-Development

8: 跑步微信小程序Demo

https://github.com/alanwangmodify/weChatApp-Run

9:简单的v2ex微信小程序

https://github.com/jectychen/wechat-v2ex

10:腾讯云微信小程序

https://github.com/tencentyun/weapp-client-demo

11:微信小程序-微票

https://github.com/wangmingjob/weapp-weipiao

12:微信小程序慧码demo 仿手机淘宝

https://github.com/ChangQing666/wechat-weapp-taobao

13:一个为微信小程序开发准备的基础骨架

https://github.com/zce/weapp-boilerplate

14:巴爷微信商城的简单版本

https://github.com/bayetech/wechat_mall_applet

15:微信小程序 - 电影推荐

https://github.com/yesifeng/wechat-weapp-movie

16:微信小程序-知乎日报

https://github.com/myronliu347/wechat-app-zhihudaily

17:微信小程序: 音乐播放器

https://github.com/eyasliu/wechat-app-music

18:使用微信小程序实现分答这款APP的基础功能

https://github.com/davedavehong/fenda-mock

19:微信小程序开发demo-地图定位

https://github.com/giscafer/wechat-weapp-mapdemo

:20:微信小程序 - 豆瓣电影

https://github.com/hingsir/weapp-douban-film

21:wepy仿微信聊天界面

https://github.com/wepyjs/wepy-wechat-demo

22:仿 「ONE · 一个」 的微信小程序

https://github.com/ahonn/weapp-one

23:微信小程序集成Redux实前旁哪现的Todo list

https://github.com/charleyw/wechat-weapp-redux-todos

24: 基于Zhihu Live数据的微信小程序

https://github.com/dongweiming/weapp-zhihulive

25:微信小程序之小熊の日记

https://github.com/harveyqing/BearDiary

26:仿网易云音启竖乐APP的微信小程序

https://github.com/sqaiyan/netmusic-app

27:微信小程序的Flex布局demo

https://github.com/icindy/wxflex

28:番茄时钟微信小程序版

https://github.com/kraaas/timer

29:Wafer 服务端 Demo

https://github.com/tencentyun/weapp-node-server-demo

30:微信小程序版聊天室

https://github.com/ericzyh/wechat-chat

31:微信小程序版简易计算器,适合入门练手

https://github.com/dunizb/wxapp-sCalc

32:微信小程序示例一笔到底

https://github.com/CFETeam/weapp-demo-session

33:基于面包旅行 API 制作的微信小程序示例

https://github.com/romoo/weapp-demo-breadtrip

34:新闻阅读器

https://github.com/vace/wechatapp-news-reader

35:一个简单的微信小程序购物车DEMO

https://github.com/SeptemberMaples/wechat-weapp-demo

36:微信小程序-公众号热门文章信息流

https://github.com/hijiangtao/weapp-newsapp

37:通过Node.js实现的妹子照片爬虫微信小程序

https://github.com/litt1e-p/weapp-girls

38:从FlexLayout布局开始学习微信小程序

https://github.com/hardog/wechat-app-flexlayout

39:HiApp 微信小程序版

https://github.com/BelinChung/wxapp-hiapp

40:微信小程序的简单尝试

https://github.com/zhengxiaowai/weapp-github

41:集美大学图书馆的便捷工具

https://github.com/ToadWoo/bookbox-wxapp

42:微信小程序版妹纸图

https://github.com/brucevanfdm/WeChatMeiZhi

43:V2ex 微信小程序版

https://github.com/bestony/weapp-V2ex

44:微信小程序仿百思不得姐

https://github.com/SureZhangHW/WXBaiSi

45:微信小程序音乐播放器应用

https://github.com/xingbofeng/wx-audio

46:医药网原生APP的微信小程序DEMO

https://github.com/jiabinxu/yiyaowang-wx

47:微信小程序跟读

https://github.com/gxmzjxk/wxreading

48:微信小程序瀑布流布局模式

https://github.com/icindy/WxMasonry

49:微信小程序HotApp云笔记

https://github.com/hotapp888/hotapp-notepad

50:小程序模仿——网易云音乐

https://github.com/MengZhaoFly/wechatApp-netease_cloudmusic

51:微信小程序商城demo

https://github.com/lin-xin/wxapp-mall

52:微信小程序版的扫雷

https://github.com/jsongo/wx-mime

53:专注管理时间的微信小程序

https://github.com/SeaHub/PigRaising

54:微信小程序版干货集中营

https://github.com/iwgang/GankCamp-WechatAPP

55:英雄联盟(LOL)战绩查询

https://github.com/xiaowenxia/weapp-lolgame

56:微信小程序首字母排序选择表

https://github.com/icindy/wxSortPickerView

57:微信小程序版豆瓣电影

https://github.com/David-Guo/weapp-douban-movie

58:简单的实现了1024的游戏规则

https://github.com/RedLove/WexinApp_1024

59:微信小程序试玩

https://github.com/uniquexiaobai/wechat-app-githubfeed

60:微信小程序逗乐

https://github.com/mkxiansheng/doule

61:一步步开发微信小程序

https://github.com/Gavin-YYC/wxApp

62:一个 meteor 的 React todo list 例子

https://github.com/leijing7/wx-mina-meteor

63:微信小程序健康菜谱

https://github.com/bestTao/caipu_weixin

64: jspapa微信小程序版本

https://github.com/biggerV/jspapa-wx

65:微信小程序版的CNodeJs中文社区

https://github.com/Shaman05/CNodeJs-WXAPP

66:LeanCloud 的微信小程序用户登陆Demo

https://github.com/bestony/weapp-LeanCloud

67: 微笑话微信小程序

https://github.com/zszdevelop/wejoke

68:微信小程序开发的App

https://github.com/chongbenben/liwushuoapp

69:体育新闻微信小程序

https://github.com/havenxie/weapp-sportsnews

70:基于Labrador和mobx构建的小程序开发demo

https://github.com/spacedragon/labrador_mobx_example


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12556678.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2025-08-26
下一篇2025-08-26

发表评论

登录后才能评论

评论列表(0条)

    保存