本文整理了Java中javax.swing.JTextField.isFocusOwner()
方法的一些代码示例,展示了JTextField.isFocusOwner()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.isFocusOwner()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:isFocusOwner
暂无
代码示例来源:origin: zzz40500/GsonFormat
public void actionPerformed(ActionEvent e) {
if (generateClassTF.isFocusOwner()) {
editTP.requestFocus(true);
} else {
onOK();
}
}
});
代码示例来源:origin: org.netbeans.api/org-openide-awt
@Override
public void mouseClicked(MouseEvent e) {
if( e.getClickCount() == 1 ) {
if( null != txtLocation.getSelectedText()
|| txtLocation.isFocusOwner() )
return;
txtLocation.selectAll();
}
}
代码示例来源:origin: winder/Universal-G-Code-Sender
if (!workPositionXValue.isFocusOwner()) {
this.setPositionValueColor(this.workPositionXValue, this.workPositionXValue.getText(), workCoord.x);
this.workPositionXValue.setText(decimalFormatter.format(workCoord.x));
if (!workPositionYValue.isFocusOwner()) {
this.setPositionValueColor(this.workPositionYValue, this.workPositionYValue.getText(), workCoord.y);
this.workPositionYValue.setText(decimalFormatter.format(workCoord.y));
if (!workPositionZValue.isFocusOwner()) {
this.setPositionValueColor(this.workPositionZValue, this.workPositionZValue.getText(), workCoord.z);
this.workPositionZValue.setText(decimalFormatter.format(workCoord.z));
代码示例来源:origin: MovingBlocks/box2d-editor
@Override
public void mousePressed(MouseEvent e) {
JTextField field = (JTextField) e.getSource();
if (!field.isFocusOwner()) field.selectAll();
}
};
代码示例来源:origin: org.codehaus.mevenide/nb-project
public void insertUpdate(DocumentEvent e) {
if (field.isFocusOwner()) {
buildAndShowPopup();
}
}
public void removeUpdate(DocumentEvent e) {
代码示例来源:origin: org.codehaus.mevenide/nb-project
public void changedUpdate(DocumentEvent e) {
if (field.isFocusOwner()) {
buildAndShowPopup();
}
}
代码示例来源:origin: stackoverflow.com
JTextField main = xa.getTextField();
main.grabFocus();
assertTrue(main.isFocusOwner());
代码示例来源:origin: zitmen/thunderstorm
private void handle() {
String fname = new File(filePathTextField.getText()).getName().trim();
if(fname.isEmpty()) {
return;
}
int dotpos = fname.lastIndexOf('.');
if(dotpos >= 0) {
String type = fname.substring(dotpos + 1).trim();
for(int i = 0; i < moduleExtensions.length; i++) {
if(type.equals(moduleExtensions[i])) {
//found correct suffix, adjust type combobox and return
fileFormatCBox.setSelectedIndex(i);
return;
}
}
} else {
//no suffix found
if(!filePathTextField.isFocusOwner()) {
//user is not writting text at the moment
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
String selectedTypeSuffix = moduleExtensions[fileFormatCBox.getSelectedIndex()];
filePathTextField.setText(filePathTextField.getText() + "." + selectedTypeSuffix);
}
});
}
}
}
};
代码示例来源:origin: org.codehaus.mevenide/nb-project
public void removeUpdate(DocumentEvent e) {
if (field.isFocusOwner() && completionList.isDisplayable() && completionList.isVisible()) {
buildAndShowPopup();
}
}
public void changedUpdate(DocumentEvent e) {
代码示例来源:origin: org.gephi/directory-chooser
@Override
public void keyPressed(KeyEvent evt) {
showPopupCompletion = true;
int keyCode = evt.getKeyCode();
// #105801: completionPopup might not be ready when updateCompletions not called (empty text field)
if (completionPopup != null && !completionPopup.isVisible()) {
if (keyCode == KeyEvent.VK_ENTER) {
File file = new File(filenameTextField.getText());
if(file.exists() && file.isDirectory()) {
setSelected(new File[] {file});
fileChooser.approveSelection();
}
}
if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_DOWN) ||
(keyCode == KeyEvent.VK_RIGHT &&
(filenameTextField.getCaretPosition() >= (filenameTextField.getDocument().getLength() - 1)))) {
updateCompletions();
}
}
if(filenameTextField.isFocusOwner() &&
(completionPopup == null || !completionPopup.isVisible()) &&
keyCode == KeyEvent.VK_ESCAPE) {
fileChooser.cancelSelection();
}
}
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
public void setValueList(Collection<String> values) {
assert SwingUtilities.isEventDispatchThread();
completionListModel.removeAllElements();
completions = values;
if (field.isFocusOwner() && completionList.isDisplayable() && completionList.isVisible()) {
buildAndShowPopup();
}
}
}
代码示例来源:origin: MovingBlocks/box2d-editor
if (b1NameField.isFocusOwner()) {
String name = b1NameField.getText().trim();
b2NameField.setText(name);
} else if (b2NameField.isFocusOwner()) {
String name = b2NameField.getText().trim();
b1NameField.setText(name);
代码示例来源:origin: leMaik/swing-material
void update() {
if (animator != null) {
animator.stop();
}
Animator.Builder builder = new Animator.Builder(timer)
.setDuration(200, TimeUnit.MILLISECONDS)
.setEndBehavior(Animator.EndBehavior.HOLD)
.setInterpolator(new SplineInterpolator(0.4, 0, 0.2, 1));
double targetFontSize = (target.isFocusOwner() || !target.getText().isEmpty()) ? 12d : 16d;
if (fontSize.getValue() != targetFontSize) {
builder.addTarget(SafePropertySetter.getTarget(fontSize, fontSize.getValue(), targetFontSize));
}
double targetY = target.isFocusOwner() || !target.getText().isEmpty() ? 16d : 36d;
if (Math.abs(targetY - y.getValue()) > 0.1) {
builder.addTarget(SafePropertySetter.getTarget(y, y.getValue(), targetY));
}
Color targetColor;
if (target.isFocusOwner()) {
targetColor = accentColor;
} else {
targetColor = Utils.applyAlphaMask(target.getForeground(), HINT_OPACITY_MASK);
}
if (!targetColor.equals(color.getValue())) {
builder.addTarget(SafePropertySetter.getTarget(color, color.getValue(), targetColor));
}
animator = builder.build();
animator.start();
}
内容来源于网络,如有侵权,请联系作者删除!