📄 driver.java
字号:
import javax.swing.JFrame;import java.awt.TextArea;/** powerOfTwo Program (Figure 10.5) * Author: David Riley * Date: January, 2005 */public class Driver { private JFrame window; private TextArea outPane; /** post: A window is created containing a text area * and the text area contains the powers of 2 less than 100 */ public Driver() { int powerOfTwo; window = new JFrame("Powers of 2"); window.setBounds(10, 10, 200, 140); window.setVisible(true); window.setLayout(null); outPane = new TextArea(); outPane.setBounds(20, 20, 150, 80); window.add(outPane, 0); powerOfTwo = 2; while ( powerOfTwo < 100 ) { outPane.append("Next power: " + powerOfTwo + "\n"); powerOfTwo = powerOfTwo * 2; } window.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -