Solved

Default Font in JEditPane

Posted on 2004-03-30
7
224 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
by zero exception 10 83
ejb mdb examples 1 39
maximize the sum of fractions 33 75
How to fix  socket closed error 11 64
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

734 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