本文整理了Java中javax.swing.JInternalFrame.requestFocusInWindow()
方法的一些代码示例,展示了JInternalFrame.requestFocusInWindow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JInternalFrame.requestFocusInWindow()
方法的具体详情如下:
包路径:javax.swing.JInternalFrame
类名称:JInternalFrame
方法名:requestFocusInWindow
暂无
代码示例来源:origin: stackoverflow.com
public static void addOnScreen(JInternalFrame inFrame, String title) {
//border for the internal frame
javax.swing.plaf.InternalFrameUI ifu = inFrame.getUI();
((javax.swing.plaf.basic.BasicInternalFrameUI) ifu).setNorthPane(null);
Border b1 = new LineBorder(new Color(114, 139, 173), 3, true) {
};
tabbedPane.setBounds(0, 0, jDesktopPane1.getWidth(), jDesktopPane1.getHeight());
inFrame.setLocation(0, 0);
inFrame.setSize(jDesktopPane1.getWidth(), jDesktopPane1.getHeight());
inFrame.setBorder(b1);
JPanel jp = new JPanel();
jp.setLayout(new GridLayout());
jp.setOpaque(true);
jp.add(inFrame);
tabbedPane.addTab(title, jp);
tabbedPane.setSelectedComponent(jp);
inFrame.requestFocusInWindow();
inFrame.setVisible(true);
tabbedPane.setVisible(true);
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public SubComponent[] getSubComponents() {
Map<Object, JInternalFrame> internalFrameMap = new HashMap<>();
SubComponent[] subComponents = new SubComponent[tabbedContainer.getTabCount()];
ActionListener activator = actionEvent -> {
JInternalFrame internalFrame = internalFrameMap.get(actionEvent.getSource());
try {
internalFrame.setSelected(true);
} catch (PropertyVetoException e1) {
// ok
}
internalFrame.requestFocusInWindow();
};
for (int i = 0; i < subComponents.length; i++) {
TabData tab = tabbedContainer.getModel().getTab(i);
JInternalFrame internalFrame = tabToFrameMap.get(tab);
SubComponent subComponent = new SubComponent(internalFrame.getTitle(),
internalFrame.getToolTipText(),
activator,
internalFrame.isSelected(),
getTopComponent(internalFrame).getLookup(),
internalFrame.isShowing());
internalFrameMap.put(subComponent, internalFrame);
subComponents[i] = subComponent;
}
return subComponents;
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
protected void componentActivated() {
JInternalFrame selectedFrame = desktopPane.getSelectedFrame();
if (selectedFrame != null) {
TabData tab = frameToTabMap.get(selectedFrame);
int tabIndex = tabbedContainer.getModel().indexOf(tab);
if (tabIndex >= 0) {
tabbedContainer.getSelectionModel().setSelectedIndex(tabIndex);
}
selectedFrame.requestFocusInWindow();
notifyActivated(getTopComponent(selectedFrame));
} else {
int tabIndex = tabbedContainer.getSelectionModel().getSelectedIndex();
if (tabIndex >= 0) {
TabData tab = tabbedContainer.getModel().getTab(tabIndex);
selectedFrame = tabToFrameMap.get(tab);
if (!selectedFrame.isSelected()) {
try {
selectedFrame.setSelected(true);
} catch (PropertyVetoException e) {
// ok
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!