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


Java Window类代码示例

本文整理汇总了Java中java.awt.Window的典型用法代码示例。如果您正苦于以下问题:Java Window类的具体用法?Java Window怎么用?Java Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getDialog

import java.awt.Window; //导入依赖的package包/类
/**
 * Gets the authorization dialog.
 *
 * @param presetUsername username which should be shown preset when displaying the dialog
 * @param owner the window to which the dialog should belong (to center etc.)
 * @return the dialog
 */
public JDialog getDialog(String presetUsername, Window owner) {

	authDialog = new JDialog(owner);
	OIDCPanel oidcPanel = new OIDCPanel(this);
	if (presetUsername != null) {
		oidcPanel.getJTextFieldUsername().setText(presetUsername);
	}
	authDialog.setContentPane(oidcPanel);
	authDialog.setSize(new Dimension(500, 190));
	authDialog.setLocationRelativeTo(null);
	return authDialog;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:OIDCAuthorization.java

示例2: getCurrentGraphicsConfiguration

import java.awt.Window; //导入依赖的package包/类
/**
    * Finds out the monitor where the user currently has the input focus.
    * This method is usually used to help the client code to figure out on
    * which monitor it should place newly created windows/frames/dialogs.
    *
    * @return the GraphicsConfiguration of the monitor which currently has the
    * input focus
    */
   private static GraphicsConfiguration getCurrentGraphicsConfiguration() {
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
       if (focusOwner != null) {
           Window w = SwingUtilities.getWindowAncestor(focusOwner);
           if (w != null) {
               return w.getGraphicsConfiguration();
           } else {
               //#217737 - try to find the main window which could be placed in secondary screen
               for( Frame f : Frame.getFrames() ) {
                   if( "NbMainWindow".equals(f.getName())) { //NOI18N
                       return f.getGraphicsConfiguration();
                   }
               }
           }
       }

       return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:Utilities.java

示例3: addFSWindowListener

import java.awt.Window; //导入依赖的package包/类
@Override
protected void addFSWindowListener(Window w) {
    // if the window is not a toplevel (has an owner) we have to use the
    // real toplevel to enter the full-screen mode with (4933099).
    if (!(w instanceof Frame) && !(w instanceof Dialog) &&
        (realFSWindow = getToplevelOwner(w)) != null)
    {
        ownerOrigBounds = realFSWindow.getBounds();
        WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer();

        ownerWasVisible = realFSWindow.isVisible();
        Rectangle r = w.getBounds();
        // we use operations on peer instead of component because calling
        // them on component will take the tree lock
        fp.reshape(r.x, r.y, r.width, r.height);
        fp.setVisible(true);
    } else {
        realFSWindow = w;
    }

    fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop();
    ((WWindowPeer)realFSWindow.getPeer()).setAlwaysOnTop(true);

    fsWindowListener = new D3DFSWindowAdapter();
    realFSWindow.addWindowListener(fsWindowListener);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:D3DGraphicsDevice.java

示例4: 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

示例5: WindowNode

import java.awt.Window; //导入依赖的package包/类
public WindowNode(Window win) {
    super(win);
    Window[] wns = win.getOwnedWindows();
    Vector<WindowNode> wwns = new Vector<>();
    for (Window wn : wns) {
        if (propDialog.showAll || wn.isVisible()) {
            wwns.add(new WindowNode(wn));
        }
    }
    wins = new WindowNode[wwns.size()];
    for (int i = 0; i < wwns.size(); i++) {
        wins[i] = wwns.get(i);
    }
    title = win.toString();
    clss = win.getClass().getName();
    BufferedImage image = null;
    try {
        image = new Robot().
                createScreenCapture(new Rectangle(win.getLocationOnScreen(),
                        win.getSize()));
    } catch (AWTException e) {
        e.printStackTrace();
    }
    setComponentImageProvider(new ComponentImageProvider(image, x, y));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:GUIBrowser.java

示例6: accept

import java.awt.Window; //导入依赖的package包/类
private boolean accept(Component aComponent) {
    if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
          aComponent.isFocusable() && aComponent.isEnabled())) {
        return false;
    }

    // Verify that the Component is recursively enabled. Disabling a
    // heavyweight Container disables its children, whereas disabling
    // a lightweight Container does not.
    if (!(aComponent instanceof Window)) {
        for (Container enableTest = aComponent.getParent();
             enableTest != null;
             enableTest = enableTest.getParent())
        {
            if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
                return false;
            }
            if (enableTest instanceof Window) {
                break;
            }
        }
    }

    return true;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:LegacyGlueFocusTraversalPolicy.java

示例7: mouseDragged

import java.awt.Window; //导入依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
	Point newPos = e.getPoint();
	SwingUtilities.convertPointToScreen(newPos, SizeGrip.this);
	int xDelta = newPos.x - origPos.x;
	int yDelta = newPos.y - origPos.y;
	Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this);
	if (wind!=null) { // Should always be true
		if (getComponentOrientation().isLeftToRight()) {
			int w = wind.getWidth();
			if (newPos.x>=wind.getX()) {
				w += xDelta;
			}
			int h = wind.getHeight();
			if (newPos.y>=wind.getY()) {
				h += yDelta;
			}
			wind.setSize(w,h);
		}
		else { // RTL
			int newW = Math.max(1, wind.getWidth()-xDelta);
			int newH = Math.max(1, wind.getHeight()+yDelta);
			wind.setBounds(newPos.x, wind.getY(), newW, newH);
		}
		// invalidate()/validate() needed pre-1.6.
		wind.invalidate();
		wind.validate();
	}
	origPos.setLocation(newPos);
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:31,代码来源:SizeGrip.java

示例8: addTo

import java.awt.Window; //导入依赖的package包/类
/**
 * Expects to be added to a {@link GameModule}.  When added, sets
 * the containing window to visible */
public void addTo(Buildable parent) {
  idMgr.add(this);

  if (!hidden) {
    String key = PositionOption.key + getConfigureName();
    if ("PieceWindow0".equals(id) && GlobalOptions.getInstance().isUseSingleWindow()) { //$NON-NLS-1$
      mainWindowDock = new ComponentSplitter().splitLeft(GameModule.getGameModule().getControlPanel(), root, false);
    }
    else {
      final Window w = initFrame();
      final PositionOption pos = new VisibilityOption(key, w);
      GameModule.getGameModule().getPrefs().addOption(pos);
    }
    GameModule.getGameModule().getToolBar().add(launch);
  }
  setAttributeTranslatable(NAME, false);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:21,代码来源:PieceWindow.java

示例9: initTabs

import java.awt.Window; //导入依赖的package包/类
@Messages({
    "CTL_ModulesTab=Modules",
    "CTL_SourcesTab=Sources",
    "CTL_JavadocTab=Javadoc",
    "CTL_HarnessTab=Harness"
})
private void initTabs() {
    if (platformsList.getModel().getSize() > 0) {
        platformsList.setSelectedIndex(0);
        sourcesTab = new NbPlatformCustomizerSources();
        modulesTab = new NbPlatformCustomizerModules();
        javadocTab = new NbPlatformCustomizerJavadoc();
        harnessTab = new NbPlatformCustomizerHarness();
        detailPane.addTab(CTL_ModulesTab(), modulesTab);
        detailPane.addTab(CTL_SourcesTab(), sourcesTab);
        detailPane.addTab(CTL_JavadocTab(), javadocTab);
        detailPane.addTab(CTL_HarnessTab(), harnessTab);
        Container window = this.getTopLevelAncestor();
        if (window != null && window instanceof Window) {
            ((Window) window).pack();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NbPlatformCustomizer.java

示例10: enterFullScreenExclusive

import java.awt.Window; //导入依赖的package包/类
private static void enterFullScreenExclusive(Window w) {
    X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
    if (peer != null) {
        enterFullScreenExclusive(peer.getContentWindow());
        peer.setFullScreenExclusiveModeState(true);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:X11GraphicsDevice.java

示例11: enterFullScreenExclusive

import java.awt.Window; //导入依赖的package包/类
private static void enterFullScreenExclusive(Window w) {
    X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
    if (peer != null) {
        enterFullScreenExclusive(peer.getWindow());
        peer.setFullScreenExclusiveModeState(true);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:X11GraphicsDevice.java

示例12: enableFullScreen

import java.awt.Window; //导入依赖的package包/类
private static void enableFullScreen(Window window) {
    try {
        Class<?> fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
        Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen", Window.class, boolean.class);
        setWindowCanFullScreen.invoke(fullScreenUtilities, window, true);
        Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
        Object listenerObject = Proxy.newProxyInstance(fullScreenListener.getClassLoader(), new Class[]{fullScreenListener}, (proxy, method, args) -> {
            switch (method.getName()) {
                case "windowEnteringFullScreen":
                    windowEnteringFullScreen = true;
                    break;
                case "windowEnteredFullScreen":
                    windowEnteredFullScreen = true;
                    break;
            }
            return null;
        });
        Method addFullScreenListener = fullScreenUtilities.getMethod("addFullScreenListenerTo", Window.class, fullScreenListener);
        addFullScreenListener.invoke(fullScreenUtilities, window, listenerObject);
    } catch (Exception e) {
        throw new RuntimeException("FullScreen utilities not available", e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:FullScreenAfterSplash.java

示例13: displayStatusDialog

import java.awt.Window; //导入依赖的package包/类
/**
 * displays a dialog box describing the status of an event
 */
void displayStatusDialog(Window w, String status) {
    ToolDialog sd = new ToolDialog
            (PolicyTool.getMessage("Status"), tool, this, true);

    // find the location of the PolicyTool gui
    Point location = ((w == null) ?
            getLocationOnScreen() : w.getLocationOnScreen());
    //sd.setBounds(location.x + 50, location.y + 50, 500, 100);
    sd.setLayout(new GridBagLayout());

    JLabel label = new JLabel(status);
    addNewComponent(sd, label, 0,
                    0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);

    JButton okButton = new JButton(PolicyTool.getMessage("OK"));
    ActionListener okListener = new StatusOKButtonListener(sd);
    okButton.addActionListener(okListener);
    addNewComponent(sd, okButton, 1,
                    0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);

    sd.getRootPane().setDefaultButton(okButton);
    sd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);

    sd.pack();
    sd.setLocationRelativeTo(w);
    sd.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:PolicyTool.java

示例14: addNotify

import java.awt.Window; //导入依赖的package包/类
@Override
public void addNotify() {
    super.addNotify();
    //#205194 - cannot minimize floating tab
    Window w = SwingUtilities.getWindowAncestor( displayer );
    boolean isFloating = w != WindowManager.getDefault().getMainWindow();
    if( isFloating )
        setVisible( false );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TabControlButtonFactory.java

示例15: addListeners

import java.awt.Window; //导入依赖的package包/类
void addListeners(Component ancestor, boolean addToFirst) {
    Component a;

    firstInvisibleAncestor = null;
    for (a = ancestor;
         firstInvisibleAncestor == null;
         a = a.getParent()) {
        if (addToFirst || a != ancestor) {
            a.addComponentListener(this);

            if (a instanceof JComponent) {
                JComponent jAncestor = (JComponent)a;

                jAncestor.addPropertyChangeListener(this);
            }
        }
        if (!a.isVisible() || a.getParent() == null || a instanceof Window) {
            firstInvisibleAncestor = a;
        }
    }
    if (firstInvisibleAncestor instanceof Window &&
        firstInvisibleAncestor.isVisible()) {
        firstInvisibleAncestor = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:AncestorNotifier.java


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