List of usage examples for com.intellij.openapi.ui.popup JBPopup setSize
void setSize(@NotNull Dimension size);
From source file:com.android.tools.idea.editors.hprof.views.ViewBitmapAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { ClassInstance selectedClassInstance = e.getData(InstancesTreeView.SELECTED_CLASS_INSTANCE); if (selectedClassInstance == null) { return;//from w w w .ja v a 2 s . c o m } try { BufferedImage img = BitmapDecoder.getBitmap(new HprofBitmapProvider(selectedClassInstance)); final JComponent comp; if (img != null) { comp = ImageEditorManagerImpl.createImageEditorUI(img); } else { String errorMessage = AndroidBundle.message("android.profiler.hprof.actions.view.bitmap.fail"); comp = new JLabel(errorMessage, Messages.getErrorIcon(), SwingConstants.CENTER); } Project project = e.getData(CommonDataKeys.PROJECT); JBPopup popup = DebuggerUIUtil.createValuePopup(project, comp, null); JFrame frame = WindowManager.getInstance().getFrame(project); Dimension frameSize = frame.getSize(); Dimension size = new Dimension(frameSize.width / 2, frameSize.height / 2); popup.setSize(size); popup.show(new RelativePoint(frame, new Point(size.width / 2, size.height / 2))); } catch (Exception ignored) { } }
From source file:com.intellij.debugger.ui.tree.render.CustomPopupFullValueEvaluator.java
License:Apache License
@Override public void evaluate(@NotNull final XFullValueEvaluationCallback callback) { final T data = getData(); DebuggerUIUtil.invokeLater(() -> { if (callback.isObsolete()) return; final JComponent comp = createComponent(data); Project project = getEvaluationContext().getProject(); JBPopup popup = DebuggerUIUtil.createValuePopup(project, comp, null); JFrame frame = WindowManager.getInstance().getFrame(project); Dimension frameSize = frame.getSize(); Dimension size = new Dimension(frameSize.width / 2, frameSize.height / 2); popup.setSize(size); if (comp instanceof Disposable) { Disposer.register(popup, (Disposable) comp); }//from ww w.j ava 2 s. c om callback.evaluated(""); popup.show(new RelativePoint(frame, new Point(size.width / 2, size.height / 2))); }); }