本文整理汇总了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();
}
}
示例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();
}
示例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();
}
}
示例4: requestActive
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public void requestActive() {
super.requestActive();
JComponent tab = getSelectedTab();
if (tab != null) {
tab.requestFocus();
}
}
示例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;
}
示例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();
}
}
示例7: setFordFocuseEdit
import javax.swing.JComponent; //导入方法依赖的package包/类
private void setFordFocuseEdit(final JComponent e) {
e.requestFocus();
e.requestFocusInWindow();
// фокус для приема данных со сканера штрих-кодов
java.awt.EventQueue.invokeLater(() -> {
e.requestFocus();
});
}