/** Show the filter dialog */ public void showDialog() { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); include_panel = new ServiceFilterPanel("Include messages based on target service:", filter_include_list); exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list); status_box = new JCheckBox("Filter messages based on status:"); status_box.addActionListener(this); status_active = new JRadioButton("Active messages only"); status_active.setSelected(true); status_active.setEnabled(false); status_complete = new JRadioButton("Complete messages only"); status_complete.setEnabled(false); status_group = new ButtonGroup(); status_group.add(status_active); status_group.add(status_complete); if (filter_active || filter_complete) { status_box.setSelected(true); status_active.setEnabled(true); status_complete.setEnabled(true); if (filter_complete) { status_complete.setSelected(true); } } status_options = new JPanel(); status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS)); status_options.add(status_active); status_options.add(status_complete); status_options.setBorder(indent_border); status_panel = new JPanel(); status_panel.setLayout(new BorderLayout()); status_panel.add(status_box, BorderLayout.NORTH); status_panel.add(status_options, BorderLayout.CENTER); status_panel.setBorder(empty_border); ok_button = new JButton("Ok"); ok_button.addActionListener(this); cancel_button = new JButton("Cancel"); cancel_button.addActionListener(this); buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.add(ok_button); buttons.add(cancel_button); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(include_panel); panel.add(exclude_panel); panel.add(status_panel); panel.add(buttons); dialog = new JDialog(); dialog.setTitle("SOAP Monitor Filter"); dialog.setContentPane(panel); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.pack(); Dimension d = dialog.getToolkit().getScreenSize(); dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2); ok_pressed = false; dialog.show(); }
private void warning(String msg) { final JDialog warn; JButton ok; JLabel message; warn = new JDialog(); warn.setTitle(msg); message = new JLabel("CryoBay: " + msg); ok = new JButton("Ok"); ok.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { warn.dispose(); } }); warn.getContentPane().setLayout(new BorderLayout()); warn.getContentPane().add(message, "North"); warn.getContentPane().add(ok, "South"); warn.setSize(200, 80); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); warn.setLocation(screenSize.width / 2 - 100, screenSize.height / 2 - 40); warn.setResizable(false); warn.show(); }
public void runCalculatorDialog(MouseEvent e) { if (calculatorDialog == null) { JFrame frame = null; Container container = getTopLevelAncestor(); if (container instanceof JFrame) { frame = (JFrame) container; } calculatorDialog = new JDialog(frame, "Rechner", true); calculator = new Calculator(); calculator.getOKButton().addActionListener(this); calculatorDialog.getContentPane().add(calculator); calculatorDialog.pack(); } // Set calculator's init value Money money = getValue(); if (money != null) { calculator.setValue(money.getValue()); } else { calculator.setValue(0.0); } // calculate POP (point of presentation) Point point = ((JComponent) e.getSource()).getLocationOnScreen(); int x = point.x + e.getX(); int y = point.y + e.getY(); // ensure that it does not exceed the screen limits Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Dimension dim = calculatorDialog.getPreferredSize(); if (x + dim.width >= screenDim.width) { x = screenDim.width - dim.width - 1; } if (y + dim.height >= screenDim.height) { y = screenDim.height - dim.height - 1; } // make it visible at wanted location calculatorDialog.setLocation(x, y); calculatorDialog.show(); }
protected void show0() { JRootPane rp = null; if (getOwner() instanceof JFrame) { rp = ((JFrame) getOwner()).getRootPane(); } else if (getOwner() instanceof JDialog) { rp = ((JDialog) getOwner()).getRootPane(); } if (rp != null && !isDocumentModalitySupported() && !isExperimentalSheet()) { ownersGlassPane = rp.getGlassPane(); JPanel blockingPanel = new JPanel(); blockingPanel.setOpaque(false); rp.setGlassPane(blockingPanel); blockingPanel.setVisible(true); } super.show(); }
public void setPanel(Parameters pp, String s) { JPanel buttonsPanel = new JPanel(); okButton = new JButton("确定"); okButton.addActionListener(this); dialog = new JDialog(this, s + " 参数选择", true); Container contentPane = getContentPane(); Container dialogContentPane = dialog.getContentPane(); dialogContentPane.add(pp, BorderLayout.CENTER); dialogContentPane.add(buttonsPanel, BorderLayout.SOUTH); dialog.pack(); buttonsPanel.add(okButton); dialog.setLocation(50, 330); dialog.show(); }
/** * Show tracker * * @param parent GUI parent widget */ public final void show(final Component parent) { Frame frame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); dialog.getContentPane().setLayout(new BorderLayout()); label = new JLabel(START_HTML + labelText + END_HTML); JPanel labelPanel = new JPanel(); labelPanel.setLayout(new BorderLayout()); labelPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); labelPanel.add(label, BorderLayout.CENTER); dialog.getContentPane().add(labelPanel, BorderLayout.CENTER); dialog.pack(); Windows.centerOnScreen(dialog); dialog.show(); }
public void show() { addDatalogData(); super.show(); }
public static boolean showLicensing() { if (Config.getLicenseResource() == null) return true; ClassLoader cl = Main.class.getClassLoader(); URL url = cl.getResource(Config.getLicenseResource()); if (url == null) return true; String license = null; try { URLConnection con = url.openConnection(); int size = con.getContentLength(); byte[] content = new byte[size]; InputStream in = new BufferedInputStream(con.getInputStream()); in.read(content); license = new String(content); } catch (IOException ioe) { Config.trace("Got exception when reading " + Config.getLicenseResource() + ": " + ioe); return false; } // Build dialog JTextArea ta = new JTextArea(license); ta.setEditable(false); final JDialog jd = new JDialog(_installerFrame, true); Container comp = jd.getContentPane(); jd.setTitle(Config.getLicenseDialogTitle()); comp.setLayout(new BorderLayout(10, 10)); comp.add(new JScrollPane(ta), "Center"); Box box = new Box(BoxLayout.X_AXIS); box.add(box.createHorizontalStrut(10)); box.add(new JLabel(Config.getLicenseDialogQuestionString())); box.add(box.createHorizontalGlue()); JButton acceptButton = new JButton(Config.getLicenseDialogAcceptString()); JButton exitButton = new JButton(Config.getLicenseDialogExitString()); box.add(acceptButton); box.add(box.createHorizontalStrut(10)); box.add(exitButton); box.add(box.createHorizontalStrut(10)); jd.getRootPane().setDefaultButton(acceptButton); Box box2 = new Box(BoxLayout.Y_AXIS); box2.add(box); box2.add(box2.createVerticalStrut(5)); comp.add(box2, "South"); jd.pack(); final boolean accept[] = new boolean[1]; acceptButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { accept[0] = true; jd.hide(); jd.dispose(); } }); exitButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { accept[0] = false; jd.hide(); jd.dispose(); } }); // Apply any defaults the user may have, constraining to the size // of the screen, and default (packed) size. Rectangle size = new Rectangle(0, 0, 500, 300); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); size.width = Math.min(screenSize.width, size.width); size.height = Math.min(screenSize.height, size.height); // Center the window jd.setBounds( (screenSize.width - size.width) / 2, (screenSize.height - size.height) / 2, size.width, size.height); // Show dialog jd.show(); return accept[0]; }
@Override @SuppressWarnings("deprecation") public void show() { myFocusTrackback = new FocusTrackback(getDialogWrapper(), getParent(), true); final DialogWrapper dialogWrapper = getDialogWrapper(); boolean isAutoAdjustable = dialogWrapper.isAutoAdjustable(); Point location = null; if (isAutoAdjustable) { pack(); Dimension packedSize = getSize(); Dimension minSize = getMinimumSize(); setSize( Math.max(packedSize.width, minSize.width), Math.max(packedSize.height, minSize.height)); setSize( (int) (getWidth() * dialogWrapper.getHorizontalStretch()), (int) (getHeight() * dialogWrapper.getVerticalStretch())); // Restore dialog's size and location myDimensionServiceKey = dialogWrapper.getDimensionKey(); if (myDimensionServiceKey != null) { final Project projectGuess = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(this)); location = DimensionService.getInstance().getLocation(myDimensionServiceKey, projectGuess); Dimension size = DimensionService.getInstance().getSize(myDimensionServiceKey, projectGuess); if (size != null) { myInitialSize = new Dimension(size); _setSizeForLocation(myInitialSize.width, myInitialSize.height, location); } } if (myInitialSize == null) { myInitialSize = getSize(); } } if (location == null) { location = dialogWrapper.getInitialLocation(); } if (location != null) { setLocation(location); } else { setLocationRelativeTo(getOwner()); } if (isAutoAdjustable) { final Rectangle bounds = getBounds(); ScreenUtil.fitToScreen(bounds); setBounds(bounds); } addWindowListener( new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { final DialogWrapper wrapper = getDialogWrapper(); if (wrapper != null && myFocusTrackback != null) { myFocusTrackback.cleanParentWindow(); myFocusTrackback.registerFocusComponent( new FocusTrackback.ComponentQuery() { @Override public Component getComponent() { return wrapper.getPreferredFocusedComponent(); } }); } } @Override public void windowDeactivated(WindowEvent e) { if (!isModal()) { final Ref<IdeFocusManager> focusManager = new Ref<IdeFocusManager>(null); Project project = getProject(); if (project != null && !project.isDisposed()) { focusManager.set(getFocusManager()); focusManager .get() .doWhenFocusSettlesDown( new Runnable() { @Override public void run() { disposeFocusTrackbackIfNoChildWindowFocused(focusManager.get()); } }); } else { disposeFocusTrackbackIfNoChildWindowFocused(focusManager.get()); } } } @Override public void windowOpened(WindowEvent e) { if (!SystemInfo.isMacOSLion) return; Window window = e.getWindow(); if (window instanceof Dialog) { ID _native = MacUtil.findWindowForTitle(((Dialog) window).getTitle()); if (_native != null && _native.intValue() > 0) { // see MacMainFrameDecorator // NSCollectionBehaviorFullScreenAuxiliary = 1 << 8 Foundation.invoke(_native, "setCollectionBehavior:", 1 << 8); } } } }); if (Registry.is("actionSystem.fixLostTyping")) { final IdeEventQueue queue = IdeEventQueue.getInstance(); if (queue != null) { queue.getKeyEventDispatcher().resetState(); } // if (myProject != null) { // Project project = myProject.get(); // if (project != null && !project.isDisposed() && project.isInitialized()) { // // IdeFocusManager.findInstanceByComponent(this).requestFocus(new // MyFocusCommand(dialogWrapper), true); // } // } } if (SystemInfo.isMac && myProject != null && Registry.is("ide.mac.fix.dialog.showing") && !dialogWrapper.isModalProgress()) { final IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject.get()); AppIcon.getInstance().requestFocus(frame); } setBackground(UIUtil.getPanelBackground()); final ApplicationEx app = ApplicationManagerEx.getApplicationEx(); if (app != null && !app.isLoaded() && Splash.BOUNDS != null) { final Point loc = getLocation(); loc.y = Splash.BOUNDS.y + Splash.BOUNDS.height; setLocation(loc); } super.show(); }