Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Alignment for centering text in JTextPane does not work  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi @ll.

I tried to use JTextPane to center a text which should be displayed to users for information.


What did I do wrong?

bye
Constanze
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You add the styles to the document of the JTextPane. There is a page in the java tutorial that has an example (application) of adding styles to a styled document: How to Use Editor Panes and Text Panes.
 
Constanze Michaelis
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You add the styles to the document of the JTextPane. There is a page in the java tutorial that has an example (application) of adding styles to a styled document: How to Use Editor Panes and Text Panes.




I tried this way before, but it hasn'nt been working, too.

bye
Constanze
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
That is a really big piece of pie for such a tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!