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


Java Window.toFront方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:WindowManager.java

示例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);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:27,代码来源:PrivMsgCommand.java

示例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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SlideBarContainer.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:58,代码来源:ButtonCellEditor.java


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