📄 driver.java
字号:
import java.awt.*;import javax.swing.JFrame;/** Author: David D. Riley * Date: Jan, 2005 * Creating Labels (Figure 3.14) */public class Driver { private JFrame window; private Label cityEngland, cityFrance, cityJapan, cityUSA; public Driver() { window = new JFrame( "Cities of the World" ); window.setBounds(50, 50, 400, 300); window.setLayout(null); window.setBackground(Color.white); window.setVisible(true); cityEngland = new Label( "London" ); cityEngland.setBounds(100, 200, 120, 20); cityEngland.setForeground(Color.green); window.add(cityEngland,0); cityEngland.repaint(); cityFrance = new Label ( "Paris" ); cityFrance.setBounds(250, 30, 100, 20); cityFrance.setForeground(Color.blue); window.add(cityFrance,0); cityFrance.repaint(); cityJapan = new Label ( "Tokyo" ); cityJapan.setBounds(30, 75, 100, 20); cityJapan.setForeground(Color.red); window.add(cityJapan,0); cityJapan.repaint(); cityUSA = new Label ( "New York City" ); cityUSA.setBounds(225, 250, 150, 20); cityUSA.setForeground(Color.white); cityUSA.setBackground(Color.blue); window.add(cityUSA,0); cityUSA.repaint(); window.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -