欢迎来到天天文库
浏览记录
ID:38265033
大小:106.54 KB
页数:6页
时间:2019-06-07
《Java模拟Windows开始菜单》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、packagewindowcomponents;importjava.awt.BorderLayout;importjava.awt.Color;importjava.awt.Font;importjava.awt.FontMetrics;importjava.awt.GradientPaint;importjava.awt.Graphics;importjava.awt.Graphics2D;importjava.awt.Image;importjava.awt.Insets;importjava.awt.event.ActionEvent;impor
2、tjava.awt.event.ActionListener;importjava.awt.geom.AffineTransform;importjava.awt.image.BufferedImage;importjavax.swing.ImageIcon;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JMenuItem;importjavax.swing.JPanel;importjavax.swing.JPopupMenu;publicclassWindow
3、sStartMenuSimulation{/***@paramargs*/publicstaticvoidmain(String[]args){//TODOAuto-generatedmethodstubDemoWindow15dw=newDemoWindow15("模拟Windows开始菜单");dw.setBounds(dw.getToolkit().getScreenSize().width/3,dw.getToolkit().getScreenSize().height/3,dw.getToolkit().getScreenSize().widt
4、h/3,dw.getToolkit().getScreenSize().height/3);dw.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);dw.setVisible(true);}}classDemoWindow15extendsJFrameimplementsActionListener{//菜单项图片ImageupdateImage=newImageIcon("images/update.gif").getImage();ImageprogramImage=newImageIcon("images
5、/program.gif").getImage();ImagedocumentImage=newImageIcon("images/document.gif").getImage();ImagesetImage=newImageIcon("images/set.gif").getImage();ImagefindImage=newImageIcon("images/find.gif").getImage();ImagehelpImage=newImageIcon("images/help.gif").getImage();ImagerunImage=ne
6、wImageIcon("images/run.gif").getImage();ImagelogoutImage=newImageIcon("images/logout.gif").getImage();ImageshutdownImage=newImageIcon("images/shutdown.gif").getImage();//按钮图片ImageIconwindowsImage=newImageIcon("images/windows.gif");//“开始”按钮JButtonjb=newJButton("开始",windowsImage);S
7、tartMenusm=newStartMenu();//布局面板JPaneljp1=newJPanel();JPaneljp2=newJPanel();ImageMenu1im=null;publicDemoWindow15(Stringtitle){super(title);jb.setFont(newFont("宋体",Font.BOLD,18));jp2.setLayout(newBorderLayout());jp2.add(jb,BorderLayout.WEST);add(jp1,BorderLayout.CENTER);add(jp2,Bo
8、rderLayout.SOUTH);im=newImageMenu1("Wind
此文档下载收益归作者所有