当前位置: 首页>>代码示例>>Java>>正文


Java DefaultStyledDocument.setDocumentFilter方法代码示例

本文整理汇总了Java中javax.swing.text.DefaultStyledDocument.setDocumentFilter方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultStyledDocument.setDocumentFilter方法的具体用法?Java DefaultStyledDocument.setDocumentFilter怎么用?Java DefaultStyledDocument.setDocumentFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.DefaultStyledDocument的用法示例。


在下文中一共展示了DefaultStyledDocument.setDocumentFilter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newPassword

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
/**
 * @return A new "Password" text field
 */
public static JPasswordField newPassword() {

    JPasswordField passwordField = new JPasswordField(BitherUI.PASSWORD_LENGTH);

    // Ensure it is accessible
    AccessibilityDecorator.apply(passwordField, MessageKey.ENTER_PASSWORD);

    // Provide a consistent echo character across all components
    passwordField.setEchoChar(getPasswordEchoChar());

    // Limit the length of the underlying document
    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new DocumentMaxLengthFilter(BitherUI.PASSWORD_LENGTH));
    passwordField.setDocument(doc);

    // Set the theme
    passwordField.setBorder(new TextBubbleBorder(Themes.currentTheme.dataEntryBorder()));
    passwordField.setBackground(Themes.currentTheme.dataEntryBackground());

    passwordField.setOpaque(false);

    return passwordField;
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:27,代码来源:TextBoxes.java

示例2: newEnterTransactionLabel

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
/**
 * @return A new "enter transaction label" text field
 */
public static JTextField newEnterTransactionLabel() {

    JTextField textField = newTextField(BitherUI.RECEIVE_ADDRESS_LABEL_LENGTH);

    // Ensure it is accessible
    AccessibilityDecorator.apply(textField, MessageKey.TRANSACTION_LABEL, MessageKey.TRANSACTION_LABEL_TOOLTIP);

    // Limit the length of the underlying document
    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new DocumentMaxLengthFilter(BitherUI.RECEIVE_ADDRESS_LABEL_LENGTH));
    textField.setDocument(doc);

    return textField;
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:18,代码来源:TextBoxes.java

示例3: newEnterQRCodeLabel

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
/**
 * @return A new "enter QR code label" text field
 */
public static JTextField newEnterQRCodeLabel() {

    JTextField textField = newTextField(BitherUI.RECEIVE_ADDRESS_LABEL_LENGTH);

    // Ensure it is accessible
    AccessibilityDecorator.apply(textField, MessageKey.QR_CODE_LABEL, MessageKey.QR_CODE_LABEL_TOOLTIP);

    // Limit the length of the underlying document
    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new DocumentMaxLengthFilter(BitherUI.RECEIVE_ADDRESS_LABEL_LENGTH));
    textField.setDocument(doc);

    return textField;
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:18,代码来源:TextBoxes.java

示例4: newEnterPrivateNotes

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
/**
 * @param listener The document listener for detecting changes to the content
 * @return A new "Notes" text area
 */
public static JTextArea newEnterPrivateNotes(DocumentListener listener, int width) {

    JTextArea textArea = new JTextArea(6, width);

    // Ensure it is accessible
    AccessibilityDecorator.apply(textArea, MessageKey.PRIVATE_NOTES, MessageKey.PRIVATE_NOTES_TOOLTIP);

    // Limit the length of the underlying document
    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new DocumentMaxLengthFilter(BitherUI.SEED_PHRASE_LENGTH));
    textArea.setDocument(doc);

    // Ensure we monitor changes
    doc.addDocumentListener(listener);

    // Ensure line wrapping occurs correctly
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);

    // Ensure TAB transfers focus
    AbstractAction transferFocus = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            ((Component) e.getSource()).transferFocus();
        }
    };
    textArea.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "transferFocus");
    textArea.getActionMap().put("transferFocus", transferFocus);

    // Set the theme
    textArea.setBorder(new TextBubbleBorder(Themes.currentTheme.dataEntryBorder()));
    textArea.setBackground(Themes.currentTheme.dataEntryBackground());

    textArea.setOpaque(false);

    return textArea;
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:41,代码来源:TextBoxes.java

示例5: newEnterSeedPhrase

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
/**
 * @return A new "seed phrase" text area for entry
 */
public static JTextArea newEnterSeedPhrase() {

    // Limit the length of the underlying document
    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new DocumentMaxLengthFilter(BitherUI.SEED_PHRASE_LENGTH));

    // Keep this in line with the PASSWORD_AREA constant
    JTextArea textArea = new JTextArea(doc, "", 6, BitherUI.PASSWORD_LENGTH);

    // Ensure it is accessible
    AccessibilityDecorator.apply(textArea, MessageKey.SEED_PHRASE);

    // Ensure TAB transfers focus
    AbstractAction transferFocus = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            ((Component) e.getSource()).transferFocus();
        }
    };
    textArea.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "transferFocus");
    textArea.getActionMap().put("transferFocus", transferFocus);

    // Ensure line and word wrapping occur as required
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);

    // Set the theme
    textArea.setBorder(new TextBubbleBorder(Themes.currentTheme.dataEntryBorder()));
    textArea.setBackground(Themes.currentTheme.dataEntryBackground());
    textArea.setFont(new Font("Courier New", Font.PLAIN, 14));

    return textArea;

}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:37,代码来源:TextBoxes.java

示例6: createEditor

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
private void createEditor() {
    editor = new TextEditor(true);
    editor.setFont(new Font(FONT_FAMILY, Font.PLAIN, FONT_SIZE));

    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new GroovyFilter(doc));
    editor.setDocument(doc);
    
    registerEditorActions();
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:11,代码来源:GRScriptEditor.java

示例7: newReadOnlyLengthLimitedTextArea

import javax.swing.text.DefaultStyledDocument; //导入方法依赖的package包/类
/**
 * @param listener The document listener for detecting changes to the content
 * @param rows     The number of rows (normally 6)
 * @param columns  The number of columns (normally 60)
 * @return A new read only length limited text field with default theme
 */
public static JTextArea newReadOnlyLengthLimitedTextArea(DocumentListener listener, int rows, int columns) {

    JTextArea textArea = newReadOnlyTextArea(rows, columns);

    // Limit the length of the underlying document
    DefaultStyledDocument doc = new DefaultStyledDocument();
    doc.setDocumentFilter(new DocumentMaxLengthFilter(rows * columns));
    textArea.setDocument(doc);

    // Ensure we monitor changes
    doc.addDocumentListener(listener);

    return textArea;

}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:22,代码来源:TextBoxes.java


注:本文中的javax.swing.text.DefaultStyledDocument.setDocumentFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。