javax.swing.JWindow.getGraphicsConfiguration()方法的使用及代码示例

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

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

JWindow.getGraphicsConfiguration介绍

暂无

代码示例

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

/**
 * Check if translucecncy is supported on this device.
 */
private void checkTranslucencySupport() {
  translucencySupported = window.getGraphicsConfiguration().getDevice()
      .isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT);
}

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

newWin.pack();
Insets scnMax = Toolkit.getDefaultToolkit().getScreenInsets(newWin.getGraphicsConfiguration());
int taskBar = scnMax.bottom;
int x = screenSize.width - newWin.getWidth();

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

private void setSuggestionWindowLocation() {
 if (textComponent.isShowing()){
  suggestionWindow.pack();
  if (textComponent instanceof JTextField) {
   int width = Math.max(textComponent.getWidth(), suggestionWindow.getWidth());
   int screenHeight = suggestionWindow.getGraphicsConfiguration().getDevice().getDisplayMode().getHeight();
   suggestionWindow.setSize(width, (int) Math.min(suggestionWindow.getHeight(), screenHeight / 2));
   int x = (int) textComponent.getLocationOnScreen().getX();
   int y = (int) (textComponent.getLocationOnScreen().getY() + textComponent.getHeight());
   suggestionWindow.setLocation(x, y);
  } else {
   try {
    final int caretPosition = Math.min(textComponent.getText().length(), textComponent.getCaretPosition());
    final Rectangle rectangle = textComponent.modelToView(caretPosition);
    final Point p = new Point(rectangle.x, rectangle.y + rectangle.height);
    SwingUtilities.convertPointToScreen(p, textComponent);
    suggestionWindow.setLocation(p.x, p.y);
   } catch (BadLocationException e) {
    e.printStackTrace();
   }
  }
 }
}

相关文章