Inserting text inside a TitleBorder...
I have not practiced with Java for about two and a half years, so I forgot how to actually add text inside a TitleBorder. I do not need anything about other Border styles, just TitleBorder is needed.
Here's a sample of the code I have:
Code:
authors = BorderFactory.createTitledBorder("Title");
howTo = BorderFactory.createTitledBorder("Title");
cR = BorderFactory.createTitledBorder("Title");
a.setBorder(authors);
a.setPreferredSize(new Dimension(330,120));
b.setBorder(howTo);
b.setPreferredSize(new Dimension(330,120));
c.setBorder(cR);
c.setPreferredSize(new Dimension(330,120));
I have those three TitleBorders. I've tried this way, but shows an error:
Code:
addCompForTitledBorder(authors, "Internal Border Text",
TitledBorder.CENTER,
TitledBorder.DEFAULT_POSITION);
If there is any way, besides using any other Components such as JTextAreas or JLabels, then please let me know
Thank You
