Package com.mucommander.ui.text

Examples of com.mucommander.ui.text.SizeConstrainedDocument


        initUI();
    }
 
    private void initUI() {
      titleTextField = new JTextField();
        titleTextField.setDocument(new SizeConstrainedDocument(31));
        titleTextField.setText(folderPanel.getTabs().getCurrentTab().getTitle());
        titleTextField.selectAll();

        okButton = new JButton(Translator.get("ok"));
        cancelButton = new JButton(Translator.get("cancel"));
View Full Code Here


        mainPanel.add(gridPanel);

        octalPermTextField = new JTextField(3);
        // Constrains text field to 3 digits, from 0 to 7 (octal base)
        Document doc = new SizeConstrainedDocument(3) {
            @Override
            public void insertString(int offset, String str, AttributeSet attributeSet) throws BadLocationException {
                int strLen = str.length();
                char c;
                for(int i=0; i<strLen; i++) {
                    c = str.charAt(i);
                    if(c<'0' || c>'7')
                        return;
                }

                super.insertString(offset, str, attributeSet);
            }
        };
        octalPermTextField.setDocument(doc);
        // Initializes the field's value
        updateOctalPermTextField();

        if(canSetPermission) {
            doc.addDocumentListener(this);
        }
        // Disable text field if no permission bit can be set
        else {
            octalPermTextField.setEnabled(false);
        }
View Full Code Here

TOP

Related Classes of com.mucommander.ui.text.SizeConstrainedDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.