|
|
|
@ -1,17 +1,5 @@
|
|
|
|
|
package com.fr.design.gui.ispinner; |
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.event.*; |
|
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
|
|
|
|
|
|
import javax.swing.JFrame; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
import javax.swing.text.JTextComponent; |
|
|
|
|
|
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
@ -21,9 +9,19 @@ import com.fr.design.gui.ibutton.UIButton;
|
|
|
|
|
import com.fr.design.gui.itextfield.UINumberField; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextFieldUI; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
import javax.swing.text.JTextComponent; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.event.*; |
|
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
|
|
|
|
|
|
public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver { |
|
|
|
|
|
|
|
|
@ -70,6 +68,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 给组件分别加上FocusListener |
|
|
|
|
* |
|
|
|
|
* @param focusListener 监听事件 |
|
|
|
|
*/ |
|
|
|
|
public void addUISpinnerFocusListenner(FocusListener focusListener) { |
|
|
|
@ -139,7 +138,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
*增加 a <code>ChangeListener</code> to the listener list. |
|
|
|
|
* 增加 a <code>ChangeListener</code> to the listener list. |
|
|
|
|
* |
|
|
|
|
* @param l 监听事件 |
|
|
|
|
*/ |
|
|
|
|
public void addChangeListener(ChangeListener l) { |
|
|
|
@ -147,7 +147,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
*移除 a <code>ChangeListener</code> from the listener list. |
|
|
|
|
* 移除 a <code>ChangeListener</code> from the listener list. |
|
|
|
|
* |
|
|
|
|
* @param l 监听事件 |
|
|
|
|
*/ |
|
|
|
|
public void removeChangeListener(ChangeListener l) { |
|
|
|
@ -172,7 +173,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
textField.setMinValue(minValue); |
|
|
|
|
setValue(value); |
|
|
|
|
textField.setUI(new SpinnerTextFieldUI(textField)); |
|
|
|
|
preButton = new UIButton(UIConstants.ARROW_UP_ICON){ |
|
|
|
|
preButton = new UIButton(UIConstants.ARROW_UP_ICON) { |
|
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -197,7 +198,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
componentInitListeners(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void componentInitListeners(){ |
|
|
|
|
private void componentInitListeners() { |
|
|
|
|
preButton.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -256,6 +257,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 给组件登记一个观察者监听事件 |
|
|
|
|
* |
|
|
|
|
* @param listener 观察者监听事件 |
|
|
|
|
*/ |
|
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
|
@ -331,6 +333,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 程序入口 测试 |
|
|
|
|
* |
|
|
|
|
* @param args 参数 |
|
|
|
|
*/ |
|
|
|
|
public static void main(String... args) { |
|
|
|
|