Package javax.swing.text

Examples of javax.swing.text.JTextComponent.moveCaretPosition()


                    String tillComplete = input.substring(pos + 1);
                    tillComplete = sorted[0].substring(tillComplete.length());
                    comp.setText(input + tillComplete);
                    comp.setCaretPosition(comp.getText().length());
                    if (tillComplete.length() > 0) {
                        comp.moveCaretPosition(caretPos);
                    } else {
                        comp.setCaretPosition(comp.getText().length());
                    }
                    comboModel.update();
                }
View Full Code Here


    }
    Pattern pattern = Pattern.compile(textPattern);
    Matcher matcher = pattern.matcher(text.getText());
    if (matcher.find(text.getCaretPosition())) {
      text.setCaretPosition(matcher.start());
      text.moveCaretPosition(matcher.end());
      text.requestFocus();
      return;
    }
    if (matcher.find(0)) {
      text.setCaretPosition(matcher.start());
View Full Code Here

      text.requestFocus();
      return;
    }
    if (matcher.find(0)) {
      text.setCaretPosition(matcher.start());
      text.moveCaretPosition(matcher.end());
      text.requestFocus();
      return;
    }
  }
View Full Code Here

                        endOffs = Utilities.getWordEnd(target, endOffs);
                    } else {
                        endOffs = Utilities.getWordEnd(target, offs);
                    }

                    target.moveCaretPosition(endOffs);

                    // and then delete it
                    target.replaceSelection("");
                    beep = false;
                } catch (BadLocationException exc) {
View Full Code Here

                        failed = true;
                    }
                }

                if (!failed) {
                    target.moveCaretPosition(offs);

                    // and then delete it
                    target.replaceSelection("");
                    beep = false;
                }
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            JTextComponent target = getTextComponent(e);
            if (target != null) {
                Document doc = target.getDocument();
                target.setCaretPosition(0);
                target.moveCaretPosition(doc.getLength());
            }
        }
    }
   
    /**
 
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            JTextComponent target = getTextComponent(e);
            if (target != null) {
                Document doc = target.getDocument();
                target.setCaretPosition(0);
                target.moveCaretPosition(doc.getLength());
            }
        }
    }
   
    /**
 
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            JTextComponent target = getTextComponent(e);
            if (target != null) {
                Document doc = target.getDocument();
                target.setCaretPosition(0);
                target.moveCaretPosition(doc.getLength());
            }
        }
    }
   
    /**
 
View Full Code Here

        } else {

            Document doc = textField.getDocument();
            if (doc != null) {
                textField.setCaretPosition(getValueField().getDocument().getLength());
                textField.moveCaretPosition(0);
            }
        }
    }
   
    /**
 
View Full Code Here

      if(e.isShiftDown())
      {
        // extend selection if shift key down:
        if(mark <= start)
        {
          comp.moveCaretPosition(end);
        }
        else
        {
          comp.moveCaretPosition(start);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.