本文整理汇总了Java中java.awt.event.FocusEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java FocusEvent.getSource方法的具体用法?Java FocusEvent.getSource怎么用?Java FocusEvent.getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.FocusEvent
的用法示例。
在下文中一共展示了FocusEvent.getSource方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
if (!e.isTemporary()) {
JTextComponent textComp = (JTextComponent) e.getSource();
if (textComp.getText().length() != 0) {
textComp.selectAll();
}
}
}
示例2: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Implements <code>FocusListener</code> interface method. */
public void focusLost(FocusEvent evt) {
if (evt.getSource() == tree) {
// stop timer if tree lost focus (#153009)
abortTimer();
return;
}
if (stopped || cancelled) {
return;
}
if (!stopCellEditing()) {
cancelCellEditing();
}
}
示例3: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusGained(FocusEvent event) {
Object source = event.getSource();
if (source instanceof JFormattedTextField) {
this.text = (JFormattedTextField) source;
SwingUtilities.invokeLater(this);
}
}
示例4: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusLost(FocusEvent e) {
Object source = e.getSource();
if (source == tfJobName) {
asCurrent.add(new JobName(tfJobName.getText(),
Locale.getDefault()));
} else if (source == tfUserName) {
asCurrent.add(new RequestingUserName(tfUserName.getText(),
Locale.getDefault()));
}
}
示例5: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
Object source = e.getSource();
if (source instanceof JTextField) {
JTextField textField = (JTextField) source;
String inputText = textField.getText();
switch(targetToken) {
case JdbcUrl.TOKEN_HOST:
case JdbcUrl.TOKEN_DB:
case JdbcUrl.TOKEN_SID:
case JdbcUrl.TOKEN_SERVICENAME:
case JdbcUrl.TOKEN_TNSNAME:
case JdbcUrl.TOKEN_DSN:
case JdbcUrl.TOKEN_SERVERNAME:
case JdbcUrl.TOKEN_INSTANCE:
case USERINPUT_FIELD:
textField.setText(inputText.trim());
break;
case JdbcUrl.TOKEN_PORT:
Integer port = null;
try {
port = Integer.valueOf(inputText.trim());
} catch (NumberFormatException ex) {}
if(port != null) {
textField.setText(Integer.toString(port));
} else {
Matcher numberMatcher = numbers.matcher(inputText);
if(numberMatcher.find()) {
textField.setText(numberMatcher.group(1));
} else {
textField.setText("");
}
}
break;
default:
// Unhandled fields are left untouched
break;
}
}
}
示例6: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
super.focusLost(e);
AbstractButton b = (AbstractButton) e.getSource();
b.getModel().setArmed(false);
b.repaint();
}
示例7: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
* Revalidates minimum/maximum range.
*
* @param event the event.
*/
public void focusLost(FocusEvent event) {
if (event.getSource() == this.minimumRangeValue) {
validateMinimum();
}
else if (event.getSource() == this.maximumRangeValue) {
validateMaximum();
}
}
示例8: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
*/
public void focusGained(FocusEvent e) {
if (e.getSource() == editableField) {
String text = editableField.getText();
editableField.setSelectionStart(0);
editableField.setSelectionEnd(text.length());
}
}
示例9: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusLost(FocusEvent e) {
Object source = e.getSource();
if (source == windowsSwanExeTextField) {
//if windowsSwanExeTextField lost focus.
updateSwanExecutableFromTextField();
}
}
示例10: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
final public void focusLost(FocusEvent objPfocusEvent) {
final Object objLsourceObject = objPfocusEvent.getSource();
if (objLsourceObject == this.objGjobNameJTextField) {
this.objGprintJDialog.getAttributes().add(new JobName(this.objGjobNameJTextField.getText(), Locale.getDefault()));
} else if (objLsourceObject == this.objGuserNameJTextField) {
this.objGprintJDialog.getAttributes().add(new RequestingUserName(this.objGuserNameJTextField.getText(), Locale.getDefault()));
}
}
示例11: focusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
private void focusEvent (FocusEvent e) {
if (sectionButton1 == e.getSource()) {
setColors();
}
}
示例12: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusGained(FocusEvent focusEvent) {
if(focusEvent.getSource()==repositoryPanel.userPasswordField) {
repositoryPanel.userPasswordField.selectAll();
}
}
示例13: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
Component c = (Component) e.getSource();
c.repaint();
}