本文整理汇总了Java中chatty.gui.RegexDocumentFilter类的典型用法代码示例。如果您正苦于以下问题:Java RegexDocumentFilter类的具体用法?Java RegexDocumentFilter怎么用?Java RegexDocumentFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegexDocumentFilter类属于chatty.gui包,在下文中一共展示了RegexDocumentFilter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setKeyFilter
import chatty.gui.RegexDocumentFilter; //导入依赖的package包/类
public void setKeyFilter(String p) {
editor.setKeyFilter(new RegexDocumentFilter(p));
}
示例2: setValueFilter
import chatty.gui.RegexDocumentFilter; //导入依赖的package包/类
public void setValueFilter(String p) {
editor.setValueFilter(new RegexDocumentFilter(p));
}
示例3: DurationSetting
import chatty.gui.RegexDocumentFilter; //导入依赖的package包/类
public DurationSetting(int size, boolean editable) {
super(size);
setEditable(editable);
((AbstractDocument)getDocument()).setDocumentFilter(new RegexDocumentFilter("[^\\dms]+"));
}
示例4: MyEditor
import chatty.gui.RegexDocumentFilter; //导入依赖的package包/类
public MyEditor(JDialog owner) {
super(owner);
setModal(true);
setResizable(false);
// Action Listener
ActionListener listener = new ButtonListener();
ok.addActionListener(listener);
cancel.addActionListener(listener);
name.addActionListener(listener);
categories.addActionListener(listener);
// Document Listener
DocumentListener documentListener = new TextFieldListener();
name.getDocument().addDocumentListener(documentListener);
categories.getDocument().addDocumentListener(documentListener);
// Prevents any whitespace from being entered in the name field
((AbstractDocument)name.getDocument()).setDocumentFilter(new RegexDocumentFilter("\\s+"));
// Layout
setLayout(new GridBagLayout());
GridBagConstraints gbc;
JLabel nameLabel = new JLabel("Name: ");
JLabel categoriesLabel = new JLabel("Categories: ");
nameLabel.setLabelFor(name);
gbc = makeGbc(0, 1, 1, 1, GridBagConstraints.EAST);
add(nameLabel, gbc);
gbc = makeGbc(1, 1, 2, 1, GridBagConstraints.CENTER);
add(name, gbc);
gbc = makeGbc(0, 2, 1, 1, GridBagConstraints.EAST);
add(categoriesLabel, gbc);
gbc = makeGbc(1,2, 2, 1, GridBagConstraints.CENTER);
add(categories, gbc);
gbc = makeGbc(1, 3, 1, 1, GridBagConstraints.CENTER);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 0.5;
add(ok, gbc);
gbc = makeGbc(2, 3, 1, 1, GridBagConstraints.CENTER);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 0.5;
add(cancel, gbc);
pack();
}