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

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

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

JFrame.setState介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

private void toggleVisibility(MenuItem showMenuItem) {
  // Hide/Unhide the window if the user clicked in the system tray icon or
  // selected the menu option
  if (frame.isVisible()) {
    frame.setVisible(false);
    showMenuItem.setLabel("Show");
  } else {
    frame.setVisible(true);
    frame.setState(Frame.NORMAL);
    showMenuItem.setLabel("Hide");
  }
}

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

JFrame frame = new JFrame(...);
// Show the frame
frame.setVisible(true);

// Sleep for 5 seconds, then minimize
Thread.sleep(5000);
frame.setState(java.awt.Frame.ICONIFIED);

// Sleep for 5 seconds, then restore
Thread.sleep(5000);
frame.setState(java.awt.Frame.NORMAL);

代码示例来源:origin: MegaMek/megamek

public void windowActivated(WindowEvent windowEvent) {
  // TODO: this is a kludge to fix a window iconify issue
  // For some reason when I click on the window button, the main UI 
  // window doesn't deiconify.  This fix doesn't allow me to iconify the
  // window by clicking the window button, but it's better than the
  // alternative
  frame.setState(Frame.NORMAL);
}

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

public class Myclass{
  JFrame frame;
  public MyClass(JFrame aFrame){
     this.frame = aFrame;
  }
  public void Frame_normal{
     frame.setState(Frame.NORMAL);
  }
}
MyClass class = new Myclass(theJFrame);
class.Frame_normal();

代码示例来源:origin: MegaMek/megamek

public void windowDeiconified(WindowEvent windowEvent) {
  // TODO: this is a kludge to fix a window iconify issue
  // For some reason when I click on the window button, the main UI 
  // window doesn't deiconify.  This fix doesn't allow me to iconify the
  // window by clicking the window button, but it's better than the
  // alternative
  frame.setState(Frame.NORMAL);
}

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

JButton button = (JButton)e.getSource();
Window window = SwingUtilities.windowForComponent( button );
JFrame frame = (JFrame)window;
frame.setState(JFrame.ICONIFIED);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Sets the Icon attribute of the SkinWindowWindow object
 * 
 * @param b The new Icon value
 */
public void setIcon(boolean b) {
 if (frame != null) {
  frame.setState(Frame.ICONIFIED);
  //frame.show();
 } else if (dialog != null) {
  // not support by dialog
 }
}

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

JFrame f = new JFrame("Test");
f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
while (true) {
  f.setVisible(true);
  f.setState(JFrame.NORMAL);
  try {
    Thread.sleep(100);
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

public void minimiseAllWindows() {
  for (SwingController controller : controllers) {
    JFrame frame = controller.getViewerFrame();
    if (frame != null)
      frame.setState(Frame.ICONIFIED);
  }
}

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

JFrame frame = new JFrame();
 frame.setSize( 800, 600 );
 frame.setUndecorated( false );  // will enable animations
 frame.setVisible( true );
 try { Thread.sleep( 3000 ); } catch ( Throwable t ) {}
 frame.setState( Frame.ICONIFIED );

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

JFrame frame = new JFrame("test");
frame.setExtendedState(JFrame.ICONIFIED);  // one way
 frame.setState(JFrame.ICONIFIED); // another way

代码示例来源:origin: org.icepdf.os/icepdf-viewer

public void bringWindowToFront(int index) {
  if (index >= 0 && index < controllers.size()) {
    SwingController controller = controllers.get(index);
    JFrame frame = controller.getViewerFrame();
    if (frame != null) {
      frame.setState(Frame.NORMAL);
      frame.toFront();
    }
  }
}

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

@Override 
public void windowClosing(WindowEvent e) {
   JFrame f = (JFrame) e.getWindow();
   if (f.getState() != JFrame.ICONIFIED)
     f.setState(JFrame.ICONIFIED);
   else 
     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }

代码示例来源:origin: org.icepdf.os/icepdf-viewer

public void bringAllWindowsToFront(SwingController frontMost) {
  JFrame frontMostFrame = null;
  for (SwingController controller : controllers) {
    JFrame frame = controller.getViewerFrame();
    if (frame != null) {
      if (frontMost == controller) {
        frontMostFrame = frame;
        continue;
      }
      frame.setState(Frame.NORMAL);
      frame.toFront();
    }
  }
  if (frontMostFrame != null) {
    frontMostFrame.setState(Frame.NORMAL);
    frontMostFrame.toFront();
  }
}

代码示例来源:origin: omegat-org/omegat

@Override
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
      if (!autoSyncWithEditor && !entryList.isEmpty()) {
        getActiveDisplayedEntry().gotoEntryInEditor();
        JFrame frame = Core.getMainWindow().getApplicationFrame();
        frame.setState(JFrame.NORMAL);
        frame.toFront();
      }
    }
  }
});

代码示例来源:origin: igniterealtime/Spark

public void blinkFrameIfNecessary(final JFrame frame) {
  final MainWindow mainWindow = SparkManager.getMainWindow();
  if (mainWindow.isFocusOwner()) {
    frame.setVisible(true);
  }
  else {
    // Set to new tab.
    if (Spark.isWindows()) {
      frame.setState(Frame.ICONIFIED);
      SparkManager.getNativeManager().flashWindow(frame);
      frame.setVisible(true);
      frame.addWindowListener(new WindowAdapter() {
        public void windowActivated(WindowEvent e) {
          SparkManager.getNativeManager().stopFlashing(frame);
        }
      });
    }
  }
}

代码示例来源:origin: omegat-org/omegat

void jumpToSelectedIssue() {
  getSelectedIssue().map(IIssue::getSegmentNumber).ifPresent(i -> {
    Core.getEditor().gotoEntry(i);
    JFrame mwf = Core.getMainWindow().getApplicationFrame();
    mwf.setState(JFrame.NORMAL);
    mwf.toFront();
  });
}

代码示例来源:origin: omegat-org/omegat

synchronized void refreshData(int jumpToEntry, List<String> jumpToTypes) {
  reset();
  if (!frame.isVisible()) {
    // Don't call setVisible if already visible, because the window will
    // steal focus
    frame.setVisible(true);
  }
  frame.setState(JFrame.NORMAL);
  panel.progressBar.setValue(0);
  panel.progressBar.setMaximum(Core.getProject().getAllEntries().size());
  panel.progressBar.setVisible(true);
  panel.progressBar.setEnabled(true);
  loader = new IssueLoader(jumpToEntry, jumpToTypes);
  loader.execute();
}

代码示例来源:origin: uk.co.caprica/vlcj

private void go(String destination) {
  frame.setState(JFrame.ICONIFIED);
  mediaPlayer.media().play(MRL, getMediaOptions(destination));
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

@Override
  public void actionPerformed(ActionEvent e) {
    if (frame instanceof JInternalFrame) {
      JInternalFrame internalF = (JInternalFrame) frame;
      try {
        internalF.setSelected(true);
        if (internalF.isIcon())
          internalF.setIcon(false);
        internalF.moveToFront();
      } catch (PropertyVetoException e1) {
        e1.printStackTrace();
      }
    } else if (frame instanceof LauncherFrame) {
      LauncherFrame launcher = (LauncherFrame) frame;
      launcher.getJFrame().setState(Frame.NORMAL);
      launcher.getJFrame().toFront();
    }
  }
}

相关文章

JFrame类方法