Package DisplayProject

Examples of DisplayProject.FixedLengthDocument


            // Mask type: MK_NONE
            qq_aName = DataFieldFactory.newDataField("aName", 32, TextData.class, Constants.MK_NONE);
            qq_aName.setValue("");
            qq_aName.setOriginalFormatText(null);
            qq_aName.setHorizontalAlignment(JTextField.LEFT);
            qq_aName.setDocument( new FixedLengthDocument(10) ); // Max characters of 10
            getBindingManager().bindComponent(qq_aName, "AName");
            WidthPolicy.set(qq_aName, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_aName, Constants.SP_NATURAL);
            qq_aName.setMinimumSize(new Dimension(164, 15));
            qq_aName.setSize(new Dimension(164, 15));
View Full Code Here


    public MultiLineTextField getqq_Comments() {
        if (qq_Comments == null) {
            qq_Comments = TextEditFactory.newTextField("Comments", 12, 28);
            qq_Comments.setWrapStyleWord( true );
            qq_Comments.setLineWrap( true );
            qq_Comments.setDocument( new FixedLengthDocument(100) ); // Max characters of 100
            getBindingManager().bindComponent(qq_Comments, "comments");
            ExitOnTab.set(qq_Comments, true);
            WidthPolicy.set(qq_Comments, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_Comments, Constants.SP_EXPLICIT);
        }
View Full Code Here

     */
    public MultiLineTextField getqq_Code() {
        if (qq_Code == null) {
            qq_Code = TextEditFactory.newTextEditField("Code", 9, 21);
            LineNumbers.set(qq_Code, true );
            qq_Code.setDocument( new FixedLengthDocument(100) ); // Max characters of 100
            getBindingManager().bindComponent(qq_Code, "code");
            WidthPolicy.set(qq_Code, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_Code, Constants.SP_EXPLICIT);
        }
        return qq_Code;
View Full Code Here

     * @return
     */
    public static DataField newDataField() {
        DataField df = new DataField();
        df.setOpaque(true);
        df.setDocument(new FixedLengthDocument(0));
        df.setInputVerifier(new DataFieldVerifier());
        // Install a factory that knows about data value instances
        df.setFormatterFactory(new DataFieldFormatterFactory());
        df.setDisabledTextColor(SystemColor.windowText);
        setFont(df);
View Full Code Here

    public static DataField newDataField(String name, int columns, AbstractFormatter formatter) {
        DataField df = new DataField(formatter);
        df.setName(name);
        df.setColumns(columns);
        df.setOpaque(true);
        df.setDocument(new FixedLengthDocument(0));
        df.setInputVerifier(new DataFieldVerifier());
        df.setDisabledTextColor(SystemColor.windowText);
        setFont(df);
        return df;
    }
View Full Code Here

        this.editor = new BorderedComboBoxEditor();
        this.setEditor(this.editor);
        this.setRenderer(new BorderedComboBoxRenderer());
        JTextComponent comp = (JTextComponent)this.editor.getEditorComponent();
        comp.setBackground(this.getBackground());
        comp.setDocument(new FixedLengthDocument(0));

        comp.addKeyListener(new ComboBoxKeyHandler());
    }
View Full Code Here

            }
            if (autoComplete) {
                editComponent.setDocument(new FillinManagementDocument(this, showDropdowns, listEntriesOnly, maxCharacters));
            }
            else {
                editComponent.setDocument(new FixedLengthDocument(maxCharacters));
            }
        }
    }
View Full Code Here

      // CONV:TF:21 Jul 2009:Fixed this to work properly
      if (isEditable() && isEnabled()) {
        int finalCursorPosition = 0;
        boolean didManualPaste = false;
        if (getDocument() instanceof FixedLengthDocument){
          FixedLengthDocument doc = (FixedLengthDocument)getDocument();
          Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
          try {
            if (doc.getMaxLength() > 0 && t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
              String text = (String)t.getTransferData(DataFlavor.stringFlavor);
              // CONV:TF:21 Jul 2009:Insert the text at the correct spot in the current String. The String is truncated
              // to the maximum number of characters, and the cursor is moved to the end of the selection or the
              // end of string, whichever is smaller.
              if (text.length()+doc.getLength() > doc.getMaxLength()) {
                String currentText = doc.getText(0, doc.getLength());
                int caretMark = this.getCaret().getMark();
                int caretDot = this.getCaret().getDot();
                String newText = currentText.substring(0, Math.min(caretMark, caretDot)) + text + currentText.substring(Math.max(caretMark, caretDot));
                this.setText(newText);
                finalCursorPosition = Math.min(caretDot+text.length(), doc.getMaxLength());
                didManualPaste = true;
              }
            }
          } catch (UnsupportedFlavorException e) {
          } catch (IOException e) {
View Full Code Here

     * @return
     */
    public static DataField newDataField() {
        DataField df = new DataField();
        df.setOpaque(true);
        df.setDocument(new FixedLengthDocument(0));
        df.setInputVerifier(new DataFieldVerifier());
        // Install a factory that knows about data value instances
        df.setFormatterFactory(new DataFieldFormatterFactory());
        df.setDisabledTextColor(SystemColor.windowText);
        setFont(df);
View Full Code Here

    public static DataField newDataField(String name, int columns, AbstractFormatter formatter) {
        DataField df = new DataField(formatter);
        df.setName(name);
        df.setColumns(columns);
        df.setOpaque(true);
        df.setDocument(new FixedLengthDocument(0));
        df.setInputVerifier(new DataFieldVerifier());
        df.setDisabledTextColor(SystemColor.windowText);
        setFont(df);
        return df;
    }
View Full Code Here

TOP

Related Classes of DisplayProject.FixedLengthDocument

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.