开发者

Override the Java DefaultStyledDocument implementation

I'm a student. When I learn the GOF , I want to create the word processor mentioned in Chapter2. I choose to use Java swing, I want to extend the DefaultStyledDocument and override the insertUpdate and related methods in order to implement and manage my own Element tree, so I can practice the Composite and Flyweight Pattern. The开发者_运维百科 problem is when I override the insertUpdate method, insert newline has no effect. When inserting a newline, My Element tree will create a new Paragraph(BrachElement), but the cursor don't move to the next line, Swing just don't show it and my following characters just in the same line.

Can anyone help me, thanks.


Try this to understand how your structure changes http://java-sl.com/JEditorPaneStructureTool.html

And this http://java-sl.com/JEditorPaneTables.html to see how to change the structures

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