java小游戏代码24点的简单介绍( 五 )


jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"2");
}
});
}
return jButton2;
}
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setBounds(140, 148, 42, 28);
jButton3.setText("3");
jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"3");
}
});
}
return jButton3;
}
/**
* This method initializes jButton4
*
* @return javax.swing.JButton
*/
private JButton getJButton4() {
if (jButton4 == null) {
jButton4 = new JButton();
jButton4.setBounds(190, 148, 42, 28);
jButton4.setText("4");
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"4");
}
});
}
return jButton4;
}
/**
* This method initializes jButton5
*
* @return javax.swing.JButton
*/
private JButton getJButton5() {
if (jButton5 == null) {
jButton5 = new JButton();
jButton5.setBounds(240, 148, 42, 28);
jButton5.setText("5");
jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"5");
}
});
}
return jButton5;
}
/**
* This method initializes jButton6
*
* @return javax.swing.JButton
*/
private JButton getJButton6() {
if (jButton6 == null) {
jButton6 = new JButton();
jButton6.setBounds(40, 188, 42, 28);
jButton6.setText("6");
jButton6.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"6");
}
});
}
return jButton6;
}
/**
* This method initializes jButton7
*
* @return javax.swing.JButton
*/
private JButton getJButton7() {
if (jButton7 == null) {
jButton7 = new JButton();
jButton7.setBounds(90, 188, 42, 28);
jButton7.setText("7");
jButton7.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"7");
}
});
}
return jButton7;
}
/**
* This method initializes jButton8
*
* @return javax.swing.JButton
*/
private JButton getJButton8() {
if (jButton8 == null) {
jButton8 = new JButton();
jButton8.setBounds(140, 188, 42, 28);
jButton8.setText("8");
jButton8.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"8");
}
});
}
return jButton8;
}
/**
* This method initializes jButton9
*
* @return javax.swing.JButton
*/
private JButton getJButton9() {
if (jButton9 == null) {
jButton9 = new JButton();
jButton9.setBounds(190, 188, 42, 28);
jButton9.setText("9");
jButton9.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
jTextField.setText(jTextField.getText()+"9");
}
});
}
return jButton9;
}
/**
* This method initializes jButton10
*
* @return javax.swing.JButton

推荐阅读