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

📄 bundles.java

📁 一个基于eclipse插件开发的聊天程序
💻 JAVA
字号:
package talkServer.business;import java.text.MessageFormat;import java.util.MissingResourceException;import java.util.ResourceBundle;public class Bundles {	// bundles in the application	private static ResourceBundle maps_resourceBundle = ResourceBundle.getBundle("maps");	public static ResourceBundle getMaps_resourceBundle() {		return maps_resourceBundle;	}	public static void setMaps_resourceBundle(ResourceBundle maps_resourceBundle) {		Bundles.maps_resourceBundle = maps_resourceBundle;	}	private Bundles() {    }    /**	 * Gets a string from the resource bundle.	 * We don't want to crash because of a missing String.	 * Returns the key if not found.	 */	public static String getResourceString(String key,ResourceBundle resourceBundle) {		try {			return resourceBundle.getString(key);		} catch (MissingResourceException e) {			return key;		} catch (NullPointerException e) {			return "!" + key + "!";		}				}//	public static String[] getResourceStringArray(String key, ResourceBundle resourceBundle) {//		try {//			return resourceBundle.getStringArray(key);//		} catch (MissingResourceException e) {//			return null;//		} catch (NullPointerException e) {//			return null;//		}			//	}	/**	 * Gets a string from the resource bundle and binds it	 * with the given arguments. If the key is not found,	 * return the key.	 */	public static String getResourceString(String key, Object[] args, ResourceBundle resourceBundle) {		try {			return MessageFormat.format(getResourceString(key,resourceBundle), args);		} catch (MissingResourceException e) {			return key;		} catch (NullPointerException e) {			return "!" + key + "!";		}	}}

⌨️ 快捷键说明

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