Libraryless. Click here for Pure Java version (9617L/53K).
1 | static <A extends JTextComponent> A makeUneditableWithTextColor(A a, Color color) { |
2 | if (a != null) swing { |
3 | a.setEditable(false); |
4 | |
5 | // prevent auto-scrolling when text is changed programmatically |
6 | DefaultCaret caret = cast a.getCaret(); |
7 | caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); |
8 | |
9 | a.setDisabledTextColor(color); |
10 | } |
11 | ret a; |
12 | } |
13 | |
14 | static <A extends JTextComponent> A makeUneditableWithTextColor(Color color, A a) { |
15 | ret makeUneditableWithTextColor(a, color); |
16 | } |
Began life as a copy of #1031106
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031107 |
Snippet name: | makeUneditableWithTextColor |
Eternal ID of this version: | #1031107/4 |
Text MD5: | 6d7ca2e83eeabc393825333469412892 |
Transpilation MD5: | fabb1087508cc04c2d2a77ff6dc92214 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-08 11:00:57 |
Source code size: | 507 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 164 / 244 |
Version history: | 3 change(s) |
Referenced in: | [show references] |