Libraryless. Click here for Pure Java version (5171L/28K).
1 | static <A extends JTextArea> A visibleCaretOnDisabledTextArea(A textArea) {
|
2 | if (textArea != null) swing {
|
3 | textArea.setEnabled(false); |
4 | textArea.getCaret().setVisible(true); |
5 | textArea.getCaret().setSelectionVisible(true); |
6 | textArea.addFocusListener(new FocusListener {
|
7 | @Override |
8 | public void focusGained(FocusEvent e) {
|
9 | textArea.getCaret().setVisible(true); |
10 | textArea.getCaret().setSelectionVisible(true); |
11 | } |
12 | |
13 | @Override |
14 | public void focusLost(FocusEvent e) {
|
15 | textArea.getCaret().setSelectionVisible(true); |
16 | } |
17 | }); |
18 | } |
19 | ret textArea; |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034642 |
| Snippet name: | visibleCaretOnDisabledTextArea - shows caret but not selection... |
| Eternal ID of this version: | #1034642/3 |
| Text MD5: | bcfdbfa4e0a625bb252fde5f298ab03d |
| Transpilation MD5: | b18c3fd7e18450a128ecd4a6be6a8935 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-02-28 12:28:17 |
| Source code size: | 654 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 347 / 454 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |