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

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

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

JWindow.setSize介绍

暂无

代码示例

代码示例来源:origin: protegeproject/protege

private void updatePopup(List matches) {
  int count = matches.size();
  if(count > maxEntries) {
    count = maxEntries;
  }
  if (!matches.isEmpty()) {
    popupList.setListData(matches.subList(0, count).toArray());
  }
  else {
    popupList.setListData(matches.toArray());
  }
  popupList.setSelectedIndex(0);
  popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

private void updatePopup(List matches) {
  int count = matches.size();
  if(count > maxEntries) {
    count = maxEntries;
  }
  if (!matches.isEmpty()) {
    popupList.setListData(matches.subList(0, count).toArray());
  }
  else {
    popupList.setListData(matches.toArray());
  }
  popupList.setSelectedIndex(0);
  popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

private void updatePopup(List matches) {
  int count = matches.size();
  if(count > maxEntries) {
    count = maxEntries;
  }
  if (!matches.isEmpty()) {
    popupList.setListData(matches.subList(0, count).toArray());
  }
  else {
    popupList.setListData(matches.toArray());
  }
  popupList.setSelectedIndex(0);
  popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
}

代码示例来源:origin: org.protege/protege-editor-owl

private void updatePopup(List matches) {
  int count = matches.size();
  if(count > maxEntries) {
    count = maxEntries;
  }
  if (!matches.isEmpty()) {
    popupList.setListData(matches.subList(0, count).toArray());
  }
  else {
    popupList.setListData(matches.toArray());
  }
  popupList.setSelectedIndex(0);
  popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
}

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

JFrame owner = new JFrame();
 owner.setVisible(true);
 JWindow window = new JWindow(owner);
 window.setFocusableWindowState(true);
 window.add(new JTextField("edit me"));
 window.setSize(200, 200);
 window.setVisible(true);

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

JWindow window = new JWindow();
window.setSize(300,200);
window.setOpacity(0.5f); //this will make the window half-transparent

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

JFrame frame = new JFrame("Test");
 frame.setLocation(100, 100);
 frame.setSize(500, 500);
 frame.setVisible(true);
 frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 // 'Invisible' fake component for positioning
 JWindow c = new JWindow();
 c.setSize(0, 0);
 c.setVisible(true);
 Point location = frame.getLocation();
 location.translate(200, 100);
 c.setLocation(location);
 JOptionPane.showInputDialog(c,"Foo");

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

JWindow window = new JWindow();
 window.add(new JButton("test"));
 window.setSize(500, 500);
 window.setLocationRelativeTo(null);
 window.setVisible(true);

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

private Window initFullScreenWindow() {
  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice[] gds = ge.getScreenDevices();
  GraphicsDevice gd = gds[1];
  JWindow window = new JWindow(gd.getDefaultConfiguration());
  window.setContentPane(getJFSPanel());
  window.setLocation(1280, 0);
  window.setSize(gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight());
  window.setAlwaysOnTop(true);
  //gd.setFullScreenWindow(window);
  return window;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public void actionPerformed(ActionEvent e) {
    if (window == null || !window.isVisible()) {
      if (window == null) {
        window = new JWindow(JSVGViewerFrame.this);
        Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
        window.setSize(size);
      }
      // Go to full screen in JWindow)
      svgCanvas.getParent().remove(svgCanvas);
      window.getContentPane().add(svgCanvas);
      window.setVisible(true);
      window.toFront();
      svgCanvas.requestFocus();
    } else {
      // Go back to JSVGViewerFrame display
      svgCanvas.getParent().remove(svgCanvas);
      svgCanvasPanel.add(svgCanvas, BorderLayout.CENTER);
      window.setVisible(false);
    }
  }
}

代码示例来源:origin: apache/batik

public void actionPerformed(ActionEvent e) {
    if (window == null || !window.isVisible()) {
      if (window == null) {
        window = new JWindow(JSVGViewerFrame.this);
        Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
        window.setSize(size);
      }
      // Go to full screen in JWindow)
      svgCanvas.getParent().remove(svgCanvas);
      window.getContentPane().add(svgCanvas);
      window.setVisible(true);
      window.toFront();
      svgCanvas.requestFocus();
    } else {
      // Go back to JSVGViewerFrame display
      svgCanvas.getParent().remove(svgCanvas);
      svgCanvasPanel.add(svgCanvas, BorderLayout.CENTER);
      window.setVisible(false);
    }
  }
}

代码示例来源:origin: org.protege/protege-editor-owl

private void showResults(Set<OWLEntity> results) {
  JWindow window = getWindow();
  if (results.size() > 0) {
    Point pt = new Point(0, 0);
    SwingUtilities.convertPointToScreen(pt, this);
    window.setLocation(pt.x, pt.y + getHeight() + 2);
    window.setSize(getWidth(), 400);
    resultsList.setListData(getSortedResults(results));
    window.setVisible(true);
    window.validate();
    resultsList.setSelectedIndex(0);
  }
  else {
    resultsList.setListData(new Object [0]);
  }
}

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

public class TranslucentWindow {

  public static void main(String[] args) {
    new TranslucentWindow();
  }

  public TranslucentWindow() {
    EventQueue.invokeLater(new Runnable() {
      @Override
      public void run() {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
        }

        JWindow window = new JWindow();
        window.setSize(100, 100);
        window.setBackground(new Color(255, 0, 0, 128));
        window.setLocationRelativeTo(null);
        window.setVisible(true);

      }
    });
  }

}

