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

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

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

JWindow.getSize介绍

暂无

代码示例

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

public Dimension getSize() {
  return window.getSize();
}

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

public void mouseExited(MouseEvent e) {
  Point point = e.getPoint();
  Dimension dim = window.getSize();
  int x = (int)point.getX();
  int y = (int)point.getY();
  boolean close = false;
  if (x < 0 || x >= dim.getWidth()) {
    close = true;
  }
  if (y < 0 || y >= dim.getHeight()) {
    close = true;
  }
  if (close) {
    window.setVisible(false);
    contactItem = null;
    hideWindow();
  }
}

代码示例来源:origin: de.uni_leipzig.asv.toolbox/toolbox-utils

/**
 * Show the splash screen while the rest of the program loads
 */
public void createSplashScreen() {
  JLabel splashLabel = new JLabel(createImageIcon("Splash3.jpg"));
  this.splashScreen = new JWindow();
  this.splashScreen.getContentPane().add(splashLabel);
  this.splashScreen.pack();
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  this.splashScreen.setLocation(screenSize.width / 2
      - this.splashScreen.getSize().width / 2, screenSize.height / 2
      - this.splashScreen.getSize().height / 2);
}

代码示例来源:origin: net.sf.ingenias/editor

public static void createPNG(JComponent graph, File output)
    throws IOException {
  if (graph.getPreferredSize().width != 0
      && graph.getPreferredSize().height != 0) {
    BufferedImage im = new BufferedImage(
        graph.getPreferredSize().width,
        graph.getPreferredSize().height,
        BufferedImage.TYPE_3BYTE_BGR);
    // Graphics2D g = im.createGraphics();
    JWindow fakeFrame = new javax.swing.JWindow();
    fakeFrame.getContentPane().setLayout(new java.awt.BorderLayout());
    fakeFrame.getContentPane().add(graph, BorderLayout.CENTER);
    fakeFrame.pack();
    if (fakeFrame.getSize().width != 0
        && fakeFrame.getSize().height != 0) {
      // fakeFrame.setVisible(true);
      // fakeFrame.paint(g);
      im = createImage(graph, graph.getBounds());
      ImageIO.write(im, "PNG", output);
    }
    // g.dispose();
  }
}

代码示例来源:origin: net.sf.ingenias/editor

public void run() {
    JLabel jl = new JLabel(message);
    jl.setFont(new java.awt.Font("Dialog", 1, 36));
    jw.getContentPane().add(jl);                
    jw.pack();
    jw.setLocation(getCenter(jw.getSize(),resources.getMainFrame()));
    jw.setVisible(true);
  }
});

代码示例来源:origin: org.gephi/ui-components

private void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0, 0);
  SwingUtilities.convertPointToScreen(point, ancestor);
  Dimension dim = popupWindow.getSize();
  Rectangle usableRect = Utilities.getUsableScreenBounds();
  int sepShift = 0;
  Point loc = new Point(point.x + ancestor.getSize().width - dim.width - sepShift - 5 * 2, point.y - dim.height - 5);
  if (!usableRect.contains(loc)) {
    loc = new Point(loc.x, point.y + 5 + ancestor.getSize().height);
  }
  popupWindow.setLocation(loc);
}

代码示例来源:origin: net.sf.ingenias/editor

public static Dimension getSize(String classname, ingenias.editor.entities.ViewPreferences.ViewType kind){
  synchronized (renderer) {
    helperFrame.getContentPane().removeAll();
    if (retrievePanel(classname,kind)==null){
      throw new RuntimeException("Error: there is no renderer defined for \""+classname+"\" for the notation "+kind+". Existing renderers are :"+renderer.keySet());
    }
    helperFrame.getContentPane().add((JPanel)retrievePanel(classname,kind));
    helperFrame.pack();
  }
  return helperFrame.getSize();
}

代码示例来源:origin: net.sf.ingenias/editor

public static void createEPS(JComponent graph, File output)
    throws FileNotFoundException, SVGGraphics2DIOException {
  // Get a DOMImplementation
  FileOutputStream fos = new FileOutputStream(output);
  try {
    JWindow jw = new JWindow();
    jw.getContentPane().add(graph);
    jw.pack();
    EpsGraphics2D g2d = new EpsGraphics2D("prueba", fos, 2, 2,
        jw.getSize().width - 2, jw.getSize().height - 2);
    if (jw.getSize().width != 0 && jw.getSize().height != 0) {
      // svgGenerator.setSVGCanvasSize(new Dimension(2000,2000));
      graph.setDoubleBuffered(false);
      jw.setVisible(true);
      jw.paint(g2d);
      jw.setVisible(false);
      jw.getContentPane().remove(graph);
      // Finally, stream out SVG to the standard output using UTF-8
      // character to byte encoding
      g2d.flush();
      g2d.close();
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: net.sf.ingenias/editor

helperFrame.pack();
  helperFrame.pack();
  return helperFrame.getSize();
} catch (ClassNotFoundException e) {

代码示例来源:origin: undera/jmeter-plugins

private synchronized void showHoverInfo() {
  if (isPreview
      || chartRect.width == 0 || chartRect.height == 0
      || xHoverInfo == -1 || yHoverInfo == -1) {
    return;
  }
  long realX = minXVal + (maxXVal - minXVal) * (xHoverInfo - chartRect.x) / chartRect.width;
  double realY = minYVal + (maxYVal - minYVal) * (chartRect.height - yHoverInfo + chartRect.y) / chartRect.height;
  xAxisLabelRenderer.setValue(realX);
  yAxisLabelRenderer.setValue(realY);
  String hoverInfo = "(" + xAxisLabelRenderer.getText() + " ; " + yAxisLabelRenderer.getText() + ")";
  hoverLabel.setText(hoverInfo);
  int labelWidth = hoverLabel.getPreferredSize().width + 5;
  int labelHeight = hoverLabel.getPreferredSize().height;
  if (hoverWindow.getWidth() < labelWidth || hoverWindow.getHeight() < labelHeight) {
    hoverWindow.setSize(labelWidth, labelHeight);
  }
  Point mousePos = MouseInfo.getPointerInfo().getLocation();
  int hoverWindowX = mousePos.x + hoverGap;
  int hoverWindowY = mousePos.y + hoverGap;
  //we move window only if far from pointer to limit cpu
  double deltaX = Math.abs(hoverWindow.getLocation().getX() - hoverWindowX);
  double deltaY = Math.abs(hoverWindow.getLocation().getY() - hoverWindowY);
  if (forceHoverPosition || deltaX >= hoverGap || deltaY >= hoverGap) {
    //prevent out of screen
    int correctedX = Math.min(hoverWindowX, Toolkit.getDefaultToolkit().getScreenSize().width - hoverWindow.getSize().width);
    hoverWindow.setLocation(correctedX, hoverWindowY);
    forceHoverPosition = false;
  }
}

代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter

private synchronized void showHoverInfo() {
  if (isPreview
      || chartRect.width == 0 || chartRect.height == 0
      || xHoverInfo == -1 || yHoverInfo == -1) {
    return;
  }
  long realX = minXVal + (maxXVal - minXVal) * (xHoverInfo - chartRect.x) / chartRect.width;
  double realY = minYVal + (maxYVal - minYVal) * (chartRect.height - yHoverInfo + chartRect.y) / chartRect.height;
  xAxisLabelRenderer.setValue(realX);
  yAxisLabelRenderer.setValue(realY);
  String hoverInfo = "(" + xAxisLabelRenderer.getText() + " ; " + yAxisLabelRenderer.getText() + ")";
  hoverLabel.setText(hoverInfo);
  int labelWidth = hoverLabel.getPreferredSize().width + 5;
  int labelHeight = hoverLabel.getPreferredSize().height;
  if (hoverWindow.getWidth() < labelWidth || hoverWindow.getHeight() < labelHeight) {
    hoverWindow.setSize(labelWidth, labelHeight);
  }
  Point mousePos = MouseInfo.getPointerInfo().getLocation();
  int hoverWindowX = mousePos.x + hoverGap;
  int hoverWindowY = mousePos.y + hoverGap;
  //we move window only if far from pointer to limit cpu
  double deltaX = Math.abs(hoverWindow.getLocation().getX() - hoverWindowX);
  double deltaY = Math.abs(hoverWindow.getLocation().getY() - hoverWindowY);
  if (forceHoverPosition || deltaX >= hoverGap || deltaY >= hoverGap) {
    //prevent out of screen
    int correctedX = Math.min(hoverWindowX, Toolkit.getDefaultToolkit().getScreenSize().width - hoverWindow.getSize().width);
    hoverWindow.setLocation(correctedX, hoverWindowY);
    forceHoverPosition = false;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

contentWindow.add(cp);
contentWindow.pack();
Dimension dim = contentWindow.getSize();

代码示例来源:origin: net.sf.ingenias/editor

if (jw.getSize().width != 0 && jw.getSize().height != 0) {
  jw.getRootPane().setDoubleBuffered(false);
  RepaintManager currentManager = RepaintManager.currentManager(jw

代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget

x = (int) location.getX() + getSize().width - _calendarWindow.getSize().width;
} else if (_popupLocation == CENTER) {
  x = (int) location.getX() + ((getSize().width - _calendarWindow.getSize().width) / 2);
} else {
  x = (int) location.getX();

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

final Dimension currWindowSize = this.currTabWindow.getSize();
final Point nextWindowLocation = this.nextTabWindow.getLocation();
final Dimension nextWindowSize = this.nextTabWindow.getSize();
final Point prevWindowLocation = this.prevTabWindow.getLocation();
final Dimension prevWindowSize = this.prevTabWindow.getSize();

相关文章