當前位置: 首頁>>代碼示例>>Java>>正文


Java JComponent.requestFocusInWindow方法代碼示例

本文整理匯總了Java中javax.swing.JComponent.requestFocusInWindow方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.requestFocusInWindow方法的具體用法?Java JComponent.requestFocusInWindow怎麽用?Java JComponent.requestFocusInWindow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JComponent的用法示例。


在下文中一共展示了JComponent.requestFocusInWindow方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: switchTab

import javax.swing.JComponent; //導入方法依賴的package包/類
private void switchTab( int tabIndex ) {
    if( !tabAdded[tabIndex] ) {
        tabContent.add( tabs[tabIndex], new GridBagConstraints(tabIndex, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0, 0) ); //NOI18N
        tabAdded[tabIndex] = true;
    }
    if( selTabIndex >= 0 ) {
        buttons[selTabIndex].setSelected(false);
    }
    JComponent compToShow = tabs[tabIndex];
    JComponent compToHide = selTabIndex >= 0 ? tabs[selTabIndex] : null;
    selTabIndex = tabIndex;
    buttons[selTabIndex].setSelected(true);

    if( null != compToHide )
        compToHide.setVisible( false );
    
    compToShow.setVisible( true );
    compToShow.requestFocusInWindow();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:TabbedPane.java

示例2: startCellEditingAndRequestFocus

import javax.swing.JComponent; //導入方法依賴的package包/類
private boolean startCellEditingAndRequestFocus(int row, int column) {
	if (isCellEditable(row, column)) {
		editCellAt(row, column);
		Component editorComponent = getEditorComponent();
		if (editorComponent != null) {
			if (editorComponent instanceof JComponent) {
				JComponent jComponent = (JComponent) editorComponent;
				if (!jComponent.hasFocus()) {
					jComponent.requestFocusInWindow();
				}
				return true;
			}
		}
	}
	return false;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:17,代碼來源:ListPropertyTable2.java

示例3: ancestorAdded

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public void ancestorAdded(AncestorEvent evt) {
    final JComponent component = evt.getComponent();
    component.requestFocusInWindow();
    // for macOS:
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            component.requestFocusInWindow();
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    component.requestFocusInWindow();
                }
            });
        }
    });
}
 
開發者ID:pascalgn,項目名稱:jiracli,代碼行數:19,代碼來源:CredentialsPanel.java

示例4: requestFocusInWindow

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public boolean requestFocusInWindow() {
    if (resultsPanel != null && resultsPanel.getComponentCount() > 0) {
        JComponent comp = (JComponent) resultsPanel.getComponent(0);
        if (comp != null) {
            return comp.requestFocusInWindow();
        }
    }
    return super.requestFocusInWindow();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:ResultViewPanel.java

示例5: requestFocusInWindow

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
   public boolean requestFocusInWindow() {
// redirect focus into terminal
JComponent selected = getSelected();
if (selected != null) {
    return selected.requestFocusInWindow();
} else {
    return super.requestFocusInWindow();
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:TerminalContainerCommon.java

示例6: requestFocus

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
protected void requestFocus() {
    Term term = term();

    if (term != null) {
        JComponent screen = term.getScreen();
        if (screen != null) {
            screen.requestFocusInWindow();
        }
    } else { // avoid random NPE in tests
        setFocusTaken(true);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:TerminalInputOutput.java

示例7: ancestorAdded

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public void ancestorAdded(AncestorEvent e) {
	JComponent component = e.getComponent();
	component.requestFocusInWindow();

	if (removeListener)
		component.removeAncestorListener(this);
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:9,代碼來源:HttpsConfigWindow.java

示例8: setFordFocuseEdit

import javax.swing.JComponent; //導入方法依賴的package包/類
private void setFordFocuseEdit(final JComponent e) {
    e.requestFocus();
    e.requestFocusInWindow();
    // фокус для приема данных со сканера штрих-кодов
    java.awt.EventQueue.invokeLater(() -> {
        e.requestFocus();
    });
}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:9,代碼來源:FMedCheckIn.java


注:本文中的javax.swing.JComponent.requestFocusInWindow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。