📄 phone.java~2~
字号:
package untitled1;import java.awt.*;import java.awt.event.*;import java.applet.*;public class phone extends Applet { PhoneCard phone; Keypad keys; String[] keylist = {"1","2","3","4","5","6","7","8","9","*","0","#"}; boolean isStandalone = false; /**Get a parameter value*/ public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } /**Construct the applet*/ public phone() { } /**Initialize the applet*/ public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } keys = new Keypad(keylist,4,3); add(keys); phone = new PhoneCard(); add(phone); } class Keypad extends Panel{ public Keypad(String[] keylist,int r,int c){ setLayout(new GridLayout(r,c,15,2)); for( int i=0;i<keylist.length;i++){ add(new Button(keylist[i])); } } } class PhoneCard extends Panel{ CardLayout c1; public PhoneCard(){ c1 = new CardLayout(); setLayout(c1); add("1",new Label("1")); add("2",new Label("2")); add("3",new Label("3")); add("4",new Label("4")); add("5",new Label("5")); add("6",new Label("6")); add("7",new Label("7")); add("8",new Label("8")); add("9",new Label("9")); add("*",new Label("*")); add("0",new Label("0")); add("#",new Label("#")); } public void show(String s){ c1.showd(this,s); } } public boolean action(Event e,Object button){ if(e.target instanceof Button) phone.showd((String)button); return true; } /**Component initialization*/ private void jbInit() throws Exception { } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -