當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。