Package javax.swing.text

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


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

  /**
   * @return
   */
 
View Full Code Here


                final Value v = getValue();
                if (isAlwaysEditable()) {
                    ((JComboBox) comp).setEditable(true);
                    final JTextComponent editor = getTextComponent();
                    if (v == null || v.isNothingSelected()) {
                        editor.selectAll();
                    }
                } else {
                    if (v != null && !v.isNothingSelected()) {
                        ((JComboBox) comp).setEditable(editable);
                    }
View Full Code Here

            public void focusGained(FocusEvent e) {
                if (e.getSource() instanceof JTextComponent) {
                    final JTextComponent textComponent=((JTextComponent)e.getSource());
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            textComponent.selectAll();
                        }
                    });
                }
            }}
        );
View Full Code Here

                        SwingUtilities.invokeLater(new Runnable()
                        {
                            @Override
                            public void run()
                            {
                                text.selectAll();
                            }
                        });
                    }
                }
            });
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

        graphComponent.redraw(state);
      }

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

  /**
   *
 
View Full Code Here

    @Override
    public void focusGained(FocusEvent e) {
        Component c = e.getComponent();
        if (c instanceof JTextComponent) {
            JTextComponent tc = (JTextComponent)c;
            tc.selectAll();
        }
    }
}
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.