本文整理汇总了Java中java.util.Dictionary.keys方法的典型用法代码示例。如果您正苦于以下问题:Java Dictionary.keys方法的具体用法?Java Dictionary.keys怎么用?Java Dictionary.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Dictionary
的用法示例。
在下文中一共展示了Dictionary.keys方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHighestValue
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns the biggest value that has an entry in the label table.
*
* @return biggest value that has an entry in the label table, or
* null.
* @since 1.6
*/
protected Integer getHighestValue() {
@SuppressWarnings("rawtypes")
Dictionary dictionary = slider.getLabelTable();
if (dictionary == null) {
return null;
}
Enumeration<?> keys = dictionary.keys();
Integer max = null;
while (keys.hasMoreElements()) {
Integer i = (Integer) keys.nextElement();
if (max == null || i > max) {
max = i;
}
}
return max;
}
示例2: addSuffixToSliderLabels
import java.util.Dictionary; //导入方法依赖的package包/类
public static void addSuffixToSliderLabels(JSlider slider, String suffix) {
assert (slider != null && suffix != null);
Dictionary oldLabels = slider.getLabelTable();
Enumeration oldKeys = oldLabels.keys();
Hashtable newLabelTable = new Hashtable();
while (oldKeys.hasMoreElements()) {
Object key = oldKeys.nextElement();
Object value = oldLabels.get(key);
assert (value instanceof String);
String str = ((String)value).concat(suffix);
JLabel label = new JLabel(str);
newLabelTable.put(key, label);
}
slider.setLabelTable(newLabelTable);
}
示例3: equals
import java.util.Dictionary; //导入方法依赖的package包/类
private boolean equals(Dictionary<String, ?> d1, Dictionary<String, ?> d2) {
if (d1 == d2) {
return true;
} else if (d1 == null ^ d2 == null) {
return false;
} else if (d1.size() != d2.size()) {
return false;
} else {
for (Enumeration<String> e1 = d1.keys(); e1.hasMoreElements();) {
String key = e1.nextElement();
Object v1 = d1.get(key);
Object v2 = d2.get(key);
if (v1 != v2 && (v2 == null || !v2.equals(v1))) {
return false;
}
}
return true;
}
}
示例4: sendHeaders
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* send the headers for the given connection based on the given Dictionary of headers
* @param connection
* @param headers
*/
private void sendHeaders( URLConnection connection, Dictionary headers ) {
boolean sendReferer = getClientProperties().isSendReferer();
for (Enumeration e = headers.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
if ( sendReferer || !"referer".equalsIgnoreCase( key ) ) {
connection.setRequestProperty( key, (String) headers.get( key ) );
if (HttpUnitOptions.isLoggingHttpHeaders()) {
if (key.equalsIgnoreCase( "authorization" ) || key.equalsIgnoreCase( "proxy-authorization") ) {
System.out.println( "Sending:: " + key + ": " + headers.get( key ) );
} else {
System.out.println( "Sending:: " + key + ": " + connection.getRequestProperty( key ) );
}
}
} else if (HttpUnitOptions.isLoggingHttpHeaders()) {
System.out.println( "Blocked sending referer:: "+ connection.getRequestProperty( key ) );
}
} // for
}
示例5: loadExistingValues
import java.util.Dictionary; //导入方法依赖的package包/类
private void loadExistingValues(String componentName) {
try {
Configuration cfg = cfgAdmin.getConfiguration(componentName, null);
Map<String, ConfigProperty> map = properties.get(componentName);
Dictionary<String, Object> props = cfg.getProperties();
if (props != null) {
Enumeration<String> it = props.keys();
while (it.hasMoreElements()) {
String name = it.nextElement();
ConfigProperty p = map.get(name);
if (p != null) {
map.put(name, ConfigProperty.setProperty(p, (String) props.get(name)));
}
}
}
} catch (IOException e) {
log.error("Unable to get configuration for " + componentName, e);
}
}
示例6: getLowestValue
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns the smallest value that has an entry in the label table.
*
* @return smallest value that has an entry in the label table, or
* null.
* @since 1.6
*/
protected Integer getLowestValue() {
Dictionary dictionary = slider.getLabelTable();
if (dictionary == null) {
return null;
}
Enumeration keys = dictionary.keys();
Integer min = null;
while (keys.hasMoreElements()) {
Integer i = (Integer) keys.nextElement();
if (min == null || i < min) {
min = i;
}
}
return min;
}
示例7: getHighestValue
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns the biggest value that has an entry in the label table.
*
* @return biggest value that has an entry in the label table, or
* null.
* @since 1.6
*/
protected Integer getHighestValue() {
Dictionary dictionary = slider.getLabelTable();
if (dictionary == null) {
return null;
}
Enumeration keys = dictionary.keys();
Integer max = null;
while (keys.hasMoreElements()) {
Integer i = (Integer) keys.nextElement();
if (max == null || i > max) {
max = i;
}
}
return max;
}
示例8: LazyPropertyMap
import java.util.Dictionary; //导入方法依赖的package包/类
protected LazyPropertyMap(Dictionary dict) {
super(5);
Enumeration en = dict.keys();
while (en.hasMoreElements()) {
Object key = en.nextElement();
super.put(key, dict.get(key));
}
}
示例9: GenerateTermFrequency
import java.util.Dictionary; //导入方法依赖的package包/类
private void GenerateTermFrequency()
{
for(int i=0; i < _numDocs ; i++)
{
String curDoc=_docs[i];
Dictionary freq=GetWordFrequency(curDoc);
Enumeration enums=freq.keys();
while(enums.hasMoreElements()){
String word=(String) enums.nextElement();
int wordFreq=(Integer)freq.get(word);
int termIndex=GetTermIndex(word);
if(termIndex == -1)
continue;
_termFreq [termIndex][i]=wordFreq;
_docFreq[termIndex] ++;
if (wordFreq > _maxTermFreq[i]) _maxTermFreq[i]=wordFreq;
}
//DictionaryEnumerator enums=freq.GetEnumerator() ;
_maxTermFreq[i]=Integer.MIN_VALUE ;
/*freq.elements()
Object ele=null;
while ((ele=enums.nextElement())!=null)
{
String word=(String)ele.
int wordFreq=(int)enums.Value ;
int termIndex=GetTermIndex(word);
if(termIndex == -1)
continue;
_termFreq [termIndex][i]=wordFre/q;
_docFreq[termIndex] ++;
if (wordFreq > _maxTermFreq[i]) _maxTermFreq[i]=wordFreq;
}*/
}
}
示例10: asMap
import java.util.Dictionary; //导入方法依赖的package包/类
private Map<String, Object> asMap(Dictionary<String, ?> dict) {
Map<String, Object> map = new HashMap<String, Object>(); // NOSONAR
for (Enumeration<String> e = dict.keys(); e.hasMoreElements();) {
String key = e.nextElement();
map.put(key, dict.get(key));
}
return map;
}
示例11: getMinSliderValue
import java.util.Dictionary; //导入方法依赖的package包/类
private static Integer getMinSliderValue(JSlider slider) {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int min = slider.getMaximum() + 1;
while (keys.hasMoreElements()) {
min = Math.min(min, ((Integer)keys.nextElement()).intValue());
}
if (min == slider.getMaximum() + 1) {
return null;
}
return new Integer(min);
}
return null;
}
示例12: reapplyFontSize
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Apply the font size to the labels of a slider. This must be called after
* the labels of a slider are changed.
*
* First set up the label hash table and add it to the slider. Then, after
* the slider has been added to a parent window and had its UI assigned,
* call this method to change the label sizes.
*
* http://nadeausoftware.com/node/93#Settingsliderlabelfontsizes
*
* @param slider
*/
public static void reapplyFontSize(JSlider slider) {
Font font = slider.getFont();
Dictionary dict = slider.getLabelTable();
Enumeration keys = dict.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Component label = (Component) dict.get(key);
label.setFont(font);
label.setSize(label.getPreferredSize());
}
}
示例13: putAll
import java.util.Dictionary; //导入方法依赖的package包/类
public <T extends K> void putAll(Dictionary<T, ? extends V> dictionary) {
if (dictionary != null)
// copy the dictionary
for (Enumeration<T> enm = dictionary.keys(); enm.hasMoreElements();) {
T key = enm.nextElement();
map.put(key, dictionary.get(key));
}
}
示例14: getWidthOfWidestLabel
import java.util.Dictionary; //导入方法依赖的package包/类
protected int getWidthOfWidestLabel() {
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if ( dictionary != null ) {
Enumeration keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
widest = Math.max( label.getPreferredSize().width, widest );
}
}
return widest;
}
示例15: getWidthOfWidestLabel
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns the width of the widest label.
* @return the width of the widest label
*/
protected int getWidthOfWidestLabel() {
@SuppressWarnings("rawtypes")
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if ( dictionary != null ) {
Enumeration<?> keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
widest = Math.max( label.getPreferredSize().width, widest );
}
}
return widest;
}