当前位置: 首页>>代码示例>>Java>>正文


Java FocusEvent.getSource方法代码示例

本文整理汇总了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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TextFieldFocusListener.java

示例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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TreeViewCellEditor.java

示例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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:ValueFormatter.java

示例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()));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:ServiceDialog.java

示例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;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:NewConnectionPanel.java

示例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();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ButtonListener.java

示例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();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:DefaultNumberAxisEditor.java

示例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());
	}
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:12,代码来源:PropertyInteractionWindow.java

示例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();
       }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:8,代码来源:CaseExtractorGUI.java

示例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()));
	}
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:10,代码来源:PrintJobAttributesSubJPanel.java

示例11: focusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
private void focusEvent (FocusEvent e) {
    if (sectionButton1 == e.getSource()) {
        setColors();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:CollapsibleSectionPanel.java

示例12: focusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusGained(FocusEvent focusEvent) {
    if(focusEvent.getSource()==repositoryPanel.userPasswordField) {
        repositoryPanel.userPasswordField.selectAll();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:Repository.java

示例13: focusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
	Component c = (Component) e.getSource();
	c.repaint();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:6,代码来源:ButtonListener.java


注:本文中的java.awt.event.FocusEvent.getSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。