Libraryless. Click here for Pure Java version (9617L/53K).
static <A extends JTextComponent> A makeUneditableWithTextColor(A a, Color color) { if (a != null) swing { a.setEditable(false); // prevent auto-scrolling when text is changed programmatically DefaultCaret caret = cast a.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); a.setDisabledTextColor(color); } ret a; } static <A extends JTextComponent> A makeUneditableWithTextColor(Color color, A a) { ret makeUneditableWithTextColor(a, color); }
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: | 165 / 245 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031261 - uneditableBlack |