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

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

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

JFrame.setAutoRequestFocus介绍

暂无

代码示例

代码示例来源:origin: com.github.jjYBdx4IL.utils/junit4-utils

protected JFrame createTestJFrame() {
  if (!SwingUtilities.isEventDispatchThread()) {
    throw new IllegalThreadStateException();
  }
  final JFrame jf = new JFrame(InteractiveTestBase.class.getName());
  setupListeners(jf);
  jf.setAutoRequestFocus(false);
  JPanel container = new JPanel();
  container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
  container.setBackground(new Color(200, 255, 200));
  container.add(label);
  JScrollPane jsp = new JScrollPane(container);
  jf.getContentPane().add(jsp);
  jf.pack();
  jf.setLocationRelativeTo(null);
  return jf;
}

代码示例来源:origin: com.github.jjYBdx4IL/github-test-utils

protected JFrame createTestJFrame() {
  if (!SwingUtilities.isEventDispatchThread()) {
    throw new IllegalThreadStateException();
  }
  final JFrame jf = new JFrame(InteractiveTestBase.class.getName());
  setupListeners(jf);
  jf.setAutoRequestFocus(false);
  JPanel container = new JPanel();
  container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
  container.setBackground(new Color(200, 255, 200));
  container.add(label);
  JScrollPane jsp = new JScrollPane(container);
  jf.getContentPane().add(jsp);
  jf.pack();
  jf.setLocationRelativeTo(null);
  return jf;
}

代码示例来源:origin: padreati/rapaio

@Override
  public void draw(Figure figure, int width, int height) {
    @SuppressWarnings("deprecation")
    FigurePanel figurePanel = new FigurePanel(figure);
    JFrame frame = new JFrame("rapaio graphic window");
    frame.setContentPane(figurePanel);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    frame.setLayout(new BorderLayout());
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    frame.setAutoRequestFocus(true);
    frame.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);

    frame.setSize(width, height);
    do {
      try {
        Thread.sleep(10);
      } catch (InterruptedException ignored) {
      }
    } while (frame.isVisible());
  }
}

代码示例来源:origin: com.github.jjYBdx4IL/github-test-utils

@Override
  public void run() {
    if (reuse) {
      jf = null;
      for (Frame f : Frame.getFrames()) {
        if (FRAME_TITLE.equals(f.getTitle())) {
          jf = (JFrame) f;
          log.debug("openWindow(): re-using existing frame " + jf);
        }
      }
      if (jf != null) {
        setupListeners(jf);
        removeLoadingLabel = false;
        getContainer().removeAll();
        jf.pack();
        jf.setVisible(true);
        return;
      }
    }
    jf = createTestJFrame();
    log.debug("openWindow(): created new frame " + jf);
    jf.setAutoRequestFocus(true);
    jf.setVisible(true);
  }
});

代码示例来源:origin: com.github.jjYBdx4IL.utils/junit4-utils

@Override
  public void run() {
    if (reuse) {
      jf = null;
      for (Frame f : Frame.getFrames()) {
        if (FRAME_TITLE.equals(f.getTitle())) {
          jf = (JFrame) f;
          log.debug("openWindow(): re-using existing frame " + jf);
        }
      }
      if (jf != null) {
        setupListeners(jf);
        removeLoadingLabel = false;
        getContainer().removeAll();
        jf.pack();
        jf.setVisible(true);
        return;
      }
    }
    jf = createTestJFrame();
    log.debug("openWindow(): created new frame " + jf);
    jf.setAutoRequestFocus(true);
    jf.setVisible(true);
  }
});

代码示例来源:origin: com.metsci.glimpse/glimpse-docking

frame.setAutoRequestFocus( false );
frame.setFocusable( false );
frame.setFocusableWindowState( false );

相关文章

JFrame类方法