Package javax.swing.text

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


     * @param e  the focus event.
     */
    public void focusGained(final FocusEvent e) {
        if (e.getSource() instanceof JTextComponent) {
            final JTextComponent tex = (JTextComponent) e.getSource();
            tex.selectAll();
        }
    }

    /**
     * Deselects the text when a field loses the focus.
View Full Code Here


    int i = text.indexOf("${}");
    if (i != -1)
      textField.setCaretPosition(i + 2);
    else
      textField.selectAll();
  }

  public String getInitialEditValue() {
    return initialEditValue;
  }
View Full Code Here

        int i = text.indexOf("${}");
        if (i != -1) {
            textField.setCaretPosition(i + 2);
        } else {
            textField.selectAll();
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

        boolean haveSelection =
                textComponent.getSelectionStart() != textComponent.getSelectionEnd();

        if (e.getSource() == cutItem) {
            if (!haveSelection) textComponent.selectAll();
            textComponent.cut();
        } else if (e.getSource() == copyItem) {
            if (!haveSelection) textComponent.selectAll();
            textComponent.copy();
        } else if (e.getSource() == pasteItem) {
View Full Code Here

        if (e.getSource() == cutItem) {
            if (!haveSelection) textComponent.selectAll();
            textComponent.cut();
        } else if (e.getSource() == copyItem) {
            if (!haveSelection) textComponent.selectAll();
            textComponent.copy();
        } else if (e.getSource() == pasteItem) {
            textComponent.paste();
        } else if (e.getSource() == deleteItem) {
            if (!haveSelection) textComponent.selectAll();
View Full Code Here

            if (!haveSelection) textComponent.selectAll();
            textComponent.copy();
        } else if (e.getSource() == pasteItem) {
            textComponent.paste();
        } else if (e.getSource() == deleteItem) {
            if (!haveSelection) textComponent.selectAll();
            textComponent.replaceSelection("");
        } else if (e.getSource() == selectAllItem) {
            textComponent.selectAll();
        }
    }
View Full Code Here

            textComponent.paste();
        } else if (e.getSource() == deleteItem) {
            if (!haveSelection) textComponent.selectAll();
            textComponent.replaceSelection("");
        } else if (e.getSource() == selectAllItem) {
            textComponent.selectAll();
        }
    }
}
View Full Code Here

     * @param e  the focus event.
     */
    public void focusGained(FocusEvent e) {
        if (e.getSource() instanceof JTextComponent) {
            JTextComponent tex = (JTextComponent) e.getSource();
            tex.selectAll();
        }
    }

    /**
     * Deselects the text when a field loses the focus.
View Full Code Here

    }

    @Override
    public void actionPerformed(ActionEvent e) {
      JTextComponent component = getFocusedComponent();
      component.selectAll();
    }
  }

  private ImageIcon getImageIcon(String filename) {
    Image image = Toolkit.getDefaultToolkit().getImage(
View Full Code Here

        graphComponent.redraw(state);
      }

      currentEditor.revalidate();
      currentEditor.requestFocusInWindow();
      currentEditor.selectAll();

      configureActionMaps();
    }
  }
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.