Java Code Examples for javax.swing.JRootPane#ERROR_DIALOG

The following examples show how to use javax.swing.JRootPane#ERROR_DIALOG . 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: StartupDialog.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static int styleFromMessageType(int messageType) {
    switch (messageType) {
    case JOptionPane.ERROR_MESSAGE:
        return JRootPane.ERROR_DIALOG;
    case JOptionPane.QUESTION_MESSAGE:
        return JRootPane.QUESTION_DIALOG;
    case JOptionPane.WARNING_MESSAGE:
        return JRootPane.WARNING_DIALOG;
    case JOptionPane.INFORMATION_MESSAGE:
        return JRootPane.INFORMATION_DIALOG;
    case JOptionPane.PLAIN_MESSAGE:
    default:
        return JRootPane.PLAIN_DIALOG;
    }
}
 
Example 2
Source File: POptionPane.java    From PolyGlot with MIT License 5 votes vote down vote up
private static int internalStyleFromMessageType(int messageType) {
    switch (messageType) {
        case ERROR_MESSAGE:
            return JRootPane.ERROR_DIALOG;
        case QUESTION_MESSAGE:
            return JRootPane.QUESTION_DIALOG;
        case WARNING_MESSAGE:
            return JRootPane.WARNING_DIALOG;
        case INFORMATION_MESSAGE:
            return JRootPane.INFORMATION_DIALOG;
        case PLAIN_MESSAGE:
        default:
            return JRootPane.PLAIN_DIALOG;
    }
}
 
Example 3
Source File: BETitlePane.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
/**
	 * Adds any sub-Components contained in the <code>MetalTitlePane</code>.
	 */
	private void installSubcomponents()
	{
		int decorationStyle = getWindowDecorationStyle();
		
		if (decorationStyle == JRootPane.FRAME||decorationStyle == JRootPane.PLAIN_DIALOG)
		{
			createActions();
			menuBar = createMenuBar();
			add(menuBar);
			createButtons();
			
			add(closeButton);
			
			//~* RootPane.setupButtonVisible是jb2011自定义的属性哦,目的是控制这个当前用于演示的设置按钮的可见性
			Object isSetupButtonVisibleObj = UIManager.get("RootPane.setupButtonVisible");
			//如果开发者没有设置此属性则默认认为是true(即显示该按钮)
			boolean isSetupButtonVisible = (isSetupButtonVisibleObj==null?true:(Boolean)isSetupButtonVisibleObj);
			if(isSetupButtonVisible)
				//加入设置按钮
				add(setupButton);
			
			if(decorationStyle!=JRootPane.PLAIN_DIALOG)//!
			{
				add(iconifyButton);
				add(toggleButton);
				menuBar.setEnabled(false);
			}
		}
		else if 
		(
//				decorationStyle == JRootPane.PLAIN_DIALOG
//				||
				decorationStyle == JRootPane.INFORMATION_DIALOG
				|| decorationStyle == JRootPane.ERROR_DIALOG
				|| decorationStyle == JRootPane.COLOR_CHOOSER_DIALOG
				|| decorationStyle == JRootPane.FILE_CHOOSER_DIALOG
				|| decorationStyle == JRootPane.QUESTION_DIALOG
				|| decorationStyle == JRootPane.WARNING_DIALOG)
		{
			createActions();
			createButtons();
			add(closeButton);
		}
	}
 
Example 4
Source File: BETitlePane.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
/**
 * Determines the Colors to draw with.
 */
private void determineColors()
{
	switch (getWindowDecorationStyle())
	{
		case JRootPane.FRAME:
			activeBackground = UIManager.getColor("activeCaption");
			activeForeground = UIManager.getColor("activeCaptionText");
			activeShadow = UIManager.getColor("activeCaptionBorder");
			break;
		case JRootPane.ERROR_DIALOG:
			activeBackground = UIManager
					.getColor("OptionPane.errorDialog.titlePane.background");
			activeForeground = UIManager
					.getColor("OptionPane.errorDialog.titlePane.foreground");
			activeShadow = UIManager
					.getColor("OptionPane.errorDialog.titlePane.shadow");
			break;
		case JRootPane.QUESTION_DIALOG:
		case JRootPane.COLOR_CHOOSER_DIALOG:
		case JRootPane.FILE_CHOOSER_DIALOG:
			activeBackground = UIManager
					.getColor("OptionPane.questionDialog.titlePane.background");
			activeForeground = UIManager
					.getColor("OptionPane.questionDialog.titlePane.foreground");
			activeShadow = UIManager
					.getColor("OptionPane.questionDialog.titlePane.shadow");
			break;
		case JRootPane.WARNING_DIALOG:
			activeBackground = UIManager
					.getColor("OptionPane.warningDialog.titlePane.background");
			activeForeground = UIManager
					.getColor("OptionPane.warningDialog.titlePane.foreground");
			activeShadow = UIManager
					.getColor("OptionPane.warningDialog.titlePane.shadow");
			break;
		case JRootPane.PLAIN_DIALOG:
		case JRootPane.INFORMATION_DIALOG:
		default:
			activeBackground = UIManager.getColor("activeCaption");
			activeForeground = UIManager.getColor("activeCaptionText");
			activeShadow = UIManager.getColor("activeCaptionBorder");
			break;
	}
}