本文整理匯總了Java中mulavito.gui.components.AbstractSearchField類的典型用法代碼示例。如果您正苦於以下問題:Java AbstractSearchField類的具體用法?Java AbstractSearchField怎麽用?Java AbstractSearchField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AbstractSearchField類屬於mulavito.gui.components包,在下文中一共展示了AbstractSearchField類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SearchFieldDemo
import mulavito.gui.components.AbstractSearchField; //導入依賴的package包/類
public SearchFieldDemo() {
super("MuLaViTo SearchBar Demo");
search = new AbstractSearchField() {
@Override
protected void search(Pattern pat) {
List<Integer> find = new ArrayList<Integer>();
for (int i = 0; i < list.getModel().getSize(); i++)
if (pat.matcher(list.getModel().getElementAt(i).toString())
.find())
find.add(i);
list.setSelectedIndices(toInt(find));
}
private int[] toInt(List<Integer> value) {
int[] ret = new int[value.size()];
for (int i = 0; i < value.size(); i++)
ret[i] = value.get(i);
return ret;
}
};
JToolBar toolbar = new JToolBar();
JButton btn = new JButton("About");
btn.setActionCommand("about");
btn.addActionListener(this);
toolbar.add(btn);
toolbar.add(Box.createHorizontalGlue());
toolbar.add(search);
getToolBarPane().add(toolbar);
}
示例2: SearchFieldDemo
import mulavito.gui.components.AbstractSearchField; //導入依賴的package包/類
public SearchFieldDemo() {
super("MuLaViTo SearchBar Demo");
search = new AbstractSearchField() {
@Override
protected void search(Pattern pat) {
List<Integer> find = new ArrayList<Integer>();
for (int i = 0; i < list.getModel().getSize(); i++)
if (pat.matcher(list.getModel().getElementAt(i).toString())
.find())
find.add(i);
list.setSelectedIndices(toInt(find));
}
private int[] toInt(List<Integer> value) {
int[] ret = new int[value.size()];
for (int i = 0; i < value.size(); i++)
ret[i] = value.get(i);
return ret;
}
};
JToolBar toolbar = new JToolBar();
JButton btn = new JButton("About");
btn.setActionCommand("about");
btn.addActionListener(this);
toolbar.add(btn);
toolbar.add(Box.createHorizontalGlue());
toolbar.add(search);
getToolBarPane().add(toolbar);
}