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


Java JComponent.requestFocus方法代码示例

本文整理汇总了Java中javax.swing.JComponent.requestFocus方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.requestFocus方法的具体用法?Java JComponent.requestFocus怎么用?Java JComponent.requestFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JComponent的用法示例。


在下文中一共展示了JComponent.requestFocus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestFocus

import javax.swing.JComponent; //导入方法依赖的package包/类
private void requestFocus(JComponent comp) {
    Container container = SwingUtilities.getAncestorOfClass(TopComponent.class, comp);
    if (container != null) {
        ((TopComponent)container).requestActive();
    }
    else {
        Component f = comp;
        do {
            f = f.getParent();
            if (f instanceof Frame) {
                break;
            }
        } while (f != null);
        if (f != null) {
            f.requestFocus();
        }
        comp.requestFocus();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:QuietEditorPane.java

示例2: handleSummary

import javax.swing.JComponent; //导入方法依赖的package包/类
void handleSummary(Summary summary)
{
    inSummary = true;
    JComponent summaryComp = (JComponent) summary.getSummaryComponent(); // XXX
    if (summaryComp.getBorder() != null)
    {
        CompoundBorder b = new CompoundBorder(new EmptyBorder(5, 5, 5, 5), summaryComp
            .getBorder());
        summaryComp.setBorder(b);
    }
    setCurrentWizardPanel(summaryComp); // XXX
    instructions.setInSummaryPage(true);
    ttlLabel.setText(NbBridge.getString("org/netbeans/api/wizard/Bundle", // NOI18N
                                        WizardDisplayerImpl.class, "Summary")); // NOI18N
    getButtonManager().setSummaryShowingMode();
    summaryComp.requestFocus();
    
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:19,代码来源:WizardDisplayerImpl.java

示例3: requestFocus

import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
   public void requestFocus() {
// redirect focus into terminal
JComponent selected = getSelected();
if (selected != null) {
    selected.requestFocus();
} else {
    super.requestFocus();
}
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TerminalContainerCommon.java

示例4: requestActive

import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public void requestActive() {
    super.requestActive();
    JComponent tab = getSelectedTab();
    if (tab != null) {
        tab.requestFocus();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:IOWindow.java

示例5: getTableCellEditorComponent

import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, final int column) {
    final JComponent c = (JComponent) super.getTableCellEditorComponent(table, value, isSelected, row, column);      
    
    this.tableModel = table.getModel();
    this.columnName = table.getColumnName(column);
    this.modelRow = table.convertRowIndexToModel(row);
    this.modelColumn = table.convertColumnIndexToModel(column);  
    this.tc = c instanceof JTextComponent ? (JTextComponent) c : null;

    JPanel panel = new JPanel(new BorderLayout()) {
        @Override
        public void addNotify() {
            super.addNotify();
            c.requestFocus();
        }
    };
    panel.add(c);
    if (suppressEditorBorder) {
        c.setBorder(BorderFactory.createEmptyBorder());
    }
    panel.add(customEditorButton, BorderLayout.EAST);
    panel.revalidate();
    panel.repaint();

    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:StringTableCellEditor.java

示例6: setCurrentWizardPanel

import javax.swing.JComponent; //导入方法依赖的package包/类
/** 
 * Set the currently displayed panel.
 * @parm comp is can be anything - it is not required to be a WizardPage or WizardPanel 
 * */
public void setCurrentWizardPanel(JComponent comp)
{
    inner.add(comp, BorderLayout.CENTER);
    inner.remove(wizardPanel);
    wizardPanel = comp;
    inner.invalidate();
    inner.revalidate();
    inner.repaint();
    comp.requestFocus();
    if (!inSummary)
    {
        buttonManager.updateButtons();
    }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:19,代码来源:WizardDisplayerImpl.java

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