### Eclipse Workspace Patch 1.0
#P org.sophie2.base.bound
|
|
|
127 | 127 | } |
128 | 128 | }); |
129 | 129 | |
130 | | JTextField comboField = (JTextField) (res.getEditor().getEditorComponent()); |
| 130 | final JTextField comboField = (JTextField) (res.getEditor().getEditorComponent()); |
131 | 131 | comboField.addFocusListener(new FocusListener() { |
132 | 132 | |
133 | 133 | public void focusGained(FocusEvent e) { |
134 | | // do nothing |
| 134 | comboField.select(0, comboField.getText().length()); |
135 | 135 | } |
136 | 136 | |
137 | 137 | public void focusLost(FocusEvent e) { |
#P org.sophie2.main.app.commons
|
|
|
4 | 4 | import java.awt.Insets; |
5 | 5 | import java.awt.event.ActionEvent; |
6 | 6 | import java.awt.event.ActionListener; |
| 7 | import java.awt.event.FocusEvent; |
| 8 | import java.awt.event.FocusListener; |
7 | 9 | |
8 | 10 | import javax.swing.BoxLayout; |
9 | 11 | import javax.swing.JButton; |
… |
… |
|
341 | 343 | @Override |
342 | 344 | protected JTextField compute() { |
343 | 345 | assert getLastValue() == null; |
344 | | JTextField res = new JTextField(); |
| 346 | final JTextField res = new JTextField(); |
345 | 347 | res.setColumns(7); |
346 | 348 | res.setToolTipText("Enter text to search for."); |
347 | 349 | res.addActionListener(new ActionListener() { |
… |
… |
|
352 | 354 | |
353 | 355 | }); |
354 | 356 | |
| 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 | }); |
355 | 369 | return res; |
356 | 370 | } |
357 | 371 | } |