代码示例来源: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();
   }
  }
 }
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

private void showResults() {
  JWindow window = getWindow();
  Point pt = new Point(0, 0);
  SwingUtilities.convertPointToScreen(pt, this);
  window.setLocation(pt.x + (getWidth() - WINDOW_WIDTH), pt.y + getHeight() + 2);
  Container parent = window.getParent();
  int height = 400;
  if (parent != null) {
    height = (parent.getHeight() * 3) / 4;
  }
  window.setSize(WINDOW_WIDTH, height);
  searchPanel.setSearchString(getText().trim());
  window.setVisible(true);
  window.validate();
}

代码示例来源:origin: protegeproject/protege

private void showResults() {
  selectEntityAction.setEnabled(true);
  JWindow window = getWindow();
  Point pt = new Point(0, 0);
  SwingUtilities.convertPointToScreen(pt, this);
  window.setLocation(pt.x + (getWidth() - WINDOW_WIDTH) / 2, pt.y + getHeight() + 2);
  Container parent = window.getParent();
  int height = 400;
  if (parent != null) {
    height = (parent.getHeight() * 3) / 4;
  }
  window.setSize(WINDOW_WIDTH, height);
  searchPanel.setSearchString(getText().trim());
  window.setVisible(true);
  window.validate();
}

代码示例来源:origin: protegeproject/protege

private void showPopup() {
  if (popupWindow == null) {
    createPopupWindow();
  }
  if (!popupWindow.isVisible()) {
    popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
    try {
      int wordIndex = getWordIndex();
      Point p = new Point(0, 0); // default for when the doc is empty
      if (wordIndex > 0){
        p = textComponent.modelToView(wordIndex).getLocation();
      }
      SwingUtilities.convertPointToScreen(p, textComponent);
      p.y = p.y + textComponent.getFontMetrics(textComponent.getFont()).getHeight();
      popupWindow.setLocation(p);
    }
    catch (BadLocationException e) {
      e.printStackTrace();
    }
    popupWindow.setVisible(true);
  }
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

private void showResults() {
    JWindow window = getWindow();
//        if (results.size() > 0) {
    Point pt = new Point(0, 0);
    SwingUtilities.convertPointToScreen(pt, this);
    window.setLocation(pt.x + (getWidth() - WINDOW_WIDTH), pt.y + getHeight() + 2);

    Container parent = window.getParent();
    int height = 400;
    if (parent != null) {
      height = (parent.getHeight() * 3) / 4;
    }
    window.setSize(WINDOW_WIDTH, height);

//            searchOptionsPanel.refresh();

    searchPanel.setSearchString(getText().trim());

    window.setVisible(true);
    window.validate();
//        }
//        else {
//            closeResults();
//        }
  }

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

private void showPopup() {
  if (popupWindow == null) {
    createPopupWindow();
  }
  if (!popupWindow.isVisible()) {
    popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
    try {
      int wordIndex = getWordIndex();
      Point p = new Point(0, 0); // default for when the doc is empty
      if (wordIndex > 0){
        p = textComponent.modelToView(wordIndex).getLocation();
      }
      SwingUtilities.convertPointToScreen(p, textComponent);
      p.y = p.y + textComponent.getFontMetrics(textComponent.getFont()).getHeight();
      popupWindow.setLocation(p);
    }
    catch (BadLocationException e) {
      e.printStackTrace();
    }
    popupWindow.setVisible(true);
  }
}

代码示例来源:origin: org.protege/protege-editor-owl

private void showPopup() {
  if (popupWindow == null) {
    createPopupWindow();
  }
  if (!popupWindow.isVisible()) {
    popupWindow.setSize(POPUP_WIDTH, POPUP_HEIGHT);
    try {
      int wordIndex = getWordIndex();
      Point p = new Point(0, 0); // default for when the doc is empty
      if (wordIndex > 0){
        p = textComponent.modelToView(wordIndex).getLocation();
      }
      SwingUtilities.convertPointToScreen(p, textComponent);
      p.y = p.y + textComponent.getFontMetrics(textComponent.getFont()).getHeight();
      popupWindow.setLocation(p);
    }
    catch (BadLocationException e) {
      e.printStackTrace();
    }
    popupWindow.setVisible(true);
  }
}

相关文章