java.awt.Window.setFocusableWindowState()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(318)

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

Window.setFocusableWindowState介绍

[英]Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. If this Window's focusable Window state is set to false, then isFocusableWindow will return false. If this Window's focusable Window state is set to true, then isFocusableWindow may return true or false depending upon the other requirements which must be met in order for a Window to be focusable.

Setting a Window's focusability state to false is the standard mechanism for an application to identify to the AWT a Window which will be used as a floating palette or toolbar, and thus should be a non-focusable Window.
[中]设置如果此窗口满足isFocusableWindow中概述的其他要求,是否可以成为聚焦窗口。如果此窗口的可聚焦窗口状态设置为false,则isFocusableWindow将返回false。如果此窗口的可聚焦窗口状态设置为true,则isFocusableWindow可能返回truefalse,具体取决于窗口可聚焦必须满足的其他要求。
将窗口的可聚焦状态设置为false是应用程序向AWT标识窗口的标准机制,该窗口将用作浮动调色板或工具栏,因此应该是不可聚焦的窗口。

代码示例

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

public class KeyBoard extends javax.swing.JDialog {

  /**
   * Creates new form KeyBoard
   */
  public KeyBoard(java.awt.Frame parent, boolean modal) {
    super(null, modal);

    this.frame = parent;

    setFocusableWindowState(false);
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    initComponents();
  }

  //Here are the other methods...

  private javax.swing.JButton jButton1;
  private javax.swing.JButton jButton2;
  private java.awt.Frame frame;
}

代码示例来源:origin: org.jodd/jodd-wot

@Override
public void dispose() {
  owner.setEnabled(true);
  owner.setFocusableWindowState(true);
  super.dispose();
}

代码示例来源:origin: de.sciss/prefuse-core

public void mouseExited(MouseEvent e) {
  if ( !showing ) return;
  int x = e.getX(), y = e.getY();
  Component c = (Component)e.getSource();
  if ( x < 0 || y < 0 || x > c.getWidth() || y > c.getHeight() )
  {
    Window w = SwingUtilities.getWindowAncestor(JCustomTooltip.this);
    w.removeMouseListener(this);
    w.setFocusableWindowState(false);
    popup.hide();
    popup = null;
    getComponent().setToolTipText("?");
    showing = false;
  }
}

代码示例来源:origin: de.sciss/scisslib

public void pack()
  {
    if( w != null ) {
      // circumvention for bug 1924630 : this throws a NullPointerException
      // with the combination Metal-lnf / java 1.5 / screen menu bar / laf window deco
      // / floating palettes. We have to make sure the window is focusable
      // during pack():
      final boolean wasFocusable = w.getFocusableWindowState();
      if( !wasFocusable ) {
        w.setFocusableWindowState( true );
      }
      w.pack();
      if( !wasFocusable ) {
        w.setFocusableWindowState( false );
      }
    } else if( jif != null ) {
      // bug in swing??
      // when using undecorated windows plus metal-lnf plus lnf-window-deco
//            try { jif.pack(); } catch( NullPointerException e ) {}
      jif.pack();
    } else {
      throw new IllegalStateException();
    }
  }

代码示例来源:origin: freeplane/freeplane

public void ancestorRemoved(AncestorEvent event) {
  final Component glassPane = rootPane.getRootPane().getGlassPane();
  glassPane.removeMouseListener(mouseListener);
  glassPane.removeMouseMotionListener(mouseListener);
  glassPane.setVisible(false);
  SwingUtilities.getWindowAncestor(rootPane).setFocusableWindowState(true);
}

代码示例来源:origin: freeplane/freeplane

public void ancestorAdded(AncestorEvent event) {
    final Component glassPane = rootPane.getRootPane().getGlassPane();
    glassPane.addMouseListener(mouseListener);
    glassPane.addMouseMotionListener(mouseListener);
    glassPane.setVisible(true);
    SwingUtilities.getWindowAncestor(rootPane).setFocusableWindowState(false);
  }
}

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

super(mainFrame, "", false);
setUndecorated(true);
setFocusableWindowState(false);
add(new JScrollPane(new JTextArea(20, 40)));
((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

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

this.setUndecorated(true);
this.setAlwaysOnTop(true);
this.setFocusableWindowState(true);
this.setBackground(new Color(0,255,255,0));
WindowUtils.setWindowTransparent(this, true);

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

dialog.setLocation(x, y);
dialog.pack();
dialog.setFocusableWindowState(false);
dialog.setVisible(true);

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

super(mainFrame, "", false);
setUndecorated(true);
setFocusableWindowState(false);
add(new JScrollPane(new JTextArea(20, 40)));
((JPanel) getContentPane()).setBorder(

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

public void dispose() {
  owner.setEnabled(true);
  owner.setFocusableWindowState(true);
  super.dispose();
public void hide() {
  owner.setEnabled(true);
  owner.setFocusableWindowState(true);
  super.hide();
  boolean blockParent = (visible && modal);
  owner.setEnabled(!blockParent);
  owner.setFocusableWindowState(!blockParent);
  super.setVisible(visible);
  if (blockParent) {
    owner.removeWindowListener(parentWindowListener);
    owner.setEnabled(true);
    owner.setFocusableWindowState(true);

代码示例来源:origin: de.sciss/prefuse-core

public void ancestorAdded(AncestorEvent event) {
  if ( showing ) { return; }
  Window ttip = SwingUtilities.getWindowAncestor(getParent());
  if ( ttip == null || !ttip.isVisible() ) {
    return;
  }
  //ttip.addMouseListener(this);
  ttip.getLocation(point);
  ttip.setVisible(false);
  getParent().remove(JCustomTooltip.this);
  
  JComponent c = getComponent();
  c.setToolTipText(null);
  c.removeMouseMotionListener(ToolTipManager.sharedInstance());
  
  popup = PopupFactory.getSharedInstance().getPopup(
      c, JCustomTooltip.this, point.x, point.y);
  Window w = SwingUtilities.getWindowAncestor(JCustomTooltip.this);
  w.addMouseListener(this);
  w.setFocusableWindowState(true);
  popup.show();
  
  showing = true;
}

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

setFocusableWindowState(false);

代码示例来源:origin: org.jodd/jodd-wot

boolean blockParent = (visible && modal);
owner.setEnabled(!blockParent);
owner.setFocusableWindowState(!blockParent);
super.setVisible(visible);
  owner.setFocusableWindowState(true);

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

setFocusCycleRoot(false);
setFocusable(false);
setFocusableWindowState(false);
setName("main");
setOpacity(0.4f);

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

JF.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JF.setAlwaysOnTop(true);
JF.setFocusableWindowState(false);
JF.setVisible(true);

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

setFocusableWindowState(false);
setModalityType(ModalityType.MODELESS);
setSize(mText.length() * CHARACTER_LENGTH_MULTIPLIER, 25);

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

dragImage.setFocusableWindowState(false);
dragImage.setName("###overrideRedirect###");
Icon dragIcon = new Icon() {

代码示例来源:origin: net.java.dev.jna/jna-platform

dragImage.setFocusableWindowState(false);
dragImage.setName("###overrideRedirect###");
Icon dragIcon = new Icon() {

代码示例来源:origin: org.xworker/xworker_core

obj.setFocusableWindowState(focusableWindowState);

相关文章

Window类方法