javax.swing.JFrame.getExtendedState()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中javax.swing.JFrame.getExtendedState()方法的一些代码示例,展示了JFrame.getExtendedState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getExtendedState()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getExtendedState

JFrame.getExtendedState介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

public void readPositionFromWindow(JFrame window) {
  isFullScreen = (window.getExtendedState() == JFrame.MAXIMIZED_BOTH);
  if (!isFullScreen) {
    this.readPositionFromComponent(window);
  }
}

代码示例来源:origin: RipMeApp/ripme

@Override
  public void mouseClicked(MouseEvent e) {
    toggleTrayClick();
    if (mainFrame.getExtendedState() != JFrame.NORMAL) {
      mainFrame.setExtendedState(JFrame.NORMAL);
    }
    mainFrame.setAlwaysOnTop(true);
    mainFrame.setAlwaysOnTop(false);
  }
});

代码示例来源:origin: RipMeApp/ripme

private void toggleTrayClick() {
  if (mainFrame.getExtendedState() == JFrame.ICONIFIED
      || !mainFrame.isActive()
      || !mainFrame.isVisible()) {
    mainFrame.setVisible(true);
    mainFrame.setAlwaysOnTop(true);
    mainFrame.setAlwaysOnTop(false);
    trayMenuMain.setLabel("Hide");
  } else {
    mainFrame.setVisible(false);
    trayMenuMain.setLabel("Show");
  }
}

代码示例来源:origin: Nilhcem/FakeSMTP

@Override
  public void actionPerformed(ActionEvent ae) {
    int state = frame.getExtendedState();
    state &= ~Frame.ICONIFIED;
    frame.setExtendedState(state);
    frame.setVisible(true);
    tray.remove(trayIcon);
    trayIcon.removeActionListener(this);
  }
});

代码示例来源:origin: stackoverflow.com

public static boolean isFrameMaximized (JFrame frame) {
  if ((frame.getExtendedState() & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH)
    return true;
  return false;
}

代码示例来源:origin: khuxtable/seaglass

/**
 * Is the parent window maximized?
 *
 * @return {@code true} if the parent window is maximized, {@code false}
 *         otherwise.
 */
private boolean isParentMaximum() {
  if (rootParent instanceof JFrame) {
    return (((JFrame) rootParent).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0;
  } else {
    return false;
  }
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public boolean janelaMinimizada()
{
  return (frame.getExtendedState() & JFrame.ICONIFIED) == JFrame.ICONIFIED;
}

代码示例来源:origin: blurpy/kouchat

/**
 * Checks if a window is minimized to the taskbar.
 *
 * @param frame The window to check.
 * @return If the window is minimized.
 */
public boolean isMinimized(final JFrame frame) {
  return (frame.getExtendedState() & JFrame.ICONIFIED) != 0;
}

代码示例来源:origin: Audiveris/audiveris

/**
 * Minimize the provided frame.
 *
 * @param frame the frame to minimize to icon
 * @see #unMinimize(JFrame)
 */
public static void minimize (JFrame frame)
{
  int state = frame.getExtendedState();
  state &= ICONIFIED;
  frame.setExtendedState(state);
}

代码示例来源:origin: cpesch/RouteConverter

private void putPreferencesState() {
  int state = frame.getExtendedState();
  if(getPreferencesState() == state)
    return;
  preferences.putInt(STATE_PREFERENCE, state);
  log.info("Storing frame state as " + state);
}

代码示例来源:origin: stackoverflow.com

public void setupJFrame (JFrame frame, boolean maximize) {
  if (maximize) {
    frame.setExtendedState( frame.getExtendedState()|JFrame.MAXIMIZED_BOTH);
  } else {
    frame.setLocationRelativeTo(null);
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
  public void actionPerformed(ActionEvent evt) {
    JFrame frame = getFrame();
    if (frame != null) {
      frame.setExtendedState(frame.getExtendedState() ^ Frame.MAXIMIZED_BOTH);
    } else {
      Toolkit.getDefaultToolkit().beep();
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
  public void actionPerformed(ActionEvent evt) {
    JFrame frame = getFrame();
    if (frame != null) {
      frame.setExtendedState(frame.getExtendedState() ^ Frame.ICONIFIED);
    } else {
      Toolkit.getDefaultToolkit().beep();
    }
  }
}

代码示例来源:origin: girtel/Net2Plan

@Override
public void run()
{
  if (consoleDialog.getExtendedState() == Frame.ICONIFIED)
  {
    consoleDialog.addWindowListener(l);
    consoleDialog.setExtendedState(Frame.NORMAL);
  }
  else
  {
    bringToFront();
  }
}

代码示例来源:origin: blurpy/kouchat

/**
 * Minimizes a window to the taskbar.
 *
 * @param frame The window to minimize.
 */
public void minimize(final JFrame frame) {
  if (!isMinimized(frame)) {
    frame.setExtendedState(frame.getExtendedState() | JFrame.ICONIFIED);
  }
}

代码示例来源:origin: blurpy/kouchat

/**
 * Restores a minimized window so it's visible again.
 *
 * @param frame The window to restore.
 */
public void restore(final JFrame frame) {
  if (isMinimized(frame)) {
    frame.setExtendedState(frame.getExtendedState() & ~JFrame.ICONIFIED);
  }
}

代码示例来源:origin: gurkenlabs/litiengine

@Override
 public boolean terminating() {
  boolean terminate = notifyPendingChanges();
  if (terminate) {
   getUserPreferences().setFrameState(window.getExtendedState());
  }
  return terminate;
 }
});

代码示例来源:origin: org.jdesktop.bsaf/bsaf

private void maybeSaveFrameSize(ComponentEvent e) {
  if (e.getComponent() instanceof JFrame) {
    JFrame f = (JFrame) e.getComponent();
    if ((f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0) {
      SwingHelper.putWindowNormalBounds(f, f.getBounds());
    }
  }
}

代码示例来源:origin: otros-systems/otroslogviewer

public static void frameToFront(JFrame frame) {
 int state = frame.getExtendedState();
 state &= ~JFrame.ICONIFIED;
 frame.setExtendedState(state);
 frame.setAlwaysOnTop(true);
 frame.toFront();
 frame.requestFocus();
 frame.setAlwaysOnTop(false);
}

代码示例来源:origin: net.java.dev.appframework/appframework

private void maybeSaveFrameSize(ComponentEvent e) { 
  if (e.getComponent() instanceof JFrame) {
    JFrame f = (JFrame)e.getComponent();
    if ((f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0) {
      String clientPropertyKey = "WindowState.normalBounds";
      f.getRootPane().putClientProperty(clientPropertyKey, f.getBounds());
    }
  }
}
public void componentResized(ComponentEvent e) { maybeSaveFrameSize(e); }

相关文章

JFrame类方法