📄 stringsample.java
字号:
package untitled2;import java.awt.*;import java.awt.event.*;import java.applet.*;import com.borland.jbcl.layout.*;public class stringsample extends Applet { int i = 0; String str = null; boolean isStandalone = false; TextField text1 = new TextField(); Button button1 = new Button(); XYLayout xYLayout1 = new XYLayout(); /**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 stringsample() { } /**Initialize the applet*/ public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { text1.setFont(new java.awt.Font("Dialog", 0, 16)); button1.setFont(new java.awt.Font("Dialog", 0, 16)); button1.setLabel("添加"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button1_actionPerformed(e); } }); this.setLayout(xYLayout1); this.add(button1, new XYConstraints(190, 9, -1, -1)); this.add(text1, new XYConstraints(30, 9, 150, -1)); } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; } void button1_actionPerformed(ActionEvent e) { str = text1.getText() ; text1.setText(""); repaint(); } public void paint(Graphics g){ g.drawString(str,20,i*15+60) ; i++; } public void update(Graphics g){ paint(g); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -