0

I am trying to make a program that requires a couple of custom JTextComponents. For example I need something that acts like a small JTextArea with a different border (not a rectangular one), and some more rules about how to layout the text, characters per lines, max lines aloud, and formatting to fit into the non rectangular border. How do I properly extend JTextComponent so that people will be able to edit the text inside this the component?

  • If you only want to change the border, there are plenty of ways to achieve that without having to re-implement a `JTextArea`. What kind of border are you looking for? – Guillaume Polet Dec 06 '14 at 18:14
  • I'm trying to do more than just implement a new border, It needs to be a parallelogram, diamond, or Oval and the text needs to reshape the border as it goes. I am making a simpler program right now which could probably be done with modified JTextArea but I am trying to learn how to make a custom JTextComponent for a more ambitious program I will be making in the future. – Totalllyrandomguy Dec 06 '14 at 18:50
  • Implement `JTextComponent` is a rather complex job to do. You can always have a look at the source code of `BasicTextAreaUI` to get the idea, but it's really not an easy job to do. – Guillaume Polet Dec 06 '14 at 18:57
  • what are the steps required to extend JTextComponent and drawing/editting the document? or at least where is a good place to learn how to do it, because I have been searching for a while now. (Btw how do I format the JTextComponent the way you did? – Totalllyrandomguy Dec 06 '14 at 19:09
  • See *How to Write a Custom Swing Component*, cited [here](http://stackoverflow.com/q/11454506/230513). – trashgod Dec 06 '14 at 19:17

0 Answers0