⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 beginframe.java

📁 用java编写的人事管理系统,很好的 学习下吧
💻 JAVA
字号:
/**
 * 源文件:BeginFrame.java
 * 作用:启动窗体
 */
package mypro;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class BeginFrame extends JFrame implements ActionListener
{
	private JLabel labTitle;
	private JProgressBar pbarStart;//
	private Timer timer;  //在指定延迟之后激发一个或多个操作事件
	
	static 
	{
   	 	//设置窗体为豪华框架
   		JFrame.setDefaultLookAndFeelDecorated(true);		
	}
	
	public BeginFrame()
	{
		labTitle = new JLabel("系统正在启动...");
		pbarStart=new JProgressBar(JProgressBar.HORIZONTAL,0,100);//创建横向、值为0-100的进度条。
		timer=new Timer(100,this);//创建一个每100毫秒将通知其侦听器的 Timer
		timer.start();//启动该 Timer,以使它开始向其侦听器发送操作事件。
		
		labTitle.setBounds(new Rectangle(47, 80, 228, 45));
		labTitle.setFont(new java.awt.Font("华文新魏", Font.BOLD | Font.ITALIC, 25));
        pbarStart.setBounds(new Rectangle(63, 156, 275, 26));
        pbarStart.setStringPainted(true);//确定呈现进度字符串
        
        Container me=this.getContentPane();
		me.setLayout(null);
		me.add(labTitle);
		me.add(pbarStart);
        
		this.setTitle("正在启动...");
		this.setSize(400,300);
		this.setResizable(false);
		this.setLocationRelativeTo(this);//窗体居中显示
		this.setVisible(true);
	}
	public void actionPerformed(ActionEvent e)
	{
		int value=pbarStart.getValue();
		if(value<100)
		{
			value++;
			pbarStart.setValue(value);
		}
		else
		{
			timer.stop();//停止该 Timer,以使它停止向其侦听器发送操作事件
			this.dispose();
			new LandFrame();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -