Package javax.swing

Examples of javax.swing.JComponent.addFocusListener()


     * before the selection is cleared so to get the desired effect the
     * selection needs to be pushed to the event queue.
     */
    final JComponent field = getTextField();
    if (field instanceof JTextComponent) {
      field.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              ((JTextComponent) field).selectAll();
View Full Code Here


                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        final JComponent editor = displayRecordFieldSelectionEditor(gem);

                        //we attach a listener to find out when the editor is finished in order to finalize the undoable edit operation
                        editor.addFocusListener(new FocusListener() {
                            public void focusGained(FocusEvent e) {}
                           
                            /** when the focus is lost it implies the editor is closing, any changes are committed so we can end the compound edit*/
                            public void focusLost(FocusEvent e) {
                                undoableEditSupport.endUpdate();
View Full Code Here

      txt.setText(property.getValue());

      JComponent comp = (JComponent)txt;
      comp.setFont(font);
      comp.addFocusListener(new FocusListener() {
         public void focusLost(FocusEvent e) {
            ((PropertyEditor)e.getSource()).stopEditing();
            checkValidity();
         }
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.