?? inserturscorep.java
字號:
package dialog;import java.awt.*;import java.awt.event.*;import javax.swing.*;import Score;/** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */public class InsertURScoreP extends JPanel{ JLabel label1 = new JLabel(); JLabel label2 = new JLabel(); JLabel label3 = new JLabel(); JTextField textField1 = new JTextField(); JTextField textField2 = new JTextField(); JButton button1 = new JButton(); JButton button2 = new JButton(); //玩家的得分 int m_nScore; //對話框 JDialog m_dialog; public InsertURScoreP(int nScore,JDialog d) { m_dialog=d; m_nScore=nScore; try { jbInit(); textField2.setText(""+nScore); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { label1.setText("請輸入你的名字"); label1.setBounds(new Rectangle(52, 64, 116, 18)); label2.setText("你的得分為"); label2.setBounds(new Rectangle(52, 118, 83, 18)); this.setLayout(null); label3.setForeground(Color.red); label3.setText("祝賀你!你的得分已經(jīng)進(jìn)入Top10的行列"); label3.setBounds(new Rectangle(49, 25, 220, 18)); textField1.setColumns(10); textField1.setBounds(new Rectangle(186, 63, 56, 22)); textField2.setColumns(10); textField2.setEditable(false); textField2.setBounds(new Rectangle(186, 120, 56, 22)); button1.setLabel("確定"); button1.setBounds(new Rectangle(59, 165, 75, 29)); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button1_actionPerformed(e); } }); button2.setLabel("取消"); button2.setBounds(new Rectangle(160, 164, 75, 29)); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button2_actionPerformed(e); } }); this.add(label3, null); this.add(textField1, null); this.add(label1, null); this.add(label2, null); this.add(textField2, null); this.add(button1, null); this.add(button2, null); } void button1_actionPerformed(ActionEvent e) { Score score=new Score(); score.insertNameScore(textField1.getText().trim(),m_nScore); m_dialog.dispose(); } void button2_actionPerformed(ActionEvent e) { m_dialog.dispose(); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -