?? myspace.java
字號:
this.resultField.setText(str);
finishflag = false;
}
str = str + this.calcButton5.getText();
this.resultField.setText(str);
}
private void calcButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (finishflag) {
str = "";
this.resultField.setText(str);
finishflag = false;
}
str = str + this.calcButton6.getText();
this.resultField.setText(str);
}
private void calcButton7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (finishflag) {
str = "";
this.resultField.setText(str);
finishflag = false;
}
str = str + this.calcButton7.getText();
this.resultField.setText(str);
//num(7);
}
private void calcButton8ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (finishflag) {
str = "";
this.resultField.setText(str);
finishflag = false;
}
str = str + this.calcButton8.getText();
this.resultField.setText(str);
//num(8);
}
private void calcButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (finishflag) {
str = "";
this.resultField.setText(str);
finishflag = false;
}
str = str + this.calcButton9.getText();
this.resultField.setText(str);
//num(9);
}
private void calcButton0ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (finishflag) {
str = "";
this.resultField.setText(str);
finishflag = false;
}
str = this.resultField.getText();
if (str.equals("0")) {
System.out.println(str.equals("0"));
//this.resultField.setText(str);
str="0";
}
else {
if (!this.resultField.getText().equals("")) {
// System.out.println(this.resultField.getText()+"aaaaaaaaaaaaa");
if (Double.parseDouble(this.resultField.getText()) >= 1) {
//this.resultField.setText(str);
str = str + this.calcButton0.getText();
this.resultField.setText(str);
if (divflag) {
str = "";
str = str + this.calcButton0.getText();
this.resultField.setText(str);
}
} else {
//str = "";
str = str + this.calcButton0.getText();
System.out.println(str);
this.resultField.setText(str);
}
}
else {
//this.resultField.setText("0");
//str=this.resultField.getText()+str;
}
}
//str = this.resultField.getText();
// num(0);
}
private void calcButtonDotActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (finishflag) {
str = "";
finishflag = false;
}
if (dotflag) {
str = str + this.calcButtonDot.getText();
this.resultField.setText(str);
dotflag = false;
}
}
private void calcButtonPlusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
num1 = Double.parseDouble(str);
System.out.println(str);
str = "";
//this.resultField.setText(str);
this.resultField.setText(String.valueOf(num1));
addflag = true;
dotflag = true;
}
private void calcButtonEqActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (addflag) {
num2 = Double.parseDouble(str);
num = num1 + num2;
addflag = false;
this.resultField.setText(String.valueOf(num));
}
if (subflag) {
num2 = Double.parseDouble(str);
num = num1 - num2;
subflag = false;
this.resultField.setText(String.valueOf(num));
}
if (mulflag) {
num2 = Double.parseDouble(str);
num = num1 * num2;
mulflag = false;
this.resultField.setText(String.valueOf(num));
}
//System.out.println(num2);
if (divflag) {
num2 = Double.parseDouble(str);
if (num2 != 0) {
num = num1 / num2;
divflag = false;
System.out.println("sdfsfsf");
System.out.println(num);
this.resultField.setText(String.valueOf(num));
} else {
System.out.println("ffff");
//str="Error";
//String warn="Error";
this.resultField.setText("Error");
}
}
str = "";
finishflag = true;
dotflag = true;
num1 = 0;
num2 = 0;
}
private void calcButtonSubActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
num1 = Double.parseDouble(str);
str = "";
this.resultField.setText(String.valueOf(num1));
subflag = true;
dotflag = true;
}
private void calcButtonMulActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
num1 = Double.parseDouble(str);
str = "";
this.resultField.setText(String.valueOf(num1));
mulflag = true;
dotflag = true;
}
private void calcButtonDivActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
num1 = Double.parseDouble(str);
str = "";
this.resultField.setText(String.valueOf(num1));
divflag = true;
dotflag = true;
}
private void flashButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//FlashFrame ff=new FlashFrame("24.swf");
FlashPlayer ff=new FlashPlayer("24.swf");
ff.setVisible(true);
ff.setSize(400, 300);
ff.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}
private void changeImageButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser fileChooser = new JFileChooser();
if(fileChooser.showOpenDialog(null) == 0){
File selectedFile = fileChooser.getSelectedFile();
//picPanel.setIcon(new ImageIcon(selectedFile.getAbsolutePath()));
picLabel.setIcon(new ImageIcon(selectedFile.getAbsolutePath()));
// picTextField.setText(selectedFile.getAbsolutePath());
}
}
private void jMenuItemPicActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser fileChooser = new JFileChooser();
if(fileChooser.showOpenDialog(null) == 0){
File selectedFile = fileChooser.getSelectedFile();
//picPanel.setIcon(new ImageIcon(selectedFile.getAbsolutePath()));
picLabel.setIcon(new ImageIcon(selectedFile.getAbsolutePath()));
// picTextField.setText(selectedFile.getAbsolutePath());
}
}
private void jMenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
public Image getImage(String url){
Image m_image = null;
try {
InputStream in = getClass().getResourceAsStream(url);
if (in == null) {
System.err.println("Image not found.");
return null;
}
byte[] buffer = new byte[in.available()];
in.read(buffer);
m_image = Toolkit.getDefaultToolkit().createImage(buffer);
} catch (java.io.IOException e) {
System.err.println("Unable to read image.");
e.printStackTrace();
}
return m_image;
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MySpace().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel CodeLabel;
private javax.swing.JLabel cLabel;
private javax.swing.JButton calcButton0;
private javax.swing.JButton calcButton1;
private javax.swing.JButton calcButton2;
private javax.swing.JButton calcButton3;
private javax.swing.JButton calcButton4;
private javax.swing.JButton calcButton5;
private javax.swing.JButton calcButton6;
private javax.swing.JButton calcButton7;
private javax.swing.JButton calcButton8;
private javax.swing.JButton calcButton9;
private javax.swing.JButton calcButtonDiv;
private javax.swing.JButton calcButtonDot;
private javax.swing.JButton calcButtonEq;
private javax.swing.JButton calcButtonMul;
private javax.swing.JButton calcButtonPlus;
private javax.swing.JButton calcButtonSub;
private javax.swing.JPanel calcPanel;
private javax.swing.JLabel cellLabel;
private javax.swing.JLabel cellphoneLabel;
private javax.swing.JLabel hobLabel;
private javax.swing.JLabel hobbyLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel myInfoPanel;
private javax.swing.JLabel nLabel;
private javax.swing.JLabel nameLabel;
private javax.swing.JLabel nickLabel;
private javax.swing.JLabel nicknameLabel;
private javax.swing.JPanel picPanel;
private javax.swing.JTextField resultField;
private javax.swing.JButton loopButton;
private javax.swing.JPanel musicPanel;
private javax.swing.JButton playButton;
private javax.swing.JButton stopButton;
private javax.swing.JLabel musicLabel;
private javax.swing.JButton flashButton;
private javax.swing.JButton changeImageButton;
private javax.swing.JLabel picLabel;
private javax.swing.JMenuBar jMenuBar;
private javax.swing.JMenu jMenuEdit;
private javax.swing.JMenuItem jMenuItemExit;
private javax.swing.JMenuItem jMenuItemPic;
private javax.swing.JMenu jMenuOpen;
// End of variables declaration
private boolean end, addflag, subflag, mulflag, divflag, dotflag = true, zeroflag = true, finishflag = false;
private String str = "";
double num1, num2, num;
boolean looping = false;
File file1 = new File("1.wav");
AudioClip sound1;
AudioClip chosenClip;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -