|
|
@ -1,17 +1,5 @@ |
|
|
|
package com.fr.design.gui.ispinner; |
|
|
|
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.constants.UIConstants; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
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.UINumberField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextFieldUI; |
|
|
|
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.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
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 { |
|
|
|
public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver { |
|
|
|
|
|
|
|
|
|
|
@ -70,6 +68,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 给组件分别加上FocusListener |
|
|
|
* 给组件分别加上FocusListener |
|
|
|
|
|
|
|
* |
|
|
|
* @param focusListener 监听事件 |
|
|
|
* @param focusListener 监听事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addUISpinnerFocusListenner(FocusListener 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 监听事件 |
|
|
|
* @param l 监听事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addChangeListener(ChangeListener 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 监听事件 |
|
|
|
* @param l 监听事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removeChangeListener(ChangeListener l) { |
|
|
|
public void removeChangeListener(ChangeListener l) { |
|
|
@ -172,7 +173,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver |
|
|
|
textField.setMinValue(minValue); |
|
|
|
textField.setMinValue(minValue); |
|
|
|
setValue(value); |
|
|
|
setValue(value); |
|
|
|
textField.setUI(new SpinnerTextFieldUI(textField)); |
|
|
|
textField.setUI(new SpinnerTextFieldUI(textField)); |
|
|
|
preButton = new UIButton(UIConstants.ARROW_UP_ICON){ |
|
|
|
preButton = new UIButton(UIConstants.ARROW_UP_ICON) { |
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -197,7 +198,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver |
|
|
|
componentInitListeners(); |
|
|
|
componentInitListeners(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void componentInitListeners(){ |
|
|
|
private void componentInitListeners() { |
|
|
|
preButton.addActionListener(new ActionListener() { |
|
|
|
preButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
@ -256,6 +257,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 给组件登记一个观察者监听事件 |
|
|
|
* 给组件登记一个观察者监听事件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param listener 观察者监听事件 |
|
|
|
* @param listener 观察者监听事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
@ -331,6 +333,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 程序入口 测试 |
|
|
|
* 程序入口 测试 |
|
|
|
|
|
|
|
* |
|
|
|
* @param args 参数 |
|
|
|
* @param args 参数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void main(String... args) { |
|
|
|
public static void main(String... args) { |
|
|
|