本文整理匯總了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);
}