?? choice.java~12~
字號:
package choice;import java.awt.*;import java.awt.event.*;import java.applet.*;import com.borland.jbcl.layout.*;public class choice extends Applet { boolean isStandalone = false; XYLayout xYLayout1 = new XYLayout(); Choice choice1 = new Choice(); /**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 choice() { } /**Initialize the applet*/ public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { this.setLayout(xYLayout1); choice1.setFont(new java.awt.Font("Dialog", 0, 16)); choice1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { choice1_itemStateChanged(e); } }); choice1.addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsAdapter() { }); this.addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsAdapter() { }); this.addMouseListener(new java.awt.event.MouseAdapter() { }); this.add(choice1, new XYConstraints(6, 9, 77, 20)); choice1.addItem("圓形"); choice1.addItem("正方形"); choice1.addItem("扇形"); choice1.addItem("橢圓"); } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; } public void paint(Graphics g){ switch(choice1.getSelectedIndex()){ case 0: g.drawOval(100,100,50,50); break; case 1: g.drawRect(100,100,50,50); break; case 2: g.drawArc(100,100,50,50,0,140); break; case 3: g.drawOval(100,100,50,70); break; } } void choice1_itemStateChanged(ItemEvent e) { repaint(); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -