Solved

Default Font in JEditPane

Posted on 2004-03-30
7
222 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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 125 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
rhino JavaScript import, load 25 84
javap bin 2 34
eclipse buid path vs tomcat lib path 10 23
Convert from a json string array to a Java object 3 32
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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…

777 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