📄 setgame.java~1~
字号:
package mymatrix;import java.awt.*;import javax.swing.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class SetGame extends JDialog { TFrame m_tFrame; JPanel panel1 = new JPanel(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JComboBox jComboBox1; JCheckBox jCheckBox2=new JCheckBox(); JCheckBox jCheckBox3=new JCheckBox(); JLabel jLabel3 = new JLabel(); JComboBox jComboBox2 ; JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JComboBox jComboBox3; public SetGame(TFrame frame, String title, boolean modal) { super(frame, title, modal); m_tFrame=frame; try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public SetGame(TFrame frame) { this(frame, "", false); } private void jbInit() throws Exception { panel1.setLayout(null); jLabel1.setFont(new java.awt.Font("Dialog", 0, 13)); jLabel1.setText("对手状况:"); jLabel1.setBounds(new Rectangle(47, 15, 82, 22)); jLabel2.setBounds(new Rectangle(47, 44, 73, 22)); jLabel2.setText("游戏速度:"); jLabel2.setFont(new java.awt.Font("Dialog", 0, 13)); jButton1.addActionListener(new SetGame_jButton1_actionAdapter(this)); jButton2.addActionListener(new SetGame_jButton2_actionAdapter(this)); String a1[]={"二人对战","网络对战","人机对战"}; jComboBox1=new JComboBox(a1); jComboBox1.setBounds(new Rectangle(117, 14, 90, 23)); jComboBox1.setFont(new java.awt.Font("Dialog", 0, 13)); jComboBox1.setSelectedIndex(0); //select the first item jCheckBox2.setBounds(new Rectangle(77, 100, 92, 27)); jCheckBox2.setText("背景音乐:"); jCheckBox2.setFont(new java.awt.Font("Dialog", 0, 13)); jCheckBox3.setBounds(new Rectangle(77, 130, 91, 27)); jCheckBox3.setText("声音效果:"); jCheckBox3.setFont(new java.awt.Font("Dialog", 0, 13)); jCheckBox3.setSelected(true); jLabel3.setFont(new java.awt.Font("Dialog", 0, 13)); jLabel3.setText("电脑速度:"); jLabel3.setBounds(new Rectangle(47, 72, 73, 22)); String a2[]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}; jComboBox2=new JComboBox(a2); jComboBox2.setBounds(new Rectangle(117, 42, 60, 23)); jComboBox2.setFont(new java.awt.Font("Dialog", 0, 13)); jComboBox2.setSelectedIndex(4); jButton1.setBounds(new Rectangle(52, 166, 73, 27)); jButton1.setFont(new java.awt.Font("Dialog", 0, 13)); jButton1.setText("确定"); jButton2.setText("取消"); jButton2.setFont(new java.awt.Font("Dialog", 0, 13)); jButton2.setBounds(new Rectangle(133, 165, 73, 27));// String a3[]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}; jComboBox3=new JComboBox(a2); jComboBox3.setBounds(new Rectangle(117, 71, 60, 23)); jComboBox3.setFont(new java.awt.Font("Dialog", 0, 13)); jComboBox3.setSelectedIndex(4); getContentPane().add(panel1); panel1.add(jLabel1, null); panel1.add(jComboBox1, null); panel1.add(jComboBox2, null); panel1.add(jLabel2, null); panel1.add(jLabel3, null); panel1.add(jComboBox3, null); panel1.add(jCheckBox2, null); panel1.add(jCheckBox3, null); panel1.add(jButton2, null); panel1.add(jButton1, null); } void jButton1_actionPerformed(ActionEvent e) { boolean is_select=this.jCheckBox2.isSelected(); if(is_select) m_tFrame.start(); else m_tFrame.stop(); m_tFrame.isPlay=is_select; m_tFrame.isSoundEfect=this.jCheckBox2.isSelected(); m_tFrame.removeTerics(); if(jComboBox2.getSelectedIndex()==0){ m_tFrame.c_tetrics.setPlayLevel(Integer.parseInt(jComboBox2. getSelectedItem().toString())); m_tFrame.c_tetrics.repaint(); m_tFrame.m_nRivalStatus=m_tFrame.P_RIVAL;// m_tFrame.removeTerics(); // m_tFrame.setTerics(1); } else if(jComboBox2.getSelectedIndex()==1){ m_tFrame.m_tetrics.setPlayLevel(Integer.parseInt(jComboBox2. getSelectedItem().toString())); m_tFrame.m_tetrics.repaint(); m_tFrame.m_nRivalStatus=m_tFrame.NET_RIVAL;// m_tFrame.removeTerics();// m_tFrame.setTerics(0); } else if(jComboBox2.getSelectedIndex()==2){ m_tFrame.p_tetrics.setPlayLevel(Integer.parseInt(jComboBox2. getSelectedItem().toString())); m_tFrame.p_tetrics.repaint(); m_tFrame.m_nRivalStatus=m_tFrame.COMPUTER_RIVAL;// m_tFrame.removeTerics();// m_tFrame.setTerics(2); } this.dispose(); } void jButton2_actionPerformed(ActionEvent e) { this.dispose(); }}class SetGame_jButton1_actionAdapter implements java.awt.event.ActionListener { SetGame adaptee; SetGame_jButton1_actionAdapter(SetGame adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}class SetGame_jButton2_actionAdapter implements java.awt.event.ActionListener { SetGame adaptee; SetGame_jButton2_actionAdapter(SetGame adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -