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

📄 salaytsystemframe.java

📁 java开发的桌面系统
💻 JAVA
字号:
 /**
 * @(#)SalaytSystemFrame.java
 *
 *
 * @author 
 * @version 1.00 2008/7/7
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.ImageIcon;
import java.sql.*;


class MyPanel extends Panel{
	Frame f = null;
	
	public MyPanel(){
	}
	
	public MyPanel(Frame f){
		this.f = f;
	}
	
	
	public void paint(Graphics g){
		
		//画一幅图
	
		int w = f.getSize().width;//得到当前窗体的宽和高
		int h = f.getSize().height;
	
		ImageIcon imgIcon = new ImageIcon("1.jpg");
		Image img = imgIcon.getImage();
		
		g.drawImage(img,0,0,w,h,this);//根据窗体的大小来存放图片,可以动态调整图片大小
		
	}
}
public class SalaytSystemFrame extends Frame{
	
		Panel p;
		//制作菜单项
		MenuBar mb;
		Menu empmu,manegmu;
		MenuItem empItop,manegItop,allMesge;
		
		
		EmployeeDemo eTest = null;
		MagLoginDemo mTest = null;
		ShowAllInfo saiTest = null;

    
    public SalaytSystemFrame() {
    	super("工资管理系统");
    	this.init();
    	}
    	
    public void init(){
    	p = new MyPanel(this);

    	
    	
   	//关于菜单的制作
    	mb = new MenuBar();
    	empmu = new Menu("职员信息");
    	manegmu = new Menu("管理员");
    	
    	
    	allMesge = new MenuItem("显示全部信息");    	
    	empItop = new MenuItem("打开职工");
    	manegItop = new MenuItem("打开管理");
    	
    	
    	empmu.add(empItop);
    	empmu.add(allMesge);
    	manegmu.add(manegItop);
    	
    
    	mb.add(empmu);
    	mb.add(manegmu);
    	
    	
    	
    	empItop.addActionListener(new OnClickDemo());
    	manegItop.addActionListener(new OnClickDemo());
    	allMesge.addActionListener(new OnClickDemo());
    	
    	this.addWindowListener(new WindowAdapter(){
    		public void windowClosing(WindowEvent e){
    			System.exit(0);
    		}
    	});
    	
    	this.add(p);
    	this.setLocation(100,100);
    	this.setMenuBar(mb);
    	this.setSize(800,600);
    	this.setResizable(false);
    	this.setVisible(true);
    	
    	}
    	
    	private class OnClickDemo implements ActionListener{
    		public void actionPerformed(ActionEvent e){
    			
    			if(e.getActionCommand().equals("打开管理")){
    				if(mTest == null){
    					mTest = new MagLoginDemo();
    				}
    				else
    					mTest.setVisible(true);
    				}
    			else if(e.getActionCommand().equals("打开职工")){
    			
    				if(eTest == null){
    					eTest = new EmployeeDemo();
    				}
    				else
    					eTest.setVisible(true);
    			}
    			else if(e.getActionCommand().equals("显示全部信息")){
    				if(saiTest == null){
    					saiTest = new ShowAllInfo();
    				}
    				else
    					saiTest.setVisible(true);
    				}
    		}
    	}
    	
   
    	
    	
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        
        new SalaytSystemFrame();
    }
}

⌨️ 快捷键说明

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