Java 8 JDialog - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JDialog class.

This code example shows how to use the following methods:setVisible, pack, setLocationRelativeTo, setContentPane, setDefaultCloseOperation
        final JOptionPane optionPane = new JOptionPane(
                params, 
                JOptionPane.WARNING_MESSAGE,
                JOptionPane.YES_NO_OPTION);
 
        final JDialog dialog = new JDialog(getMainFrame(), "Confirmation of licenses and agreements", true);
        dialog.setContentPane(optionPane);
        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        optionPane.addPropertyChangeListener(
                new PropertyChangeListener() {
                    @Override 
                    public void propertyChange(PropertyChangeEvent e) {
                        String prop = e.getPropertyName();
 
                        if (dialog.isVisible()
                                && (e.getSource() == optionPane)
                                && (JOptionPane.VALUE_PROPERTY.equals(prop))) {
                            dialog.setVisible(false);
                        } 
                    } 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setVisible, setSize, getContentPane
    public static void execLoop(JComponent editor, Frame parent, boolean modal) {
        execLoop(editor, parent, modal, 800, 600);
    } 
 
    public static void execLoop(JComponent editor, Frame parent, boolean modal, int w, int h) {
        JDialog dialog = new JDialog(parent, modal);
 
        Container contentPane = dialog.getContentPane();
        contentPane.setLayout(new BorderLayout());
 
        JScrollPane scrollPane = new JScrollPane(editor);
        contentPane.add(scrollPane, BorderLayout.CENTER);
 
        dialog.setSize(w, h);
        centerWindow(dialog);
        dialog.setVisible(true);
 
    } 
 
    public static void execLoop(JComponent editor, boolean modal) {
        execLoop(editor, new JFrame(), modal);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setTitle, pack, getContentPane
     * Create a new ForceConfigAction. 
     * @param frame the parent frame for which to create the dialog 
     * @param fsim the force simulator to configure 
     */ 
    public ForceConfigAction(JFrame frame, ForceSimulator fsim) {
        dialog = new JDialog(frame, false);
        dialog.setTitle("Configure Force Simulator");
        JPanel forcePanel = new JForcePanel(fsim);
        dialog.getContentPane().add(forcePanel);
        dialog.pack();
    } 
     
    /** 
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) 
     */ 
    public void actionPerformed(ActionEvent e) {
        dialog.setVisible(true);
    } 
 
} // end of class ForceConfigAction 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setVisible, getContentPane
     * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent) 
     */ 
    @Override 
    public void doAction(ActionEvent e) {
        if (helpWindow == null) {
            helpWindow = new JDialog(new Frame(),// independent frame to
                                                    // allow it to be overlaid 
                                                    // by the main frame 
                    JMeterUtils.getResString("help"),//$NON-NLS-1$ 
                    false); 
            helpWindow.getContentPane().setLayout(new GridLayout(1, 1));
            ComponentUtil.centerComponentInWindow(helpWindow, 60);
        } 
        helpWindow.getContentPane().removeAll();
        helpWindow.getContentPane().add(scroller);
        helpWindow.setVisible(true);
        if (e.getSource() instanceof String[]) {
            String[] source = (String[]) e.getSource();
            resetPage(source[0]);
            helpDoc.scrollToReference(source[1]);
        } else { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getPreferredSize, validate, pack, setIconImage, setSize
 
public class DialogFactory { 
 
    public static JDialog getJDialogInstance(Frame owner, String title, boolean modal, JAbsrtactDialogPanel content, String imagePath) {
        if(!GraphicsEnvironment.isHeadless()) {
            JDialog ret = new JDialog(owner, title, modal);
            ret.add(content);
            ret.pack();
            Dimension size = ret.getPreferredSize();
            if(size.width < content.getMinWidth()) {
                size.width = content.getMinWidth();
            } 
            ret.setSize(size);
            ret.validate();
            if(imagePath != null) {
                ImageIcon imageIcon = new ImageIcon(DialogFactory.class.getResource(imagePath));
                if(imageIcon != null) {
                    ret.setIconImage(imageIcon.getImage());
                } 
            } 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSize, setPreferredSize, setVisible, pack, setContentPane
 
    @Override 
    public void actionPerformed(CommandEvent event) {
        super.actionPerformed(event);
        final OpendapAccessPanel opendapAccessPanel = new OpendapAccessPanel(getAppContext(), event.getCommand().getHelpId());
        final JDialog jDialog = new JDialog(getAppContext().getApplicationWindow(), "OPeNDAP Access");
        jDialog.setContentPane(opendapAccessPanel);
        jDialog.pack();
        final Dimension size = jDialog.getSize();
        jDialog.setPreferredSize(size);
        jDialog.setVisible(true);
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getPreferredSize, setVisible, dispose, setIconImage
                JOptionPane.QUESTION_MESSAGE, 
                JOptionPane.YES_NO_OPTION
        ); 
 
        final JDialog dialog = pane.createDialog(textBundle.textFor("StartActivityConfirmDialog.Title")); //$NON-NLS-1$
        dialog.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/Baralga-Tray.gif"))); //$NON-NLS-1$ 
         
        Dimension d = dialog.getPreferredSize();
        final Point preferredLeftTop = new Point(currentMousePosition.x - d.width / 2, currentMousePosition.y - d.height / 2);
        AWTUtils.keepInScreenBounds(preferredLeftTop, dialog);
 
        dialog.setVisible(true);
        dialog.dispose();
 
        final Object selectedValue = pane.getValue();
 
        return (selectedValue instanceof Integer)
        && (((Integer) selectedValue).intValue() == JOptionPane.YES_OPTION);
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth, getX, getY
 
	public void storeDialogPositions(final JDialog dialog) {
		storeDialogPositions(dialog, name);
	} 
	public void storeDialogPositions(final JDialog dialog, final String window_preference_storage_property) {
		setX((dialog.getX()));
		setY((dialog.getY()));
		setWidth((dialog.getWidth()));
		setHeight((dialog.getHeight()));
		final String marshalled = marshall();
		ResourceController.getResourceController().setProperty(window_preference_storage_property, marshalled);
	} 
 
	public XMLElement restoreDialogPositions(final JDialog dialog) {
		return restoreDialogPositions(dialog, name);
	} 
	public XMLElement restoreDialogPositions(final JDialog dialog, final String window_preference_storage_property) {
		String marshalled = ResourceController.getResourceController().getProperty(window_preference_storage_property);
		return unmarschall(marshalled, dialog);
	} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:pack, getContentPane
     * 
     * @param host 
     *            the host where JMeter threads are stopping 
     */ 
    public void showStoppingMessage(String host) {
        stoppingMessage = new JDialog(this, JMeterUtils.getResString("stopping_test_title"), true);// $NON-NLS-1$
        JLabel stopLabel = new JLabel(JMeterUtils.getResString("stopping_test") + ": " + host);// $NON-NLS-1$
        stopLabel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
        stoppingMessage.getContentPane().add(stopLabel);
        stoppingMessage.pack();
        ComponentUtil.centerComponentInComponent(this, stoppingMessage);
        SwingUtilities.invokeLater(new Runnable() {
            @Override 
            public void run() { 
                if (stoppingMessage != null) {
                    stoppingMessage.setVisible(true);
                } 
            } 
        }); 
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setVisible, setBounds, getContentPane
 
public final class WelcomeAction implements ActionListener {
 
    public void actionPerformed(ActionEvent e) {
        WelcomeTopComponent component = WelcomeTopComponent.getInstance();
        JDialog dialog = new JDialog(WindowManager.getDefault().getMainWindow(),
                component.getName(), false);
        dialog.getContentPane().add(component);
        dialog.setBounds(212, 237, 679, 378);
        dialog.setVisible(true);
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 JDialog Methods: