Package javax.swing.text

Examples of javax.swing.text.JTextComponent$CaretEventImpl


    getSearchField().addFocusListener(this);

  }

  protected boolean changed(JComponent comp, String str, Position.Bias bias) {
    JTextComponent textComp = (JTextComponent) comp;
    int offset = bias == Position.Bias.Forward ? textComp.getCaretPosition()
        : textComp.getCaret().getMark() - 1;

    int index = getNextMatch(textComp, str, offset, bias);

    if (index != -1) {
      textComp.setSelectionStart(index);
      textComp.setSelectionEnd(index + str.length());
      return true;
    } else {
      offset = bias == null || bias == Position.Bias.Forward ? 0 : textComp
          .getDocument().getLength();
      index = getNextMatch(textComp, str, offset, bias);
      if (index != -1) {
        textComp.select(index, index + str.length());
        return true;
      } else {
        return false;
      }
    }
View Full Code Here


    @Override
    public void mousePressed(MouseEvent e) {}
   
    @Override
    public void mouseReleased(MouseEvent e) {
        JTextComponent c = (JTextComponent) e.getSource();
        if (SwingUtilities.isRightMouseButton(e) && c.isEditable() && c.isEnabled()) {
            DcEditorPopupMenu popupmenu = new DcEditorPopupMenu(c);
            popupmenu.validate();
            popupmenu.show(c, e.getX(), e.getY());
        }
    }       
View Full Code Here

        return panel;
    }

    private void disableAll() {
        for (int i = 0; i < fields.size(); i++) {
            JTextComponent field = (JTextComponent) fields.get(i);
            field.setEditable(false);
        }
        validate();
    }
View Full Code Here

        validate();
    }

    private void enableAll() {
        for (int i = 0; i < fields.size(); i++) {
            JTextComponent field = (JTextComponent) fields.get(i);
            field.setEditable(true);
        }
        validate();
    }
View Full Code Here

        private StyledDocument doc;
        private final Segment segment = new Segment();
        private final StringBuffer buffer = new StringBuffer();

        public void actionPerformed(ActionEvent ae) {
            JTextComponent tComp = (JTextComponent) ae.getSource();
            if (tComp.getDocument() instanceof StyledDocument) {
                doc = (StyledDocument) tComp.getDocument();
                try {
                    doc.getText(0, doc.getLength(), segment);
                }
                catch (Exception e) {
                    // should NEVER reach here
                    e.printStackTrace();
                }
                int offset = tComp.getCaretPosition();
                int index = findTabLocation(offset);
                buffer.delete(0, buffer.length());
                buffer.append('\n');
                if (index > -1) {
                    for (int i = 0; i < index + 4; i++) {
View Full Code Here

    public void keyTyped(KeyEvent e) {

      // as a coding convenience, create a reference to the text component
      // that is typecast to JTextComponent.  this is not essential, as we
      // could typecast every reference, but this makes the code cleaner
      JTextComponent _theComponent = (JTextComponent)DataTypeJavaObject.this._textComponent;
      e.consume();
      _beepHelper.beep(_theComponent);
    }
View Full Code Here

        char c = e.getKeyChar();

        // as a coding convenience, create a reference to the text component
        // that is typecast to JTextComponent.  this is not essential, as we
        // could typecast every reference, but this makes the code cleaner
        JTextComponent _theComponent = (JTextComponent)DataTypeDate.this._textComponent;
        String text = _theComponent.getText();


        // tabs and newlines get put into the text before this check,
        // so remove them
        // This only applies to Popup editing since these chars are
View Full Code Here

        char c = e.getKeyChar();
       
        // as a coding convenience, create a reference to the text component
        // that is typecast to JTextComponent.  this is not essential, as we
        // could typecast every reference, but this makes the code cleaner
        JTextComponent _theComponent = (JTextComponent)DataTypeShort.this._textComponent;
        String text = _theComponent.getText();
 
        // look for illegal chars
        if ( ! DataTypeShort.this._isSigned && c == '-') {
          // cannot use '-' when unsigned
          _beepHelper.beep(_theComponent);
View Full Code Here

        char c = e.getKeyChar();

        // as a coding convenience, create a reference to the text component
        // that is typecast to JTextComponent.  this is not essential, as we
        // could typecast every reference, but this makes the code cleaner
                JTextComponent _theComponent = (JTextComponent)DataTypeBigDecimal.this._textComponent;
        String text = _theComponent.getText();

        // tabs and newlines get put into the text before this check,
        // so remove them
        // This only applies to Popup editing since these chars are
        // not passed to this level by the in-cell editor.
View Full Code Here

        char c = e.getKeyChar();
       
        // as a coding convenience, create a reference to the text component
        // that is typecast to JTextComponent.  this is not essential, as we
        // could typecast every reference, but this makes the code cleaner
        JTextComponent _theComponent = (JTextComponent)DataTypeByte.this._textComponent;
        String text = _theComponent.getText();
 
        // look for illegal chars
        if ( ! DataTypeByte.this._isSigned && c == '-') {
          // cannot use '-' when unsigned
          _beepHelper.beep(_theComponent);
View Full Code Here

TOP

Related Classes of javax.swing.text.JTextComponent$CaretEventImpl

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.