本文整理汇总了Java中java.awt.Window.toFront方法的典型用法代码示例。如果您正苦于以下问题:Java Window.toFront方法的具体用法?Java Window.toFront怎么用?Java Window.toFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Window
的用法示例。
在下文中一共展示了Window.toFront方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: topComponentToFront
import java.awt.Window; //导入方法依赖的package包/类
/**
* Attempts to bring the parent <code>Window</code> of the given <code>TopComponent</code>
* to front of other windows.
* @see java.awt.Window#toFront()
* @since 5.8
*/
protected void topComponentToFront(TopComponent tc) {
Window parentWindow = SwingUtilities.getWindowAncestor(tc);
// be defensive, although w probably will always be non-null here
if (null != parentWindow) {
if (parentWindow instanceof Frame) {
Frame parentFrame = (Frame) parentWindow;
int state = parentFrame.getExtendedState();
if ((state & Frame.ICONIFIED) > 0) {
parentFrame.setExtendedState(state & ~Frame.ICONIFIED);
}
}
parentWindow.toFront();
}
}
示例2: executeCommand
import java.awt.Window; //导入方法依赖的package包/类
public void executeCommand() {
PrivateChatter chat = mgr.getChatterFor(p);
if (chat == null) {
return;
}
Window f = SwingUtilities.getWindowAncestor(chat);
if (!f.isVisible()) {
f.setVisible(true);
Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager()
.getFocusOwner();
if (c == null || !SwingUtilities.isDescendingFrom(c, f)) {
java.awt.Toolkit.getDefaultToolkit().beep();
for (int i = 0,j = chat.getComponentCount(); i < j; ++i) {
if (chat.getComponent(i) instanceof JTextField) {
(chat.getComponent(i)).requestFocus();
break;
}
}
}
}
else {
f.toFront();
}
chat.show(msg);
}
示例3: updateActive
import java.awt.Window; //导入方法依赖的package包/类
@Override
protected void updateActive(boolean active) {
// #48588 - when in SDI, slidein needs to front the editor frame.
if(active) {
Window window = SwingUtilities.getWindowAncestor(panel);
if(window != null && !window.isActive() && WindowManagerImpl.getInstance().getEditorAreaState() == Constants.EDITOR_AREA_SEPARATED) {
window.toFront();
}
}
}
示例4: stopCellEditing
import java.awt.Window; //导入方法依赖的package包/类
@Override
public boolean stopCellEditing() {
String s = cell.toString();
Window ancestorWindow = (Window)SwingUtilities.getRoot(cell);
// #236458: options are now saved asynchronously. If the dialog was to
if (ancestorWindow == null) {
return true;
}
// HACK: if this Editor creates a dialog, it will lose the focus and Swing
// will remove the editor, calling JTable.cancelEditing. Any re-selections performed
// by the JTable will occur BEFORE the dialog is finished, so we need to
// reestablish the column selection later from here.
// This binds the BCEditor to the KeymapTable layout / internals.
JTable parent = (JTable)cell.getParent();
ShortcutAction sca = (ShortcutAction) action;
Set<ShortcutAction> conflictingAction = model.getMutableModel().findActionForShortcutPrefix(s);
conflictingAction.remove(sca); //remove the original action
Collection<ShortcutAction> sameScopeActions = model.getMutableModel().filterSameScope(conflictingAction, sca);
if (!conflictingAction.isEmpty()) {
if (!SwingUtilities.isEventDispatchThread()) {
// #236458: options are now saved asynchronously, off EDT. If we display dialog, the IDE will lock up.
cell.getTextField().setText(orig);
fireEditingCanceled();
return true;
}
//there is a conflicting action, show err dialog
Object overrride = overrride(conflictingAction, sameScopeActions);
// bring the focus back
ancestorWindow.toFront();
parent.requestFocus();
if (overrride.equals(DialogDescriptor.YES_OPTION)) {
for (ShortcutAction sa : conflictingAction) {
removeConflictingShortcut(sa, s); //remove all conflicting shortcuts
}
//proceed with override
} else if (overrride == DialogDescriptor.CANCEL_OPTION) {
cell.getTextField().setText(orig);
fireEditingCanceled();
setBorderEmpty();
return true;
}
// NO_OPTION fallls through and adds additional shortcut.
}
cell.getTextField().removeActionListener(delegate);
cell.getTextField().removeKeyListener(escapeAdapter);
model.getMutableModel().removeShortcut((ShortcutAction) action, orig);
if (!(s.length() == 0)) // do not add empty shortcuts
model.getMutableModel().addShortcut((ShortcutAction) action, s);
fireEditingStopped();
setBorderEmpty();
model.update();
return true;
}