?? phonesimulator.java
字號:
import java.awt.*;
import java.io.*;
import javax.swing.*;
import java.net.*;
public class PhoneSimulator extends javax.swing.JApplet {
/**構造方法
*/
public PhoneSimulator() {
initComponents();
}
/** 初始化界面。
*/
private void initComponents() {//GEN-BEGIN:initComponents
functionRadioGroup = new javax.swing.ButtonGroup();
topPanel = new javax.swing.JPanel();
westPanel = new javax.swing.JPanel();
notepadLabel = new javax.swing.JLabel();
notepadScrollPane = new javax.swing.JScrollPane();
notepadTextArea = new javax.swing.JTextArea();
centerPanel = new javax.swing.JPanel();
phoneNumDisp = new javax.swing.JTextField();
buttonPanel = new javax.swing.JPanel();
Button1 = new javax.swing.JButton();
Button2 = new javax.swing.JButton();
Button3 = new javax.swing.JButton();
Button4 = new javax.swing.JButton();
Button5 = new javax.swing.JButton();
Button6 = new javax.swing.JButton();
Button7 = new javax.swing.JButton();
Button8 = new javax.swing.JButton();
Button9 = new javax.swing.JButton();
ButtonStar = new javax.swing.JButton();
Button0 = new javax.swing.JButton();
ButtonSharp = new javax.swing.JButton();
eastPanel = new javax.swing.JPanel();
phoneAddLabel = new javax.swing.JLabel();
phoneAddScrollPane = new javax.swing.JScrollPane();
phoneAddTextArea = new javax.swing.JTextArea();
southPanel = new javax.swing.JPanel();
dialButton = new javax.swing.JButton();
storeButton = new javax.swing.JButton();
saveButton = new javax.swing.JButton();
hangupButton = new javax.swing.JButton();
redialButton = new javax.swing.JButton();
directListenToggle = new javax.swing.JToggleButton();
pauseToggle = new javax.swing.JToggleButton();
topPanel.setLayout(new java.awt.BorderLayout());
topPanel.setPreferredSize(new java.awt.Dimension(550, 400));
westPanel.setLayout(new java.awt.BorderLayout());
westPanel.setPreferredSize(new java.awt.Dimension(100, 40));
notepadLabel.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
notepadLabel.setText("留言簿");
notepadLabel.setFont(new java.awt.Font("宋體", 1, 14));
notepadLabel.setPreferredSize(new java.awt.Dimension(48, 30));
westPanel.add(notepadLabel, java.awt.BorderLayout.NORTH);
notepadScrollPane.setMinimumSize(new java.awt.Dimension(22, 20));
notepadTextArea.setToolTipText("請留言");
notepadScrollPane.setViewportView(notepadTextArea);
westPanel.add(notepadScrollPane, java.awt.BorderLayout.CENTER);
topPanel.add(westPanel, java.awt.BorderLayout.WEST);
centerPanel.setLayout(new java.awt.BorderLayout());
centerPanel.setPreferredSize(new java.awt.Dimension(250, 40));
centerPanel.setMinimumSize(new java.awt.Dimension(483, 40));
phoneNumDisp.setEditable(false);
phoneNumDisp.setPreferredSize(new java.awt.Dimension(4, 30));
phoneNumDisp.setMinimumSize(new java.awt.Dimension(4, 20));
centerPanel.add(phoneNumDisp, java.awt.BorderLayout.NORTH);
buttonPanel.setLayout(new java.awt.GridLayout(4, 3, 1, 1));
buttonPanel.setPreferredSize(new java.awt.Dimension(150, 50));
Button1.setToolTipText("1");
Button1.setFont(new java.awt.Font("Arial Black", 0, 18));
Button1.setText("1");
Button1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button1);
Button2.setToolTipText("2");
Button2.setFont(new java.awt.Font("Arial Black", 0, 18));
Button2.setText("2");
Button2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button2);
Button3.setToolTipText("3");
Button3.setFont(new java.awt.Font("Arial Black", 0, 18));
Button3.setText("3");
Button3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button3);
Button4.setToolTipText("4");
Button4.setFont(new java.awt.Font("Arial Black", 0, 18));
Button4.setText("4");
Button4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button4);
Button5.setToolTipText("5");
Button5.setFont(new java.awt.Font("Arial Black", 0, 18));
Button5.setText("5");
Button5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button5);
Button6.setToolTipText("6");
Button6.setFont(new java.awt.Font("Arial Black", 0, 18));
Button6.setText("6");
Button6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button6);
Button7.setToolTipText("7");
Button7.setFont(new java.awt.Font("Arial Black", 0, 18));
Button7.setText("7");
Button7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button7);
Button8.setToolTipText("8");
Button8.setFont(new java.awt.Font("Arial Black", 0, 18));
Button8.setText("8");
Button8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button8);
Button9.setToolTipText("9");
Button9.setFont(new java.awt.Font("Arial Black", 0, 18));
Button9.setText("9");
Button9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button9);
ButtonStar.setToolTipText("*");
ButtonStar.setFont(new java.awt.Font("Arial Black", 0, 26));
ButtonStar.setText("*");
ButtonStar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(ButtonStar);
Button0.setToolTipText("0");
Button0.setFont(new java.awt.Font("Arial Black", 0, 18));
Button0.setText("0");
Button0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(Button0);
ButtonSharp.setToolTipText("#");
ButtonSharp.setFont(new java.awt.Font("Arial Black", 0, 18));
ButtonSharp.setText("#");
ButtonSharp.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processNumberDial(evt);
}
});
buttonPanel.add(ButtonSharp);
centerPanel.add(buttonPanel, java.awt.BorderLayout.CENTER);
topPanel.add(centerPanel, java.awt.BorderLayout.CENTER);
eastPanel.setLayout(new java.awt.BorderLayout());
eastPanel.setPreferredSize(new java.awt.Dimension(100, 40));
phoneAddLabel.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
phoneAddLabel.setText("地址簿");
phoneAddLabel.setFont(new java.awt.Font("華文行楷", 1, 14));
phoneAddLabel.setPreferredSize(new java.awt.Dimension(37, 30));
phoneAddLabel.setMaximumSize(new java.awt.Dimension(37, 20));
eastPanel.add(phoneAddLabel, java.awt.BorderLayout.NORTH);
phoneAddTextArea.addCaretListener(new javax.swing.event.CaretListener() {
public void caretUpdate(javax.swing.event.CaretEvent evt) {
phoneAddTextAreaCaretUpdate(evt);
}
});
phoneAddScrollPane.setViewportView(phoneAddTextArea);
eastPanel.add(phoneAddScrollPane, java.awt.BorderLayout.CENTER);
topPanel.add(eastPanel, java.awt.BorderLayout.EAST);
southPanel.setLayout(new java.awt.GridBagLayout());
java.awt.GridBagConstraints gridBagConstraints1;
southPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 0, 0, 0)));
southPanel.setPreferredSize(new java.awt.Dimension(550, 70));
dialButton.setToolTipText("撥號");
dialButton.setFont(new java.awt.Font("宋體", 0, 12));
dialButton.setText("撥號");
dialButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dialButtonActionPerformed(evt);
}
});
gridBagConstraints1 = new java.awt.GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 0;
gridBagConstraints1.gridheight = 2;
gridBagConstraints1.ipadx = 1;
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints1.weightx = 0.5;
southPanel.add(dialButton, gridBagConstraints1);
storeButton.setToolTipText("存儲當前的號碼到地址簿");
storeButton.setFont(new java.awt.Font("宋體", 0, 12));
storeButton.setText("存儲");
storeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
storeButtonActionPerformed(evt);
}
});
gridBagConstraints1 = new java.awt.GridBagConstraints();
gridBagConstraints1.gridx = 5;
gridBagConstraints1.gridy = 1;
gridBagConstraints1.weightx = 0.5;
southPanel.add(storeButton, gridBagConstraints1);
saveButton.setToolTipText("保存當前的地址簿到磁盤");
saveButton.setFont(new java.awt.Font("宋體", 0, 12));
saveButton.setText("保存");
saveButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveButtonActionPerformed(evt);
}
});
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -