Browse Source

当button点击时不转换成字母

fbp/release
renekton 3 months ago
parent
commit
435470daa2
  1. 2
      designer-base/src/main/java/com/fr/design/gui/ispinner/FineUpperCaseSpinner.java
  2. 28
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

2
designer-base/src/main/java/com/fr/design/gui/ispinner/FineUpperCaseSpinner.java

@ -111,6 +111,8 @@ public class FineUpperCaseSpinner extends UISpinner {
textField.setText(StableUtils.convertIntToABC((int)value).toUpperCase()); textField.setText(StableUtils.convertIntToABC((int)value).toUpperCase());
} }
textField.getDocument().addDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener);
preAction = false;
nextAction = false;
} }
}); });
} }

28
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -349,16 +349,17 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
} }
protected void componentInitListeners() { protected void componentInitListeners() {
initButtonFocusListeners();
preButton.addActionListener(new ActionListener() { preButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
preAction = true;
setValue(value + dierta); setValue(value + dierta);
} }
}); });
nextButton.addActionListener(new ActionListener() { nextButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
nextAction = true;
setValue(value - dierta); setValue(value - dierta);
} }
}); });
@ -374,31 +375,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
initTextFiledListeners(); initTextFiledListeners();
} }
protected void initButtonFocusListeners() {
preButton.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
preAction = true;
}
@Override
public void focusLost(FocusEvent e) {
preAction = false;
}
});
nextButton.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
nextAction = true;
}
@Override
public void focusLost(FocusEvent e) {
nextAction = false;
}
});
}
protected void initTextFiledListeners() { protected void initTextFiledListeners() {
textField.getDocument().removeDocumentListener(docListener); textField.getDocument().removeDocumentListener(docListener);
textField.getDocument().addDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener);

Loading…
Cancel
Save