📄 .#merg43023cvs
字号:
/* * SBMain.java * * Created on 2007年12月18日, 下午12:22 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package SBGameCore;import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JFrame;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JPanel;import javax.swing.JSeparator;/** * * @author wusir */public class SBMain extends JFrame implements ActionListener{ GraphicsPanel gp=new GraphicsPanel(); JMenuBar menuBar = new JMenuBar(); JMenu game_Menu = new JMenu(); JMenuItem newGame_Item = new JMenuItem(); JMenuItem Score_Item = new JMenuItem(); JSeparator jSeparator = new JSeparator(); JMenuItem Exit_Item = new JMenuItem(); BorderLayout layout=new BorderLayout(); /** Creates a new instance of SBMain */ public SBMain() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("ShotBird"); game_Menu.setText("\u6e38\u620f"); newGame_Item.setText("\u65b0\u5efa\u6e38\u620f"); newGame_Item.addActionListener(this); game_Menu.add(newGame_Item); Score_Item.setText("\u5f97\u5206"); game_Menu.add(Score_Item); game_Menu.add(jSeparator); Exit_Item.setText("\u9000\u51fa"); Exit_Item.addActionListener(this); game_Menu.add(Exit_Item); menuBar.add(game_Menu); setJMenuBar(menuBar); setPreferredSize(new Dimension(1000,700)); setLayout(layout); //add(game_Menu,layout.NORTH); add(gp,layout.CENTER); pack(); setResizable(false); } public void actionPerformed(ActionEvent e) { if (e.getSource() == Exit_Item) { this.Exit_ItemActionPerformed(e); } else if (e.getSource() == newGame_Item) { this.newGame_ItemActionPerformed(e); } } private void Exit_ItemActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void newGame_ItemActionPerformed(java.awt.event.ActionEvent evt) { this.gp.game = new Thread(this.gp) ; this.gp.game.setPriority(Thread.MIN_PRIORITY) ; //线程启动 this.gp.game.start() ; this.gp.buf_g.dispose() ; /*if (this.gp.game_over) { this.gp.game_over = false ; if (this.gp.game != null) { this.gp.game.stop() ; this.gp.game = null ; } this.gp.Nbird = 1 ; this.gp.score = 0 ; this.gp.Vbird.removeAllElements() ; this.gp.Vfeather.removeAllElements() ; //新建一个线程 this.gp.game = new Thread(this.gp) ; this.gp.game.setPriority(Thread.MIN_PRIORITY) ; //线程启动 this.gp.game.start() ; this.gp.buf_g.dispose() ; }*/ // this.gp.run(); } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here SBMain sbm=new SBMain(); sbm.setVisible(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -