当前位置: 首页 > news >正文

Flip Clock(not good)

最近体验了一下iOS的翻页时钟app,很想自己做一个,但是效果不好

public class main {public static void main(String[] args) {//psvmnew MyFrame();}
}

 

import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.SimpleTimeZone;public class MyFrame extends JFrame {Calendar calendar;SimpleDateFormat timeFormat;SimpleDateFormat dayFormat;SimpleDateFormat dateFormat;JLabel timeLabel;JLabel dayLabel;JLabel dateLabel;String time;String day;String date;MyFrame(){this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认关闭操作jframe点退出关闭this.setTitle("My Clock Program");this.setLayout(new FlowLayout());this.setSize(350,200);this.setResizable(false);timeFormat = new SimpleDateFormat("hh:mm:ss a",Locale.CHINESE);//kkdayFormat = new SimpleDateFormat("EEEE",Locale.CHINESE);dateFormat = new SimpleDateFormat("MMMMM dd,yyyy", Locale.CHINESE);timeLabel = new JLabel();timeLabel.setFont(new Font("Verdana",Font.PLAIN,50));timeLabel.setForeground(new Color(0x00FF00));timeLabel.setBackground(Color.black);timeLabel.setOpaque(true);dayLabel = new JLabel();dayLabel.setFont(new Font("Arial", Font.PLAIN, 35));dateLabel = new JLabel();dateLabel.setFont(new Font("Verdana",Font.PLAIN,25));this.add(timeLabel);this.add(dayLabel);this.add(dateLabel);this.setVisible(true);setTime();}public  void setTime() {while(true){time = timeFormat.format(Calendar.getInstance().getTime());timeLabel.setText(time);day = dayFormat.format(Calendar.getInstance().getTime());dayLabel.setText(day);date = dateFormat.format(Calendar.getInstance().getTime());dateLabel.setText(date);try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();}}}
}

这个方框里面的不知道为什么不能正确显示

http://www.lryc.cn/news/313756.html

相关文章:

  • 目标检测——摩托车头盔检测数据集
  • Windows 安装 Xinference
  • 静态时序分析:SDC约束命令set_case_analysis详解
  • C++ · 代码笔记4 ·继承与派生
  • 解决uni-app中使用webview键盘弹起遮挡input输入框问题
  • Java注解介绍
  • 万字详解,Java实现低配版线程池
  • 挂耳式蓝牙耳机哪家的好用?购买耳机前必须了解的几大要点
  • CSS文本属性
  • MySQL篇—执行计划之覆盖索引Using index和条件过滤Using where介绍(第三篇,总共三篇)
  • 最短路径(2.19)
  • vue 总结
  • 深入理解TCP/IP协议:互联网通信的核心
  • Python数据处理实战(4)-上万行log数据提取并作图进阶版
  • JavaWeb Tomcat启动、部署、配置、集成IDEA
  • 关于Vue3的一些操作
  • 外贸常用的出口认证 | 全球外贸数据服务平台 | 箱讯科技
  • C++ 标准库类型string
  • Material UI 5 学习02-其它按钮组件
  • Express学习(三)
  • influxdb2.0插入数据字段类型出现冲突问题解决
  • [C++]类和对象,explicit,static,友元,构造函数——喵喵要吃C嘎嘎4
  • 物联网的商业模式洞察
  • 智能指针基础知识【C++】【RAII思想 || unique_ptr || shared_ptrweak_ptr || 循环引用问题】
  • leetcode:反转链表II 和k个一组反转链表的C++实现
  • ERD Online 快速启动指南:代码下载到首次运行的全流程攻略 ️
  • c++ 11 新特性 不同数据类型之间转换函数之const_cast
  • C++从零开始的打怪升级之路(day45)
  • 小鹅通前端实习一面
  • ArrayList常用API