JAVA 框架显示系统时间

package Rong;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;


public class TestStatus extends JFrame{
  private static final long serialVersionUID = 1L;
  JLabel status=new JLabel();
  SimpleDateFormat s=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
  Date d;
  public TestStatus(){
  this.setTitle("状态栏中实时显示系统时间");
  this.setSize(400, 400);
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  this.setLocation((dim.width-this.getWidth())/2, (dim.height-this.getHeight())/2);
  this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
  this.setVisible(true);
 
  Timer timer = new Timer();
  TimerTask tt = new TimerTask() {
    public void run() {
      d=new Date();
      status.setText(" 当前时间:"+ s.format(d));//显示系统日期时间
      status.setBorder(new LineBorder(Color.black, 1, false));//设置边框线
      status.setHorizontalAlignment(SwingConstants.CENTER);//设置文字在状态中居中显示
    }
   
  };
  timer.schedule(tt, 0, 1000);  
  this.getContentPane().add(status,BorderLayout.SOUTH);
  }
  public static void main(String args[]){
  new TestStatus();
  }
} JAVA <wbr>框架显示系统时间

<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>登录界面</title> <!-- 引入 Bootstrap --> <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <style type="text/css"> .divForm{ position: absolute; width: 300px; height: 280px; top: 30%; left: 40%; margin-top: 1px; margin-left: 5px; } .title{ width:100%; height:50px; font-size:38px; line-height:50px; margin-bottom:20px; font-family: 华文宋体; color: cornflowerblue; } </style> </head> <body> <div class="divForm"> <form method="post" action="${pageContext.request.contextPath}/login/judgeLogin"> <div class="title" >&nbsp;&nbsp;&nbsp;欢 迎 登 录</div> <div class="form-group has-success has-feedback"> <label class="control-label">&nbsp;&nbsp;用户名: &nbsp;&nbsp;<input type="text" class="form-control" name="userName" id="userName" autocomplete="off" placeholder="请输入用户名"> </label> </div> <div class="form-group has-success has-feedback"> <label class="control-label">&nbsp;&nbsp;密码: <input type="password" class="form-control" name="userPwd" id="userPwd" autocomplete="off" placeholder="请输入密码"> </label> </div> <div > <a onclick="jumpRegister()">&nbsp;&nbsp;&nbsp;&nbsp;注册账号</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-primary">登录</button> </div> </form> </div> <script> function jumpRegister() { window.location = "${pageContext.request.contextPath}/register/index"; } </script> </body> </html>
最新发布
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值