Java Code Examples for com.intellij.openapi.ui.popup.JBPopup#setSize()

The following examples show how to use com.intellij.openapi.ui.popup.JBPopup#setSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesktopWindowManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void adjustContainerWindow(Component c, Dimension oldSize, Dimension newSize) {
  if (c == null) return;

  Window wnd = SwingUtilities.getWindowAncestor(c);

  if (wnd instanceof JWindow) {
    JBPopup popup = (JBPopup)((JWindow)wnd).getRootPane().getClientProperty(JBPopup.KEY);
    if (popup != null) {
      if (oldSize.height < newSize.height) {
        Dimension size = popup.getSize();
        size.height += newSize.height - oldSize.height;
        popup.setSize(size);
        popup.moveToFitScreen();
      }
    }
  }
}
 
Example 2
Source File: DocumentIntention.java    From weex-language-support with MIT License 5 votes vote down vote up
private void openSample(Project project, Editor editor) {

        EditorTextField field = new EditorTextField(editor.getDocument(), project, WeexFileType.INSTANCE, true, false) {
            @Override
            protected EditorEx createEditor() {
                EditorEx editor1 = super.createEditor();
                editor1.setVerticalScrollbarVisible(true);
                editor1.setHorizontalScrollbarVisible(true);
                return editor1;

            }
        };

        field.setFont(editor.getContentComponent().getFont());

        JBPopup jbPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(field, null)
                .createPopup();

        jbPopup.setSize(new Dimension(500, 500));
        jbPopup.showInBestPositionFor(editor);
    }