⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i18noptionpane.java

📁 iReport-0.4.1-src是iReport的源代码,iReport是一个开源的报表项目,可以生成PDF等格式报表
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
					options[i] = it.businesslogic.ireport.util.I18n.getString(optionsCID[i], optionsCID[i]);
				}
			}
		}
									   	
		return JOptionPane.showInternalOptionDialog(parentComponent, message, title, optionType, messageType, icon, options, initialValue);			   	
	}

	/**
	 * Shows an internal question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed in the Component's frame, and is usually positioned below the Component. 
	 * @param parentComponent determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
	 * @param messageCID message country identification for a message to be displayed.
	 * @return
	 */
	public static String showInternalInputDialog(Component parentComponent, String messageCID){
		
		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		return JOptionPane.showInternalInputDialog(parentComponent, message);
	}

	/**
	 * Prompts the user for input in a blocking internal dialog where the initial selection, possible selections, and all other options can be specified. The user will able to choose from selectionValues, where null implies the user can input whatever they wish, usually by means of a JTextField. initialSelectionValue is the initial value to prompt the user with. It is up to the UI to decide how best to represent the selectionValues, but usually a JComboBox, JList, or JTextField will be used.  
	 * @param parentComponent the parent Component for the dialog
	 * @param messageCID message country identification for a message to be displayed.
	 * @param titleCID message country identification for the String to display in the dialog title bar
	 * @param messageType the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
	 * @param icon the Icon image to display
	 * @param selectionCIDValues  message country identifications for an array of strings that gives the possible selections
	 * @param initialSelectionCIDValue message country identification for the value used to initialize the input field.
	 * @return
	 */
	public static String showInternalInputDialog(Component parentComponent,
										 String messageCID,
										 String titleCID,
										 int messageType,
										 Icon icon,
										 String[] selectionCIDValues,
										 String initialSelectionCIDValue)
	{
		
		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		String title = titleCID;
		if(titleCID != null){
			title = it.businesslogic.ireport.util.I18n.getString(titleCID, titleCID);
		}

		String initialSelectionValue = initialSelectionCIDValue;
		if(initialSelectionCIDValue != null){
			initialSelectionValue = it.businesslogic.ireport.util.I18n.getString(initialSelectionCIDValue, initialSelectionCIDValue);
		}

		String[] selectionValues = selectionCIDValues;
		if(selectionCIDValues != null){
			for(int i = 0; i < selectionCIDValues.length; i++){
				if (selectionCIDValues[i] != null){
					selectionValues[i] = it.businesslogic.ireport.util.I18n.getString(selectionCIDValues[i], selectionCIDValues[i]);
				}
			}
		}

		return (String) JOptionPane.showInternalInputDialog(parentComponent, message, title, messageType, icon, selectionValues, initialSelectionValue);
	}

	/**
	 * Brings up an information-message dialog titled with the message associated with the Country ID resource bundle. 
	 * 
	 * @param parentComponent determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
	 * @param messageCID message country identification for a message to be displayed.
	 */
	public static void showMessageDialog(Component parentComponent, String messageCID){
		
		String message = messageCID;
		
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		JOptionPane.showMessageDialog(parentComponent, message);
	}

	/**
	 * Shows an internal dialog requesting input from the user parented to parentComponent with the dialog having the title title and message type messageType.    
	 * @param parentComponent the parent Component for the dialog
	 * @param messageCID message country identification for a message to be displayed.
	 * @param titleCID message country identification for the String to display in the dialog title bar
	 * @param messageType the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
	 * @return
	 */
	public static String showInternalInputDialog(Component parentComponent, String messageCID, String titleCID, int messageType){

		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		String title = titleCID;
		if(titleCID != null){
			title = it.businesslogic.ireport.util.I18n.getString(titleCID, titleCID);
		}

		return JOptionPane.showInternalInputDialog(parentComponent, message, title, messageType);
	}


	/**
	 * Brings up a dialog that displays a message using a default icon determined by the messageType parameter. 
	 * @param parentComponent the parent Component for the dialog
	 * @param messageCID message country identification for a message to be displayed.
	 * @param titleCID message country identification for the String to display in the dialog title bar
	 * @param messageType the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
	 */
	public static void showMessageDialog(Component parentComponent, String messageCID, String titleCID, int messageType){
		
		String message = messageCID;
		
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		String title = titleCID;
		if(titleCID != null){
			title = it.businesslogic.ireport.util.I18n.getString(titleCID, titleCID);
		}

		JOptionPane.showMessageDialog(parentComponent, message, title, messageType);
	}

	/**
	 * Brings up a dialog displaying a message, specifying all parameters. 
	 * @param parentComponent the parent Component for the dialog
	 * @param messageCID message country identification for a message to be displayed.
	 * @param titleCID message country identification for the String to display in the dialog title bar
	 * @param messageType the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
	 * @param icon the icon to display in the dialog
	 */
	public static void showMessageDialog(Component parentComponent, String messageCID, String titleCID, int messageType, Icon icon){
		
		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		String title = titleCID;
		if(titleCID != null){
			title = it.businesslogic.ireport.util.I18n.getString(titleCID, titleCID);
		}

		JOptionPane.showMessageDialog(parentComponent, message, title, messageType, icon);
	}


	/**
	 * Brings up a dialog with the options Yes, No and Cancel; with the title, Select an Option.  
	 * @param parentComponent determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
	 * @param messageCID message country identification for a message to be displayed.
	 */
	public static int showConfirmDialog(Component parentComponent,
										String messageCID)
	{

		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		return JOptionPane.showConfirmDialog(parentComponent, message);
	}

	/**
	 * Brings up a dialog where the number of choices is determined by the optionType parameter.   
	 * @param parentComponent determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
	 * @param messageCID message country identification for a message to be displayed.
	 * @param titleCID message country identification for the String to display in the dialog title bar
	 * @param optionType an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION  
	 */
	public static int showConfirmDialog(Component parentComponent,
										String messageCID, String titleCID,
										int optionType)
	{

		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		String title = titleCID;
		if(titleCID != null){
			title = it.businesslogic.ireport.util.I18n.getString(titleCID, titleCID);
		}

		return JOptionPane.showConfirmDialog(parentComponent, message, title, optionType);
	}

	/**
	 * Brings up a dialog where the number of choices is determined by the optionType parameter, where the messageType parameter determines the icon to display. The messageType parameter is primarily used to supply a default icon from the Look and Feel.   
	 * @param parentComponent determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
	 * @param messageCID message country identification for a message to be displayed.
	 * @param titleCID message country identification for the String to display in the dialog title bar
	 * @param optionType an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION  
	 * @param messageType an integer designating the kind of message this is, primarily used to determine the icon from the pluggable Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
	 */
	public static int showConfirmDialog(Component parentComponent,
										String messageCID, String titleCID,
										int optionType, int messageType)
	{

		String message = messageCID;
		if(messageCID != null){
			message = it.businesslogic.ireport.util.I18n.getString(messageCID, messageCID);
		}
		
		String title = titleCID;
		if(titleCID != null){
			title = it.businesslogic.ireport.util.I18n.getString(titleCID, titleCID);
		}

		return JOptionPane.showConfirmDialog(parentComponent, message, title, optionType, messageType);
	}

	/**
	 * Brings up a dialog with a specified icon, where the number of choices is determined by the optionType parameter. The messageType parameter is primarily used to supply a default icon from the look and feel.    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -