//主界面
import javax.swing.*;
import java.awt.event.*;
//import Frame_1;
import javax.swing.ImageIcon;public class LandFrame extends JFrame implements ActionListener
{    
static LandFrame frm=new LandFrame();
static JLabel lb0,lb1,lb2;
static JButton bt1=new JButton("确定");
static JButton bt2=new JButton("退出");
static JTextField txf1; 
static JPasswordField txf2;
String Account="yangmeiquan";
String Password="2008";
  public static void main(String args[])
{
  frm.setResizable(false);
  frm.setSize(300,300);
  frm.setLocation(200,200);
  frm.setLayout(null);
  lb0=new JLabel("欢迎使用日常财务管理系统");
  lb0.setBounds(70,20,200,20);
  lb1=new JLabel("帐号:");
  lb1.setBounds(40,100,40,20);
  lb2=new JLabel("密码:");
  lb2.setBounds(40,140,40,20);   bt1.setBounds(20,210,60,40);
  bt2.setBounds(200,210,60,40);   txf1=new JTextField(10);
  txf1.setBounds(80,100,180,20);
  txf2=new JPasswordField(10);
      txf2.setBounds(80,140,180,20);
  txf2.setEchoChar('*');   bt1.addActionListener(frm);
  bt2.addActionListener(frm);      frm.add(lb0);
  frm.add(lb1);
  frm.add(txf1);
  frm.add(lb2);
  frm.add(txf2);
      frm.add(bt1);
  frm.add(bt2);
      
  frm.setDefaultCloseOperation(EXIT_ON_CLOSE);
  frm.setVisible(true);
  
}
public void actionPerformed(ActionEvent e)
{
      JButton bt=(JButton)e.getSource();
  if(bt==bt2)System.exit(0);
  if(bt==bt1)
{
      if(txf1.getText().equals(Account)&&txf2.getText().equals(Password))
{
  MainFrame frm_1=new MainFrame();
          frm_1.setSize(400,400);
  Clock clock=new Clock();
              frm_1.add(clock,"South");
  frm_1.setVisible(true);
              frm.setVisible(false);
  }
  else JOptionPane.showMessageDialog(bt1,"用户名或密码错误!\n请重新输入!","警告",JOptionPane.WARNING_MESSAGE);
    }    }}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;import java.util.*;
import java.util.concurrent.*; class Clock extends JPanel implements Runnable 
{
  
  private JLabel label = new JLabel();
  JPanel panel=new JPanel();  public Clock() 
  {
   label.setFont(new Font("Dialog", Font.BOLD, 22));
   flush();
   panel.add(label);
 
   ExecutorService exec = Executors.newCachedThreadPool();
   exec.execute(this);   add(panel,"Center");
  }  private void flush()
 {
  String strTime = String.format("%tT", new Date());
  label.setText(strTime);
 } public void run()
 {
  while(true) 
  {
   flush();
   try {Thread.sleep(1000);} catch(Exception e) {}
  }
 }
}