Is there any simple way to parse Ansi colors in log files, and use it in text fields in Swing (JTextArea, JTextPAne,...)?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
If youre JTextPane is non-editable then tim_yates method will not work, to improve upon his method I replaced his append method with
This method seems to be much more robust and works in all of the cases I have tried, but I have not tested it in full
This method works by inserting colored text at the end of the document rather than replacing text that don't exist, which if it is non-editable just results in a repeated windows error sound which is quite annoying
Not tried it, but there's some code here (which needs some formatting to look nice) which claims to be an ANSI colored JTextPane subclass...
For posterity, here is the class run through NetBeans to format the code