intlabel.java
来自「java 完全探索的随书源码」· Java 代码 · 共 23 行
JAVA
23 行
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 + =
减小字号Ctrl + -
显示快捷键?