Java Code Examples for javax.swing.JOptionPane#showInternalMessageDialog()

The following examples show how to use javax.swing.JOptionPane#showInternalMessageDialog() . 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: WXChatConsole.java    From SmartIM with Apache License 2.0 7 votes vote down vote up
@Override
protected boolean hyperlinkActivated(String desc) {
    if (desc.startsWith("weixin://")) {
        JOptionPane.showInternalMessageDialog(null, desc + "为微信专用协议,请使用手机微信打开");
        return false;
    }
    return super.hyperlinkActivated(desc);
}
 
Example 2
Source File: TestViewer.java    From sis with Apache License 2.0 7 votes vote down vote up
/**
 * Saves the image of the currently selected frame.
 */
private void savePNG() {
    final RenderedImage image = getSelectedImage();
    if (image != null) {
        final File file = new File(System.getProperty("user.home"), "ImageTest.png");
        final String title, message;
        final int type;
        if (file.exists()) {
            type    = JOptionPane.WARNING_MESSAGE;
            title   = "Confirm overwrite";
            message = "File " + file + " exists. Overwrite?";
        } else {
            type    = JOptionPane.QUESTION_MESSAGE;
            title   = "Confirm write";
            message = "Save in " + file + '?';
        }
        if (JOptionPane.showInternalConfirmDialog(desktop, message, title,
                JOptionPane.YES_NO_OPTION, type) == JOptionPane.OK_OPTION)
        {
            try {
                ImageTestCase.savePNG(image, file);
            } catch (IOException e) {
                JOptionPane.showInternalMessageDialog(desktop, e.toString(),
                        "Error", JOptionPane.WARNING_MESSAGE);
            }
        }
    }
}
 
Example 3
Source File: JConsoleCLIPlugin.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void connect() throws Exception {
    JConsoleContext jcCtx = this.getContext();
    MBeanServerConnection mbeanServerConn = jcCtx.getMBeanServerConnection();

    if (mbeanServerConn instanceof RemotingMBeanServerConnection) {
        final CommandContext cmdCtx
                = CommandContextFactory.getInstance().newCommandContext();
        if (connectUsingRemoting(cmdCtx,
                (RemotingMBeanServerConnection) mbeanServerConn)) {
            // Set a listener for connection state change.
            jcCtx.addPropertyChangeListener((PropertyChangeEvent evt) -> {
                log.tracef("Received property change %s value %s",
                        evt.getPropertyName(), evt.getNewValue());
                if (JConsoleContext.CONNECTION_STATE_PROPERTY.equals(evt.getPropertyName())) {
                    ConnectionState state = (ConnectionState) evt.getNewValue();
                    if (state == ConnectionState.CONNECTED) {
                        try {
                            // Rebuild the ModelControllerClient
                            RemotingMBeanServerConnection rmbsc
                                    = (RemotingMBeanServerConnection) getContext().getMBeanServerConnection();
                            connectUsingRemoting(cmdCtx, rmbsc);
                            connectedClient = cmdCtx.getModelControllerClient();
                            isConnected = true;
                        } catch (Exception ex) {
                            log.error(null, ex);
                        }
                    } else {
                        isConnected = false;
                    }
                }
            });
            connectedClient = cmdCtx.getModelControllerClient();
            Supplier<ModelControllerClient> client = () -> {
                return connectedClient;
            };
            init(cmdCtx, client);
        } else {
             JOptionPane.showInternalMessageDialog(jconsolePanel, MSG_CANNOT_ESTABLISH_CONNECTION);
        }
    } else {
        //show dialog
        dialog.start();
    }
}