I was thinking of trying to write my own custom swing component. I was thinking of a simple text based component that would act like an open book. Text would be displayed on the left side/page of the component until there is no space left and then the rest of the text would be displayed on the right side/page until there is no space left. There would be some mechanism to "turn the page" and the rest of the text would be displayed in this manner until there is no more text to show.

I've gone about extending already made components before without any trouble but never really done it from scratch.

I'd like to ask if anyone could recommend a way of implementing this specific control, which classes to extend and how etc. If there are any good tutorials anyone knows about creating custom swing controls, preferably simple, text-based viewer controls, please let me know.

If I was to have a rough guess of what I would be doing, I would say that I would be overriding mostly paint methods, calculating sizes of text with regards to lines, spacing etc etc, and painting as appropriate. Any comments or examples on doing things like this would be helpful, though please understand I'm not asking you to do my work for me.

Thank you.

extend JComponent and do you're actual drawing by overriding paintComponent