📄 intlabel.java
字号:
import javax.swing.*;import java.util.*;public class IntLabel extends JLabel implements Observer { private ObservableInt intValue; // The value being observed public IntLabel(ObservableInt theInt) { intValue = theInt; // Tell intValue you're interested in it intValue.addObserver(this); // Initialize the label to the current value of intValue setText( "" + intValue.getValue() ); } // Update will be called whenever intValue is changed, so just update // the label text. public void update(Observable obs, Object arg) { setText( "" + intValue.getValue() ); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -