當前位置: 首頁>>代碼示例>>Java>>正文


Java JOptionPane.INFORMATION_MESSAGE屬性代碼示例

本文整理匯總了Java中javax.swing.JOptionPane.INFORMATION_MESSAGE屬性的典型用法代碼示例。如果您正苦於以下問題:Java JOptionPane.INFORMATION_MESSAGE屬性的具體用法?Java JOptionPane.INFORMATION_MESSAGE怎麽用?Java JOptionPane.INFORMATION_MESSAGE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.JOptionPane的用法示例。


在下文中一共展示了JOptionPane.INFORMATION_MESSAGE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getJOptionType

/**
 * Returns the JOptionPane Type depending on the Error-Level
 *
 * @return - JOptionPane Type
 */
protected int getJOptionType() {
	switch(this.errorLevel) {
		case ERROR_LEVEL_NOTICE:
			return JOptionPane.INFORMATION_MESSAGE;
		case ERROR_LEVEL_WARNING:
			return JOptionPane.WARNING_MESSAGE;
		case ERROR_LEVEL_ERROR:
			return JOptionPane.ERROR_MESSAGE;
		case ERROR_LEVEL_FATAL:
			return JOptionPane.ERROR_MESSAGE;
		case ERROR_LEVEL_INFO:
		default:
			return JOptionPane.INFORMATION_MESSAGE;
	}
}
 
開發者ID:Petschko,項目名稱:Java-RPG-Maker-MV-Decrypter,代碼行數:20,代碼來源:NotificationWindow.java

示例2: setUp

@Override
protected void setUp() throws Exception {
    LOG = Logger.getLogger("test." + getName());
    dd = new DialogDisplayerImpl (RESULT);
    closeOwner = new JButton ("Close this dialog");
    childDD = new DialogDescriptor ("Child", "Child", false, null);
    openChild = new JButton ("Open child");
    closeChild = new JButton ("Close child");
    pane = new JOptionPane ("", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {openChild, closeChild});
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:DialogDisplayerImplTest.java

示例3: popupMessage

@Override
public void popupMessage(String title, String message, boolean error)
{
	int type = JOptionPane.INFORMATION_MESSAGE;
	if( error )
	{
		type = JOptionPane.ERROR_MESSAGE;
	}

	JOptionPane.showMessageDialog(this, message, title, type);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:11,代碼來源:ProgressWindow.java

示例4: publish

public void publish(LogRecord logRecord)
{
    if (isLoggable(logRecord))
    {
        int type;
        String title;
        if (logRecord.getMessage().charAt(0) != '\b') {
            return;
        }

        int val = logRecord.getLevel().intValue();
        if (val >= Level.SEVERE.intValue())
        {
            title = "Error";
            type = JOptionPane.ERROR_MESSAGE;
        }
        else if (val >= Level.WARNING.intValue())
        {
            title = "Warning";
            type = JOptionPane.WARNING_MESSAGE;
        }
        else
        {
            title = "Note";
            type = JOptionPane.INFORMATION_MESSAGE;
        }

        String record = getFormatter().formatMessage(logRecord).replaceAll("[\b]","");
        if (record.contains("\n"))
            record = "<HTML>" + record.replace("\n", "<br>") + "</HTML>";

        // stay off FX or other problem threads
        final String msg = record;
        SwingUtilities.invokeLater(new Runnable() {
            @Override public void run() {
                JOptionPane.showMessageDialog(FocusManager.getCurrentManager().getActiveWindow(), msg, title, type);
            }
        });
    }
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:40,代碼來源:AppSetup.java

示例5: showMessageDialog

public static boolean showMessageDialog(
        final String message,
        final String title,
        final MessageType messageType) {
    initLAF();
    
    boolean exitInstaller = false;
    
    switch (UiMode.getCurrentUiMode()) {
        case SWING:
            int intMessageType = JOptionPane.INFORMATION_MESSAGE;                               
            
            LogManager.logIndent("... show message dialog");
            LogManager.log("title: "+ title);
            LogManager.log("message: " + message);
            
            if (messageType == MessageType.WARNING) {
                intMessageType = JOptionPane.WARNING_MESSAGE;                
            } else if (messageType == MessageType.CRITICAL) {
                intMessageType = JOptionPane.ERROR_MESSAGE;
                exitInstaller = true;
            }
            
            if (messageType == MessageType.ERROR) {                    
                int result = JOptionPane.showOptionDialog(null,
                                    message,
                                    title,
                                    JOptionPane.YES_NO_OPTION,
                                    JOptionPane.ERROR_MESSAGE,
                                    null,
                                    null,
                                    JOptionPane.YES_OPTION);
                if (result == JOptionPane.NO_OPTION) {
                    exitInstaller = true;
                    LogManager.logUnindent("... user selected: NO");                        
                } else {
                    LogManager.logUnindent("... user selected: YES");
                }
            } else {
                JOptionPane.showMessageDialog(null, 
                        message, 
                        title, 
                        intMessageType);
            }
            
            LogManager.logUnindent("... dialog closed");
            break;
        case SILENT:
            LogManager.log(message);
            System.err.println(message);
            break;
    }
    
    return exitInstaller;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:55,代碼來源:UiUtils.java

示例6: showNoteDialog

private static void showNoteDialog (String note) {
    Util.setDefaultLookAndFeel();
    JOptionPane p = new JOptionPane(new AutoUpgradePanel (null, note), JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION);
    JDialog d = Util.createJOptionDialog(p, NbBundle.getMessage (AutoUpgrade.class, "MSG_Note_Title"));
    d.setVisible (true);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:AutoUpgrade.java

示例7: setCallback

void setCallback(ConfirmationCallback callback)
    throws UnsupportedCallbackException
{
    this.callback = callback;

    int confirmationOptionType = callback.getOptionType();
    switch (confirmationOptionType) {
    case ConfirmationCallback.YES_NO_OPTION:
        optionType = JOptionPane.YES_NO_OPTION;
        translations = new int[] {
            JOptionPane.YES_OPTION, ConfirmationCallback.YES,
            JOptionPane.NO_OPTION, ConfirmationCallback.NO,
            JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO
        };
        break;
    case ConfirmationCallback.YES_NO_CANCEL_OPTION:
        optionType = JOptionPane.YES_NO_CANCEL_OPTION;
        translations = new int[] {
            JOptionPane.YES_OPTION, ConfirmationCallback.YES,
            JOptionPane.NO_OPTION, ConfirmationCallback.NO,
            JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL,
            JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
        };
        break;
    case ConfirmationCallback.OK_CANCEL_OPTION:
        optionType = JOptionPane.OK_CANCEL_OPTION;
        translations = new int[] {
            JOptionPane.OK_OPTION, ConfirmationCallback.OK,
            JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL,
            JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
        };
        break;
    case ConfirmationCallback.UNSPECIFIED_OPTION:
        options = callback.getOptions();
        /*
         * There's no way to know if the default option means
         * to cancel the login, but there isn't a better way
         * to guess this.
         */
        translations = new int[] {
            JOptionPane.CLOSED_OPTION, callback.getDefaultOption()
        };
        break;
    default:
        throw new UnsupportedCallbackException(
            callback,
            "Unrecognized option type: " + confirmationOptionType);
    }

    int confirmationMessageType = callback.getMessageType();
    switch (confirmationMessageType) {
    case ConfirmationCallback.WARNING:
        messageType = JOptionPane.WARNING_MESSAGE;
        break;
    case ConfirmationCallback.ERROR:
        messageType = JOptionPane.ERROR_MESSAGE;
        break;
    case ConfirmationCallback.INFORMATION:
        messageType = JOptionPane.INFORMATION_MESSAGE;
        break;
    default:
        throw new UnsupportedCallbackException(
            callback,
            "Unrecognized message type: " + confirmationMessageType);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:66,代碼來源:DialogCallbackHandler.java


注:本文中的javax.swing.JOptionPane.INFORMATION_MESSAGE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。