Ticket #2131: 2131.patch

File 2131.patch, 3.3 KB (added by diana, 15 years ago)
  • src/main/java/org/sophie2/base/bound/BoundComboBox.java

    ### Eclipse Workspace Patch 1.0
    #P org.sophie2.base.bound
     
    127127                                        } 
    128128                                }); 
    129129                                 
    130                                 JTextField comboField = (JTextField) (res.getEditor().getEditorComponent()); 
     130                                final JTextField comboField = (JTextField) (res.getEditor().getEditorComponent()); 
    131131                                comboField.addFocusListener(new FocusListener() { 
    132132 
    133133                                        public void focusGained(FocusEvent e) { 
    134                                                 // do nothing 
     134                                                comboField.select(0, comboField.getText().length()); 
    135135                                        } 
    136136 
    137137                                        public void focusLost(FocusEvent e) { 
  • src/main/java/org/sophie2/base/bound/BoundTextField.java

     
    4747                                res.addFocusListener(new FocusListener() { 
    4848 
    4949                                        public void focusGained(FocusEvent e) { 
     50                                                res.select(0, res.getText().length()); 
    5051                                                hasFocus().set(true); 
    5152                                        } 
    5253 
  • src/main/java/org/sophie2/main/app/commons/book/panels/QuickSearchPanel.java

    #P org.sophie2.main.app.commons
     
    44import java.awt.Insets; 
    55import java.awt.event.ActionEvent; 
    66import java.awt.event.ActionListener; 
     7import java.awt.event.FocusEvent; 
     8import java.awt.event.FocusListener; 
    79 
    810import javax.swing.BoxLayout; 
    911import javax.swing.JButton; 
     
    341343                        @Override 
    342344                        protected JTextField compute() { 
    343345                                assert getLastValue() == null; 
    344                                 JTextField res = new JTextField(); 
     346                                final JTextField res = new JTextField(); 
    345347                                res.setColumns(7); 
    346348                                res.setToolTipText("Enter text to search for."); 
    347349                                res.addActionListener(new ActionListener() { 
     
    352354                                         
    353355                                }); 
    354356 
     357                                res.addFocusListener(new FocusListener() { 
     358                                         
     359                                        public void focusLost(FocusEvent e) { 
     360                                                // do nothing 
     361                                                 
     362                                        } 
     363                                         
     364                                        public void focusGained(FocusEvent e) { 
     365                                                res.select(0, res.getText().length()); 
     366                                                 
     367                                        } 
     368                                }); 
    355369                                return res; 
    356370                        } 
    357371                } 
  • src/main/java/org/sophie2/main/app/commons/book/panels/NavigationPanel.java

     
    322322                                res.setColumns(3); 
    323323                                res.setToolTipText("The current page of the book."); 
    324324 
     325                                res.addFocusListener(new FocusListener() { 
     326                                         
     327                                        public void focusLost(FocusEvent e) { 
     328                                                // do nothing 
     329                                                 
     330                                        } 
     331                                         
     332                                        public void focusGained(FocusEvent e) { 
     333                                                res.select(0, res.getText().length()); 
     334                                                 
     335                                        } 
     336                                }); 
    325337                                res.addActionListener(new ActionListener() { 
    326338 
    327339                                        @SuppressWarnings("synthetic-access")