📄 fahrenheitslider.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -