fahrenheitslider.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 28 行
JAVA
28 行
// Figure 8.48import javax.swing.event.ChangeEvent;public class FahrenheitSlider extends EventSlider { private FahrenheitField theField; /** pre: f != null * post: theField == f * and getMinimum() == min and getMaximum() == max * and getValue() = val and orientation is HORIZONTAL * and theField == f */ public FahrenheitSlider(int min, int max, int val, FahrenheitField f) { super(HORIZONTAL, min, max, val); theField = f; } /** pre: theField != null * post: theField.intValue == intValue * and the postcondition of theField.actionPerformed(null) */ public void stateChanged(ChangeEvent e) { theField.setText("" + getValue()); theField.repaint(); theField.actionPerformed(null); //null is a dummy argument }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?