本文整理匯總了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();
}
示例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;
}
示例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();
}
});
}
});
}
示例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();
}
示例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();
}
}
示例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);
}
}
示例7: ancestorAdded
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public void ancestorAdded(AncestorEvent e) {
JComponent component = e.getComponent();
component.requestFocusInWindow();
if (removeListener)
component.removeAncestorListener(this);
}
示例8: setFordFocuseEdit
import javax.swing.JComponent; //導入方法依賴的package包/類
private void setFordFocuseEdit(final JComponent e) {
e.requestFocus();
e.requestFocusInWindow();
// фокус для приема данных со сканера штрих-кодов
java.awt.EventQueue.invokeLater(() -> {
e.requestFocus();
});
}