我想enum用作键和对象作为值.以下是示例代码段:
public class DistributorAuditSection implements Comparable<DistributorAuditSection>{
private Map questionComponentsMap;
public Map getQuestionComponentsMap(){
return questionComponentsMap;
}
public void setQuestionComponentsMap(Integer key, Object questionComponents){
if((questionComponentsMap == null) || (questionComponentsMap != null && questionComponentsMap.isEmpty())){
this.questionComponentsMap = new HashMap<Integer,Object>();
}
this.questionComponentsMap.put(key,questionComponents);
}
}
Run Code Online (Sandbox Code Playgroud)
它现在是一个普通的hashmap,带有整数键,对象作为值.现在我想把它改成Enummap.这样我就可以使用这些enum键.我也不知道如何使用检索值Enummap.
我正在创建一个扩展的类JPanel。我在该面板中使用添加了几个文本区域和下拉列表GridBagConstraints。现在我想使用键盘的 Tab 键将一个字段移动到另一个字段。我还想提一下,以前 Tab 键可以扩展文本区域。
这就是为什么我写下这句话:restuarantLocation.setTabSize(0);现在它停止了扩张。
但我不知道如何让 tab 键起作用?请帮忙。