|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.util.ResourceBundle
java.util.ListResourceBundle
public abstract class ListResourceBundle
ListResourceBundle 是 ResourceBundle 的一個抽象類別,用於管理方便而又易於使用的列表中的語言環境資源。有關資源套件的常規資訊,請參閱 ResourceBundle。
子類別必須覆寫 getContents 並提供一個陣列,其中陣列中的每個項都是一個物件對。每對的第一個元素是鍵,該鍵必須是一個 String,並且第二個元素是和該鍵相關聯的值。
下面的範例顯示了具有基本名稱 "MyResources" 的資源包系列的兩個成員。"MyResources" 是資源包系列的預設成員,"MyResources_fr" 是 French 成員。這些成員是基於 ListResourceBundle(一個相關的範例顯示了如何把一個資源包添加到基於屬性檔案的此系列)。此範例中的鍵形式為 "s1" 等。實際的鍵完全取決於您的選擇,只要它們和程序中用於從資源包中獲取物件的鍵相同。鍵區分大小寫。
public class MyResources extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] = {
// LOCALIZE THIS
{"s1", "The disk \"{1}\" contains {0}."}, // MessageFormat pattern
{"s2", "1"}, // location of {0} in pattern
{"s3", "My Disk"}, // sample disk name
{"s4", "no files"}, // first ChoiceFormat choice
{"s5", "one file"}, // second ChoiceFormat choice
{"s6", "{0,number} files"}, // third ChoiceFormat choice
{"s7", "3 Mar 96"}, // sample date
{"s8", new Dimension(1,5)} // real object, not just string
// END OF MATERIAL TO LOCALIZE
};
}
}
public class MyResources_fr extends ListResourceBundle {
protected Object[][] getContents() {
return new Object[][] = {
// LOCALIZE THIS
{"s1", "Le disque \"{1}\" {0}."}, // MessageFormat pattern
{"s2", "1"}, // location of {0} in pattern
{"s3", "Mon disque"}, // sample disk name
{"s4", "ne contient pas de fichiers"}, // first ChoiceFormat choice
{"s5", "contient un fichier"}, // second ChoiceFormat choice
{"s6", "contient {0,number} fichiers"}, // third ChoiceFormat choice
{"s7", "3 mars 1996"}, // sample date
{"s8", new Dimension(1,3)} // real object, not just string
// END OF MATERIAL TO LOCALIZE
};
}
}
ResourceBundle,
PropertyResourceBundle| 巢狀類別摘要 |
|---|
| 從類別 java.util.ResourceBundle 繼承的巢狀類別/介面 |
|---|
ResourceBundle.Control |
| 欄位摘要 |
|---|
| 從類別 java.util.ResourceBundle 繼承的欄位 |
|---|
parent |
| 建構子摘要 | |
|---|---|
ListResourceBundle()
單獨的建構子。 |
|
| 方法摘要 | |
|---|---|
protected abstract Object[][] |
getContents()
返回一個陣列,其中 Object 陣列中的每個項都是一個物件對。 |
Enumeration<String> |
getKeys()
返回包含在此 ResourceBundle 及其父包中的鍵的 Enumeration。 |
Object |
handleGetObject(String key)
從此資源包中獲取給定鍵的物件。 |
protected Set<String> |
handleKeySet()
返回只 套件含在此 ResourceBundle 中的鍵的 Set。 |
| 從類別 java.util.ResourceBundle 繼承的方法 |
|---|
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, keySet, setParent |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public ListResourceBundle()
| 方法詳細資訊 |
|---|
public final Object handleGetObject(String key)
ResourceBundle 複製的描述
ResourceBundle 中的 handleGetObjectkey - 所需物件的鍵
public Enumeration<String> getKeys()
ResourceBundle 及其父包中的鍵的 Enumeration。
ResourceBundle 中的 getKeysResourceBundle 及其父包中的鍵的 Enumeration。ResourceBundle.keySet()protected Set<String> handleKeySet()
ResourceBundle 中的鍵的 Set。
ResourceBundle 中的 handleKeySetResourceBundle 中的鍵的 SetResourceBundle.keySet()protected abstract Object[][] getContents()
Object 陣列中的每個項都是一個物件對。每對的第一個元素是鍵,它必須是 String,第二個元素是與該鍵關聯的值。有關詳細資訊,請參閱類別描述。
Object 陣列
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。