返回列表 發帖
  1. package bbs.istak.org.tw;

  2. import java.awt.BorderLayout;
  3. import java.awt.EventQueue;
  4. import java.text.SimpleDateFormat;
  5. import java.util.Date;

  6. import javax.swing.JFrame;
  7. import javax.swing.JPanel;
  8. import javax.swing.border.EmptyBorder;
  9. import javax.swing.JLabel;
  10. import javax.swing.JTextPane;

  11. public class Main extends JFrame {

  12.         private JPanel contentPane;

  13.         /**
  14.          * Launch the application.
  15.          */
  16.         public static void main(String[] args) {
  17.                 EventQueue.invokeLater(new Runnable() {
  18.                         public void run() {
  19.                                 try {
  20.                                         Main frame = new Main();
  21.                                         frame.setVisible(true);
  22.                                 } catch (Exception e) {
  23.                                         e.printStackTrace();
  24.                                 }
  25.                         }
  26.                 });
  27.         }

  28.         /**
  29.          * Create the frame.
  30.          */
  31.         public Main() {
  32.                 setTitle("\u6642\u9418");
  33.                 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  34.                 setBounds(100, 100, 315, 130);
  35.                 contentPane = new JPanel();
  36.                 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  37.                 setContentPane(contentPane);
  38.                 contentPane.setLayout(null);
  39.                
  40.                 JLabel label = new JLabel("\u73FE\u5728\u6642\u9593\uFF1A");
  41.                 label.setBounds(14, 13, 83, 19);
  42.                 contentPane.add(label);
  43.                
  44.                 Date date = new Date();
  45.         SimpleDateFormat nd24 = new SimpleDateFormat("西元yyyy年 MM月 dd日 , hh時 mm分 ss秒");
  46.         
  47.                 JLabel lblNewLabel = new JLabel(nd24.format(date));
  48.                 lblNewLabel.setLabelFor(lblNewLabel);
  49.                 lblNewLabel.setBounds(24, 45, 259, 25);
  50.                 contentPane.add(lblNewLabel);
  51.                
  52.                
  53.         }
  54. }
複製代碼

TOP

返回列表