Pranjal Choladhara
Pranjal Choladhara

Reputation: 913

How to keep font unchanged when copied to a JEditorPane in java?

I have a JEditorPane where I'll copy some text from other application e.g. Adobe Pagemaker, Corel Draw etc. I want to keep my fonts unchanged. How can I do it ?

Upvotes: 0

Views: 170

Answers (2)

trashgod
trashgod

Reputation: 205875

I want a JEditorPane with different font.

The examples in How to Use Editor Panes and Text Panes may guide you in this. In particular, TextComponentDemo illustrates changing font characteristics both programmatically and interactively. See initDocument() for details.

Upvotes: 2

Aniket Inge
Aniket Inge

Reputation: 25725

You have to set it in StyleContext, a default font and then set the StyleContext object for your JEditorPane

Read about StyleContext

Upvotes: 1

Related Questions