?? myspace.java
字號:
/*
* MySpace.java
*
* Created on 2009年3月17日, 下午3:03
*/
package com.njupt.syc;
import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.InputStream;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import com.njupt.syc.*;
/**
*
* @author Administrator
*/
public class MySpace extends javax.swing.JFrame {
/** Creates new form MySpace */
public MySpace() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
calcPanel = new javax.swing.JPanel();
resultField = new javax.swing.JTextField();
calcButton1 = new javax.swing.JButton();
calcButton6 = new javax.swing.JButton();
calcButton5 = new javax.swing.JButton();
calcButtonEq = new javax.swing.JButton();
calcButtonDiv = new javax.swing.JButton();
calcButtonMul = new javax.swing.JButton();
calcButtonSub = new javax.swing.JButton();
calcButton4 = new javax.swing.JButton();
calcButton3 = new javax.swing.JButton();
calcButton2 = new javax.swing.JButton();
calcButton0 = new javax.swing.JButton();
calcButton9 = new javax.swing.JButton();
calcButton8 = new javax.swing.JButton();
calcButton7 = new javax.swing.JButton();
calcButtonDot = new javax.swing.JButton();
calcButtonPlus = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
myInfoPanel = new javax.swing.JPanel();
nLabel = new javax.swing.JLabel();
nameLabel = new javax.swing.JLabel();
cLabel = new javax.swing.JLabel();
cellLabel = new javax.swing.JLabel();
nicknameLabel = new javax.swing.JLabel();
nickLabel = new javax.swing.JLabel();
CodeLabel = new javax.swing.JLabel();
cellphoneLabel = new javax.swing.JLabel();
hobLabel = new javax.swing.JLabel();
hobbyLabel = new javax.swing.JLabel();
picPanel = new javax.swing.JPanel();
picLabel = new javax.swing.JLabel();
musicPanel = new javax.swing.JPanel();
playButton = new javax.swing.JButton();
loopButton = new javax.swing.JButton();
stopButton = new javax.swing.JButton();
musicLabel = new javax.swing.JLabel();
flashButton = new javax.swing.JButton();
changeImageButton = new javax.swing.JButton();
resultField = new javax.swing.JTextField();
calcButton1 = new javax.swing.JButton();
calcButton6 = new javax.swing.JButton();
calcButton5 = new javax.swing.JButton();
calcButtonEq = new javax.swing.JButton();
calcButtonDiv = new javax.swing.JButton();
calcButtonMul = new javax.swing.JButton();
calcButtonSub = new javax.swing.JButton();
calcButton4 = new javax.swing.JButton();
calcButton3 = new javax.swing.JButton();
calcButton2 = new javax.swing.JButton();
calcButton0 = new javax.swing.JButton();
calcButton9 = new javax.swing.JButton();
calcButton8 = new javax.swing.JButton();
calcButton7 = new javax.swing.JButton();
calcButtonDot = new javax.swing.JButton();
calcButtonPlus = new javax.swing.JButton();
nicknameLabel = new javax.swing.JLabel();
//picPanel = new ImagePanel(getImage("pic.jpg"));
picPanel =new javax.swing.JPanel();
musicPanel = new javax.swing.JPanel();
playButton = new javax.swing.JButton();
loopButton = new javax.swing.JButton();
stopButton = new javax.swing.JButton();
musicLabel = new javax.swing.JLabel();
flashButton = new javax.swing.JButton();
picLabel = new javax.swing.JLabel();
changeImageButton = new javax.swing.JButton();
jMenuBar = new javax.swing.JMenuBar();
jMenuOpen = new javax.swing.JMenu();
jMenuItemPic = new javax.swing.JMenuItem();
jMenuItemExit = new javax.swing.JMenuItem();
jMenuEdit = new javax.swing.JMenu();
// musicPanel.add(musicLabel);
//musicPanel.add(playButton);
//musicPanel.add(loopButton);
//musicPanel.add(stopButton);
try {
sound1 = Applet.newAudioClip(file1.toURL());
chosenClip = sound1;
} catch(OutOfMemoryError e){
System.out.println("內存溢出");
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}
stopButton.setEnabled(false);
//container.add(controlPanel, BorderLayout.CENTER);
//container.add(status, BorderLayout.SOUTH);
setSize(300, 130);
setVisible(true);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //關閉窗口時退出程序
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
resultField.setText("0");
calcButton1.setText("1");
calcButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton1ActionPerformed(evt);
}
});
calcButton6.setText("6");
calcButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton6ActionPerformed(evt);
}
});
calcButton5.setText("5");
calcButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton5ActionPerformed(evt);
}
});
calcButtonEq.setText("=");
calcButtonEq.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButtonEqActionPerformed(evt);
}
});
calcButtonDiv.setText("/");
calcButtonDiv.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButtonDivActionPerformed(evt);
}
});
calcButtonMul.setText("*");
calcButtonMul.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButtonMulActionPerformed(evt);
}
});
calcButtonSub.setText("-");
calcButtonSub.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButtonSubActionPerformed(evt);
}
});
calcButton4.setText("4");
calcButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton4ActionPerformed(evt);
}
});
calcButton3.setText("3");
calcButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton3ActionPerformed(evt);
}
});
calcButton2.setText("2");
calcButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton2ActionPerformed(evt);
}
});
calcButton0.setText("0");
calcButton0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton0ActionPerformed(evt);
}
});
calcButton9.setText("9");
calcButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton9ActionPerformed(evt);
}
});
calcButton8.setText("8");
calcButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton8ActionPerformed(evt);
}
});
calcButton7.setText("7");
calcButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButton7ActionPerformed(evt);
}
});
calcButtonDot.setText(".");
calcButtonDot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButtonDotActionPerformed(evt);
}
});
calcButtonPlus.setText("+");
calcButtonPlus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcButtonPlusActionPerformed(evt);
}
});
jLabel1.setText("計算器");
javax.swing.GroupLayout calcPanelLayout = new javax.swing.GroupLayout(calcPanel);
calcPanel.setLayout(calcPanelLayout);
calcPanelLayout.setHorizontalGroup(
calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(calcPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(calcPanelLayout.createSequentialGroup()
.addComponent(calcButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(calcButton4))
.addGroup(calcPanelLayout.createSequentialGroup()
.addComponent(calcButtonSub)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButtonMul)
.addGap(14, 14, 14)
.addComponent(calcButtonDiv)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButtonEq))
.addGroup(calcPanelLayout.createSequentialGroup()
.addComponent(calcButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(calcButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButton7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButton8))
.addComponent(resultField))
.addGroup(calcPanelLayout.createSequentialGroup()
.addComponent(calcButton9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButton0)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButtonDot)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(calcButtonPlus))
.addComponent(jLabel1))
.addContainerGap())
);
calcPanelLayout.setVerticalGroup(
calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(calcPanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(resultField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(calcButton1)
.addComponent(calcButton2)
.addComponent(calcButton3)
.addComponent(calcButton4))
.addGap(18, 18, 18)
.addGroup(calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(calcButton5)
.addComponent(calcButton6)
.addComponent(calcButton7)
.addComponent(calcButton8))
.addGap(18, 18, 18)
.addGroup(calcPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -