?
Solved

Default Font in JEditPane

Posted on 2004-03-30
7
Medium Priority
?
226 Views
Last Modified: 2013-12-03
Hi all,

I'm going crazy trying to figure out how to set the default Font that a JEditPane should use. I'm using JEditPane as a TableCellEditor and TableCellRenderer, so even if I manage to set the Font used by the editor when inserting new text, I can't find a way to make the JEditPane use a specific Font when setting the text on an empty pane...

I'm using the StyledEditorKit (I need to be able to count the number of lines in the pane... even when they are wrapped).

I appreciate any help here...

0
Comment
Question by:schybert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721341
did you try setFont method of JEditorPane

If you want to render something then you can also use the HTML tags for font.  <font face="Arial'>hai</font>

That way you will get that font.
0
 
LVL 3

Author Comment

by:schybert
ID: 10721420
Well, I have tried setFont actually :-) And as I said, I need to use the StyledEditorKit... not HTML.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721440
okie

StyledEditorKit.FontFamilyAction try this..
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Author Comment

by:schybert
ID: 10721576
Yeah, but how do I use it? I need to execute the action explicity from within a method. An example would be very appreciated...
0
 
LVL 9

Accepted Solution

by:
mmuruganandam earned 375 total points
ID: 10721651
Check the demo in your jdk installer path.  There you have "Stylepad" folder.  Within that you can see how to add the font family action in the StylePad.java

0
 
LVL 3

Author Comment

by:schybert
ID: 10721758
OK, thanks. I don't have time to test this until tomorrow, so if if it solves my problem I'll accept your answer then.
0
 
LVL 3

Author Comment

by:schybert
ID: 10729997
Well, I can do a workaround with this solution, but it's not really what I was aiming for... I have to execute the action each time I insert new text into the pane... What I was hoping to do was set the Font that will be used by the pane as default...
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question