Package javax.swing.text

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


            final JTextComponent target = getTextComponent(e);
            final int start = target.getSelectionStart();
            final int end = target.getSelectionEnd();
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                target.select(start, end);
              }
            });
      }
      public boolean shouldBeEnabled() {
          JTextComponent target = getFocusedTextComponent();
View Full Code Here


            final JTextComponent target = getTextComponent(e);
            final int start = target.getSelectionStart();
            final int end = target.getSelectionEnd();
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                target.select(start, end);
              }
            });
      }
      public boolean shouldBeEnabled() {
          JTextComponent target = getFocusedTextComponent();
View Full Code Here

            final JTextComponent target = getTextComponent(e);
            final int start = target.getSelectionStart();
            final int end = target.getSelectionEnd();
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                target.select(start, end);
              }
            });
      }
      public boolean shouldBeEnabled() {
          JTextComponent target = getFocusedTextComponent();
View Full Code Here

            //We need it because TextComponent clears selection by focus gain event.
            if (needToRestoreSelection) {
        final JTextComponent textComponent = (JTextComponent) lastFocusOwner;
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            textComponent.select(selectionStart[0], selectionEnd[0]);
          }
        });
      }
        }
        /*
 
View Full Code Here

      String findText = txtFind.getText().toLowerCase();
      String txt = txtComp.getText().toLowerCase();
      int startPos = txt.indexOf(findText, txtComp.getCaretPosition());
      int length = findText.length();
      if (startPos > -1) {
        txtComp.select(startPos, startPos + length);
        txtComp.requestFocus();
        txtFind.requestFocus();
      } else {
        Toolkit.getDefaultToolkit().beep();
      }
View Full Code Here

    // this depends on who has the focus right now.
    final Component owner = FocusManager.getCurrentManager().getPermanentFocusOwner();
    if (owner instanceof JTextComponent)
    {
      final JTextComponent textComponent = (JTextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof TextComponent)
    {
      final TextComponent textComponent = (TextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
View Full Code Here

      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof TextComponent)
    {
      final TextComponent textComponent = (TextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof JTable)
    {
      final JTable table = (JTable) owner;
      table.clearSelection();
View Full Code Here

     * @param e  the event.
     */
    public void focusLost(final FocusEvent e) {
        if (e.getSource() instanceof JTextComponent) {
            final JTextComponent tex = (JTextComponent) e.getSource();
            tex.select(0, 0);
        }
    }

    /**
     * Adds this instance as a listener for the specified text component.
View Full Code Here

     * @param e  the event.
     */
    public void focusLost(final FocusEvent e) {
        if (e.getSource() instanceof JTextComponent) {
            final JTextComponent tex = (JTextComponent) e.getSource();
            tex.select(0, 0);
        }
    }

    /**
     * Adds this instance as a listener for the specified text component.
View Full Code Here

     * @param e  the event.
     */
    public void focusLost(FocusEvent e) {
        if (e.getSource() instanceof JTextComponent) {
            JTextComponent tex = (JTextComponent) e.getSource();
            tex.select(0, 0);
        }
    }

    /**
     * Adds this instance as a listener for the specified text component.
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.