當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。