本文整理汇总了Java中javax.swing.JTabbedPane.indexOfTab方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.indexOfTab方法的具体用法?Java JTabbedPane.indexOfTab怎么用?Java JTabbedPane.indexOfTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.indexOfTab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePanel
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void handlePanel(FileObject keywordsFO) {
String location = keywordsFO.getAttribute("location").toString(); //NOI18N
String tabTitle = keywordsFO.getAttribute("tabTitle").toString(); //NOI18N
JTabbedPane pane = categoryid2tabbedpane.get(location);
int tabIndex = pane == null ? -1 : pane.indexOfTab(tabTitle);
Set<String> keywords = new HashSet<String>();
keywords.add(location.toUpperCase());
keywords.add(tabTitle.toUpperCase());
Enumeration<String> attributes = keywordsFO.getAttributes();
while(attributes.hasMoreElements()) {
String attribute = attributes.nextElement();
if(attribute.startsWith("keywords")) {
String word = keywordsFO.getAttribute(attribute).toString();
keywords.add(word.toUpperCase());
}
}
ArrayList<String> words = categoryid2words.get(location);
if (words == null) {
words = new ArrayList<String>();
}
Set<String> newWords = new HashSet<String>();
for (String keyword : keywords) {
if (!words.contains(keyword)) {
newWords.add(keyword);
}
}
words.addAll(newWords);
categoryid2words.put(location, words);
if (!categoryid2tabs.containsKey(location)) {
categoryid2tabs.put(location, new HashMap<Integer, TabInfo>());
}
HashMap<Integer, TabInfo> categoryTabs = categoryid2tabs.get(location);
TabInfo tabInfo;
if (!categoryTabs.containsKey(tabIndex)) {
tabInfo = new TabInfo();
} else {
tabInfo = categoryTabs.get(tabIndex);
}
tabInfo.addWords(keywords);
categoryTabs.put(tabIndex, tabInfo);
categoryid2tabs.put(location, categoryTabs);
}