本文整理汇总了Java中java.util.Dictionary.elements方法的典型用法代码示例。如果您正苦于以下问题:Java Dictionary.elements方法的具体用法?Java Dictionary.elements怎么用?Java Dictionary.elements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Dictionary
的用法示例。
在下文中一共展示了Dictionary.elements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testValues
import java.util.Dictionary; //导入方法依赖的package包/类
public void testValues() throws Exception {
Dictionary dict = new Properties();
dict.put("joe", "satriani");
MapBasedDictionary wrapper = new MapBasedDictionary();
wrapper.putAll(dict);
Enumeration enm1 = dict.elements();
Enumeration enm2 = wrapper.elements();
while (enm1.hasMoreElements()) {
assertTrue(enm2.hasMoreElements());
assertEquals(enm1.nextElement(), enm2.nextElement());
}
}
示例2: labelsHaveSameBaselines
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns true if all the labels from the label table have the same
* baseline.
*
* @return true if all the labels from the label table have the
* same baseline
* @since 1.6
*/
protected boolean labelsHaveSameBaselines() {
if (!checkedLabelBaselines) {
checkedLabelBaselines = true;
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
sameLabelBaselines = true;
Enumeration elements = dictionary.elements();
int baseline = -1;
while (elements.hasMoreElements()) {
JComponent label = (JComponent) elements.nextElement();
Dimension pref = label.getPreferredSize();
int labelBaseline = label.getBaseline(pref.width,
pref.height);
if (labelBaseline >= 0) {
if (baseline == -1) {
baseline = labelBaseline;
}
else if (baseline != labelBaseline) {
sameLabelBaselines = false;
break;
}
}
else {
sameLabelBaselines = false;
break;
}
}
}
else {
sameLabelBaselines = false;
}
}
return sameLabelBaselines;
}
示例3: labelsHaveSameBaselines
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns true if all the labels from the label table have the same
* baseline.
*
* @return true if all the labels from the label table have the
* same baseline
* @since 1.6
*/
protected boolean labelsHaveSameBaselines() {
if (!checkedLabelBaselines) {
checkedLabelBaselines = true;
@SuppressWarnings("rawtypes")
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
sameLabelBaselines = true;
Enumeration<?> elements = dictionary.elements();
int baseline = -1;
while (elements.hasMoreElements()) {
JComponent label = (JComponent) elements.nextElement();
Dimension pref = label.getPreferredSize();
int labelBaseline = label.getBaseline(pref.width,
pref.height);
if (labelBaseline >= 0) {
if (baseline == -1) {
baseline = labelBaseline;
}
else if (baseline != labelBaseline) {
sameLabelBaselines = false;
break;
}
}
else {
sameLabelBaselines = false;
break;
}
}
}
else {
sameLabelBaselines = false;
}
}
return sameLabelBaselines;
}