當前位置: 首頁>>代碼示例>>Java>>正文


Java Frame.MAXIMIZED_BOTH屬性代碼示例

本文整理匯總了Java中java.awt.Frame.MAXIMIZED_BOTH屬性的典型用法代碼示例。如果您正苦於以下問題:Java Frame.MAXIMIZED_BOTH屬性的具體用法?Java Frame.MAXIMIZED_BOTH怎麽用?Java Frame.MAXIMIZED_BOTH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.Frame的用法示例。


在下文中一共展示了Frame.MAXIMIZED_BOTH屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: packIfNotMaximized

static void packIfNotMaximized(Window window) {
	// window peut être null lors de l'initialisation
	if (window instanceof Frame
			&& (((Frame) window).getExtendedState() & Frame.MAXIMIZED_BOTH) == 0) {
		window.pack();
	}
}
 
開發者ID:evernat,項目名稱:dead-code-detector,代碼行數:7,代碼來源:DcdUiHelper.java

示例2: supportsExtendedState

/**
 * Check if state is supported.
 * Note that a compound state is always reported as not supported.
 * Note also that MAXIMIZED_BOTH is considered not a compound state.
 * Therefore, a compound state is just ICONIFIED | anything else.
 *
 */
boolean supportsExtendedState(int state) {
    switch (state) {
      case Frame.MAXIMIZED_VERT:
      case Frame.MAXIMIZED_HORIZ:
          /*
           * WMs that talk NET/WIN protocol, but do not support
           * unidirectional maximization.
           */
          if (getWMID() == METACITY_WM) {
              /* "This is a deliberate policy decision." -hp */
              return false;
          }
          /* FALLTROUGH */
      case Frame.MAXIMIZED_BOTH:
          for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
              if (proto.supportsState(state)) {
                  return true;
              }
          }
      default:
          return false;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:30,代碼來源:XWM.java

示例3: supportsExtendedState

/**
 * Check if state is supported.
 * Note that a compound state is always reported as not supported.
 * Note also that MAXIMIZED_BOTH is considered not a compound state.
 * Therefore, a compound state is just ICONIFIED | anything else.
 *
 */
@SuppressWarnings("fallthrough")
boolean supportsExtendedState(int state) {
    switch (state) {
      case Frame.MAXIMIZED_VERT:
      case Frame.MAXIMIZED_HORIZ:
          /*
           * WMs that talk NET/WIN protocol, but do not support
           * unidirectional maximization.
           */
          if (getWMID() == METACITY_WM) {
              /* "This is a deliberate policy decision." -hp */
              return false;
          }
          /* FALLTROUGH */
      case Frame.MAXIMIZED_BOTH:
          for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
              if (proto.supportsState(state)) {
                  return true;
              }
          }
          /* FALLTROUGH */
      default:
          return false;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:XWM.java

示例4: restoreFocus

/**
 * This method sets back the focus to this JFrame.
 */
public void restoreFocus() {
	if (this.getExtendedState() == Frame.ICONIFIED || this.getExtendedState() == Frame.ICONIFIED + Frame.MAXIMIZED_BOTH) {
		this.setState(Frame.NORMAL);
	}
	this.setAlwaysOnTop(true);
	this.setAlwaysOnTop(false);
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:10,代碼來源:MainWindow.java

示例5: componentResized

public void componentResized(ComponentEvent e) {
  if (theFrame.isShowing()) {
    // A resize when the window is already maximised only happens when
    // a window is first resized. Record the pre-maximised bounds.
    if (theFrame instanceof Frame &&
        previousBounds != null &&
        ((((Frame) theFrame).getExtendedState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH)) {
      bounds.setBounds(previousBounds);
    }
    else {
      bounds.setSize(theFrame.getSize());
    }
  }
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:14,代碼來源:PositionOption.java

示例6: setVisible

public void setVisible(boolean vis) {
    if (vis) {
        setupState(false);
    } else {
        if ((state & Frame.MAXIMIZED_BOTH) != 0) {
            XWM.getWM().setExtendedState(this, state & ~Frame.MAXIMIZED_BOTH);
        }
    }
    super.setVisible(vis);
    if (vis && maxBounds != null) {
        setMaximizedBounds(maxBounds);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:XFramePeer.java

示例7: componentResized

@Override final public void componentResized(ComponentEvent objPcomponentEvent) {
	if (this.getExtendedState() == Frame.MAXIMIZED_BOTH) {
		// this.setExtendedState(Frame.NORMAL);
		this.setSize(this.getWidth(), this.intGframeHeight);
	} else {
		this.intGframeHeight = this.getHeight();
	}
	if (this.objGwindowAdjustmentJToggleButton.isSelected()) {
		// this.objGanimationJTable.setWindowAdjustedColumnsWidths(this.objGanimationJScrollPane.getViewport().getWidth());
		// this.objGhandsAndBallsJTable.setWindowAdjustedColumnsWidths(this.objGhandsAndBallsJScrollPane.getViewport().getWidth());
		new Thread(this.objGanimationJTable.objGcolumnFitAdapter).start();
		new Thread(this.objGhandsAndBallsJTable.objGcolumnFitAdapter).start();
	}
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:14,代碼來源:DataJFrame.java

示例8: testFrame

static void testFrame(boolean isUndecorated) throws Exception {
    Frame frame = new Frame();
    try {
        Robot robot = new Robot();
        robot.setAutoDelay(100);

        frame.setUndecorated(isUndecorated);
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getDefaultConfiguration();
        Rectangle bounds = gc.getBounds();
        Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
        int x = bounds.x + insets.left;
        int y = bounds.y + insets.top;
        int width = bounds.width - insets.left - insets.right;
        int height = bounds.height - insets.top - insets.bottom;
        Rectangle rect = new Rectangle(x, y, width, height);
        frame.pack();
        frame.setBounds(rect);
        frame.setVisible(true);
        robot.waitForIdle();
        robot.delay(500);

        if (frame.getWidth() <= width / 2
                || frame.getHeight() <= height / 2) {
            throw new RuntimeException("Frame size is small!");
        }

        if (!isUndecorated && frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
            throw new RuntimeException("Frame state does not equal"
                    + " MAXIMIZED_BOTH!");
        }
    } finally {
        frame.dispose();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:35,代碼來源:MaximizedToUnmaximized.java

示例9: isFrameMaximized

private static boolean isFrameMaximized(JFrame frame) {
    return frame.getExtendedState() == Frame.MAXIMIZED_BOTH;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:3,代碼來源:UserSettings.java

示例10: requestState

private void requestState(XWindowPeer window, int state) {
    /*
     * We have to use toggle for maximization because of transitions
     * from maximization in one direction only to maximization in the
     * other direction only.
     */
    int old_net_state = getState(window);
    int max_changed = (state ^ old_net_state) & (Frame.MAXIMIZED_BOTH);

    XClientMessageEvent req = new XClientMessageEvent();
    try {
        switch(max_changed) {
          case 0:
              return;
          case Frame.MAXIMIZED_HORIZ:
              req.set_data(1, XA_NET_WM_STATE_MAXIMIZED_HORZ.getAtom());
              req.set_data(2, 0);
              break;
          case Frame.MAXIMIZED_VERT:
              req.set_data(1, XA_NET_WM_STATE_MAXIMIZED_VERT.getAtom());
              req.set_data(2, 0);
              break;
          case Frame.MAXIMIZED_BOTH:
              req.set_data(1, XA_NET_WM_STATE_MAXIMIZED_HORZ.getAtom());
              req.set_data(2, XA_NET_WM_STATE_MAXIMIZED_VERT.getAtom());
              break;
          default:
              return;
        }
        if (log.isLoggable(PlatformLogger.Level.FINE)) {
            log.fine("Requesting state on " + window + " for " + state);
        }
        req.set_type((int)XConstants.ClientMessage);
        req.set_window(window.getWindow());
        req.set_message_type(XA_NET_WM_STATE.getAtom());
        req.set_format(32);
        req.set_data(0, _NET_WM_STATE_TOGGLE);
        XToolkit.awtLock();
        try {
            XlibWrapper.XSendEvent(XToolkit.getDisplay(),
                    XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()),
                    false,
                    XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
                    req.pData);
        }
        finally {
            XToolkit.awtUnlock();
        }
    } finally {
        req.dispose();
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:52,代碼來源:XNETProtocol.java

示例11: requestState

private void requestState(XWindowPeer window, int state) {
    /*
     * We have to use toggle for maximization because of transitions
     * from maximization in one direction only to maximization in the
     * other direction only.
     */
    int old_net_state = getState(window);
    int max_changed = (state ^ old_net_state) & (Frame.MAXIMIZED_BOTH);

    XClientMessageEvent req = new XClientMessageEvent();
    try {
        switch(max_changed) {
          case 0:
              return;
          case Frame.MAXIMIZED_HORIZ:
              req.set_data(1, XA_NET_WM_STATE_MAXIMIZED_HORZ.getAtom());
              req.set_data(2, 0);
              break;
          case Frame.MAXIMIZED_VERT:
              req.set_data(1, XA_NET_WM_STATE_MAXIMIZED_VERT.getAtom());
              req.set_data(2, 0);
              break;
          case Frame.MAXIMIZED_BOTH:
              req.set_data(1, XA_NET_WM_STATE_MAXIMIZED_HORZ.getAtom());
              req.set_data(2, XA_NET_WM_STATE_MAXIMIZED_VERT.getAtom());
              break;
          default:
              return;
        }
        if (log.isLoggable(PlatformLogger.Level.FINE)) {
            log.fine("Requesting state on " + window + " for " + state);
        }
        req.set_type(XConstants.ClientMessage);
        req.set_window(window.getWindow());
        req.set_message_type(XA_NET_WM_STATE.getAtom());
        req.set_format(32);
        req.set_data(0, _NET_WM_STATE_TOGGLE);
        XToolkit.awtLock();
        try {
            XlibWrapper.XSendEvent(XToolkit.getDisplay(),
                    XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()),
                    false,
                    XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
                    req.pData);
        }
        finally {
            XToolkit.awtUnlock();
        }
    } finally {
        req.dispose();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:52,代碼來源:XNETProtocol.java


注:本文中的java.awt.Frame.MAXIMIZED_BOTH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。