Browse Source
* commit '8a2389228c79a3b683e5f5703725b80891bea724': REPORT-5484 表单控件位置组件改成焦点失去触发保存master
superman
7 years ago
5 changed files with 76 additions and 12 deletions
@ -0,0 +1,48 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
|
||||
import java.awt.event.FocusAdapter; |
||||
import java.awt.event.FocusEvent; |
||||
import java.awt.event.KeyAdapter; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
/** |
||||
* Created by kerry on 2017/11/7. |
||||
*/ |
||||
public class UIBoundSpinner extends UISpinner{ |
||||
|
||||
public UIBoundSpinner(double minValue, double maxValue, double dierta) { |
||||
super(minValue, maxValue, dierta); |
||||
} |
||||
|
||||
public UIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) { |
||||
super(minValue, maxValue, dierta, defaultValue); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTextFiledListeners(){ |
||||
this.getTextField().addFocusListener(new FocusAdapter() { |
||||
@Override |
||||
public void focusLost(FocusEvent e) { |
||||
setTextFieldValue(getTextField().getValue()); |
||||
setTextField(value); |
||||
} |
||||
}); |
||||
|
||||
this.getTextField().addKeyListener(new KeyAdapter() { |
||||
@Override |
||||
public void keyPressed(KeyEvent e) { |
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
||||
setTextFieldValue(getTextField().getValue()); |
||||
setTextField(value); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected void setTextField(double value){ |
||||
this.getTextField().setValue(value); |
||||
} |
||||
} |
Loading…
Reference in new issue