![]() Import .BasicTextPaneUI įtDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) Here's a simplified and runnable example of this: import java.awt.* You need to create an StyledEditorKit to make tell the pane which ViewFactory to use. It's important that when doing this you handle all element types (otherwise things won't quite display right. You need to create a new ViewFactory and overwrite the create method. GetElement().getAttributes().getAttribute("attribute name") ![]() You can access attributes with this line in the overridden class - the attributes should be the trigger for doing something additional to the text (like adding an underline). ![]() ![]() You will be overriding the paint(Graphics, Shape) method. You need to extend to perform modify the view however you wish (whether that's adding an colored underline or not). Basically there's 3 classes you need to create: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |