JEditorPane Line spacing help

I've done a few searches on here and google, and not found an answer yet, is it possible to alter the line spacing of the text in a JEditorPane, when running my app under Linux (Ubuntu), the spacing is way too much, altering the font seems to help a bit. I'm displaying HTML inside it, mainly plain text, but sometimes <A tag links.
Heres a picture to demonstrate, the same JEditorPane displaying the same text on Windows, Mac and Linux...
[View picture|http://files.getdropbox.com/u/704221/JeditorPane.jpg]
As you can see on Linux, theres more line spacing, and its switched on the vertical scroll bar, so if I could programatically tweek the line spacing depending on the OS, that would really help.
Or is there another control I could use? It needs to display HTML with hyperlinks and images <img tags.

Have a look
here: [http://java.sun.com/docs/books/tutorial/uiswing/components/text.html],
here: [http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html]
and here: [http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html].
There's a style attribute that should do the trick: [http://java.sun.com/javase/6/docs/api/javax/swing/text/StyleConstants.html#LineSpacing].
Sample code to give you an idea (not tested, no warranty; may possibly be done better; may be done with Styles... etc.):
JEditorPane jep = new JEditorPane();
StyledDocument doc = (StyledDocument) jep.getDocument();
int paragraph = 0;
float newlinespacing = .4f;
Element el = doc.getParagraphElement(paragraph);
MutableAttributeSet mas = new SimpleAttributeSet();
StyleConstants.setLineSpacing(mas, newlinespacing);
doc.setParagraphAttributes(
    0, el.getEndOffset() - el.getStartOffset(), mas, false
);

Similar Messages

  • Line spacing help!

    I'm trying to get Contribute to let me single-space
    something! In a Word Document, one can go to Format-Paragraph - and
    then adjust the line spacing however they choose. But I don't see
    anything like that on Contribute - and, for some reason, it's
    making things double-spaced where I don't want that! Any
    help?

    To change to single space format:
    1. First pick the site you want to administer.
    2. Go into your user role that is affected, and select Edit
    Role settings, and then choose Editing.
    3. From Paragraph spacing choose "One line, as in standard
    word processors.
    4. Click Okay and now you should have single spaced
    lines.

  • PSE11 Can't adjust the line spacing correctly - can anyone help ?

    When I write text in a free style I'm unable to adjust the line spacing anymore - it turns out much to big and whatever value I choose it's every time the same !?!
    When trying text in a box it's all OK, but I seldom use text in a box...
    I'm using PSE since 11/2012 and the problem occured just now
    Has anyone an idea ?

    Click the leading dropdown below and choose "Auto". If this doesn't work click at the flyout button at the top-right corner of tool option bar and choose "Reset Tool".

  • I have "upgraded" from Pages 2.0.2 to Pages 5.5.3 and can no longer customize my line spacing. Does anyone know if there are more than 4 options for line spacing?

    Is it possible to customize line spacing in Pages 5.5.3? My previous Pages 2.0.2 allowed me to choose spacing in 0.1 increments, but as far as I can tell Pages 5.5.3 only offers four options. Very limiting for creative documents.

    Hi Margaret,
    Does this work for you?
    And 0.6
    Or 1.6
    Please call back if this does not help.
    Regards,
    Ian.

  • In Notes, I do not have a format bar. Under views there is no option to toggle this feature on or off. How then, can I set line spacing in documents? or is there some trick to getting the format bar that they say exists?

    I want to be able to adjust line spacing in the Notes program. The help menu says that there is format bar and that I can choose this spacing. I do not have a format bar. They said that you can toggle this on and off under the View menu. I have not option in my dropdown that gives me an option to show or hide the format bar. Is there a reason why my version does not seem to have this feature?

    Sorry for the wishy washy response but potential YES and possibly NO. Your user data should be intact but the OS may not be able to boot. You have a backup?

  • Robohelp 10 output line spacing for numbered lists is off

    I wondered if you have had this situation occur with your output from Robohelp 10.
    I created my help system and CSS using Robohelp 10. My CSS contains a numbered list style and an alpha list style, both having line spacing of 3pt before and 3pt after. Looks great in Robohelp WYSIWYG, but the generated output (in IE and Chrome) looks bad. The numbered list line has way too much line spacing after (the next style is a non-numbered list style) and the alpha list has way too little line spacing.
    I tried playing around with changing the line spacing but it does not change the output!
    Thought I'd reach out to see if you have experienced this issue and the most expedient way to resolve.
    Here is an example of HTML tags in Robohelp:
    numbered list
    <?rh-list_start level="1" an="1" class="rl-p-1ListNumber" start="1" style="list-style: rh-list;
      list-style: rh-list;" ?><p class="1ListNumber">instruction text.</p><?rh-list_end ?>
    alpha list
    <?rh-list_start level="1" an="1" class="rl-p-Alpha" style="list-style: rh-list;
      list-style: rh-list;" ?><p class="Alpha">Instruction text.</p><?rh-list_end ?>
    thanks much

    If you create a single topic project showing this problem and send it to me as directed on the Contact page of my site, I will take a look.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Incrase Line Spacing in Table

    Hi All,
    is it possible to increase the line spacing for a ui-element table (CL_WD_TABLE) in ABAP Web Dynpro? If so,can you explain how to do this?
    BR
    Dominik

    Hi,
    as I read the explanation in following article set_width does not solve the problem in my eyes.
    http://help.sap.com/saphelp_sm40/helpdata/en/6e/ae0e422dfcdc2ce10000000a1550b0/content.htm
    any has a different view?
    BR
    Dominik

  • Line Spacing

    I have always had a very hard time with line spacing in InDesign. I always end up with inconsistent line spacing/leading throughout my paragraph. The text blocks act as if I have set hard and soft returns when I haven't. It always seem to be the last word in a paragraph. It's always done this and I've heard other people complain about the same thing. The copy has been cut and pasted into InDesign from a pdf.
    I welcome any suggestions.

    In that little pearl of wisdom from Bob, you are overseeing something that might help a Quark reformee:  .. by default ..
    Check out this screen snap from my Preferences. Note that I have it left disabled, as I am totally confident in my ID formatting / styling skills
    There is a reason Adobe leaves it unchecked by default; enable at your own risk.
    (The reason, obviously, is that any larger-than-usual font size anywhere in your paragraph (including its return at the end) will influence the entire paragraph. I can't help thinking that would be a feature that drives Quark users nuts all around the world.)

  • CSS unordered list {line spacing question}

    Hi everyone.
    I am trying to make a bulleted list, and I have 5 elements.
    Some require one line, while others require two lines. But the
    thing is, I want the leading to be lets say 20pt between items. But
    since some of the items require two lines, i want those items to
    have their line spacing closer so they can seem that they are part
    of the same bullet point. Is there any way I can do this? Is it
    even possible?
    Any help would be appreciated.
    Thanks
    -Ce

    Use <ol> or <dl> or <ul> list container and
    wrap your bullets in individual <li> tags.
    use css to style the line-height of the lis. Use a class on
    each group of lis to set the line-height.
    <ul>
    <li class = "double_height">Item 1</li>
    <li class = "single_height">Item 2</li>
    <li class = "double_height">Item 3</li>
    </ul>
    ul {
    margin: 0;
    padding: 0;
    list-style: none;
    .double_height {
    line-height: 2.5em;
    .single-height {
    line-height: 1.2em;
    You can play with the settings to get the best results but
    this code will give you an idea of what is possible.
    regards
    Nick Barling
    www.barkingweb.com

  • Word doc import/export and line spacing differences with Pages '09

    When I save or open a Word .doc, the default line spacing differences messes up the document formatting, the document ends up being more pages in Pages than when I open in Word:Mac.
    One work around I learned about on this forum is to set the line spacing to "exact" in Pages. This is okay, except many Word documents have subtle line spacing before or after paragraphs and/or different size fonts in the document that affects line spacing. Setting Pages line spacing to exact makes a mess of these documents.
    Why can't Apple build a proper line spacing function into Pages so it is more compatible with Word? If they are touting compatibility, they need to make a disclaimer in their advertising as only simple documents seem to work without issues.
    Is there a better work around available?
    Thanks.
    Bud

    Bud,
    It seems that there is incompatibility in the before and after spacing (Ctrl + 0 in Word for Windows adds 12 points, if I remember correctly).
    Since you mention a .doc file, it makes me think you have a Word 2003 or earlier format. I have a couple of suggestions:
    1. If you have access to Word 2007 or Word 2008 for Mac, try saving in .docx. Basically, a .docx is compliant with Office Open XML, the ECMA standard that is the basis for the document formats in Microsoft Office 2007 and Microsoft Office 2008 for Mac.
    [Note: The Office Open XML ECMA standard, or OOXML is a source of polemic since it was donated by Microsoft and competes with Open Document Format, or ODF. You can find more here:
    http://en.wikipedia.org/wiki/OfficeOpen_XML#Implementations_of_new_2008version
    and Microsoft has stated they'll support the newer standard and retrofit Office 2007. Let's hope they do the same for Office 2008 for Mac and that Apple picks up as well with an upgrade for Pages '09 or in Pages '10]
    2. If the above does not work, I would suggest reporting this to Apple. This would indicate a compatibility problem in Office Open XML compliance, which should be independent of Word itself. A way to support this claim would be to test it in another word processor that adds space before and after a paragraph and that supports OOXML, which I think would be too much I would not bother reporting it for a Word 2003 format because it is proprietary.
    Hope it helps.

  • Uneven line spacing

    In the document I'm creating there are some paragraphs where the line spacing on the screen and printed page are uneven ... for example, the white space between line 2 and line 3 is wider than the space between any other lines in the same paragraph. Yet, for most paragraphs the line spacing looks fine. For this example, I'm using the font Minion, at 11.2 with a line spacing of 1.2. Any help / thoughts would be very appreciated. Thanks.

    Hullo Tom:
    I run into this too, sometimes, but it generally gets sorted when I apply a baseline adjustment to a whole page to balance up facing pages. So just a thought, no guarantees. Have you tried selecting your paragraph up to and including where the problem begins, then setting a value for baseline adjustment; and, if you don't want it, setting it back to zero again?
    Even were that to work for you, there is still something a bit unusual about the way Pages handles line spacing. Other users have asked for a fixed line spacing option, whereas the spacing in Pages seems to be set in reference to the total content of the font in use, and sometimes behaves a bit strangely. Of the options on offer, you might like to try whether choosing "between" or no choice at all from the scroll-down options in "multiple" under the line spacing slider in Text Inspector improves things for you. I think "at least" in these options is meant to avoid ascender / descender collisions with mid-line font changes or access to glyphs or superscript characters, and choosing that might exacerbate your problem. If you find it on, try switching it off.
    The baseline adjustment I've mentioned is in Text Inspector / More, in case you want to try it. Unfortunately this is an intermittent problem, and I haven't been able to duplicate an occurrence of it on demand to see if I can clarify it.
    But the option of a fixed line spacing would, if it were available. Pages' regard for everything that might happen in a font can sometimes be a nuisance when you're just entering standard body text, and if this little quirk of it bothers you, I strongly recommend that you "Provide Pages Feedback" under the Pages main menu to report to Apple that it does need fixing.
    Regards.
    PS: I've also tried this with your fractional font size (though I don't have Minion) but I don't think this is the cause of the problem: I've found it in 12pt Baskerville too.

  • How do you set the line spacing when using the Append Text Table to Report VI?

    I have a table of numbers which I wish to print using the report generation VI's. Since each column has a different numerical format, I first convert the number for each cell to a string with the appropriate format and then build a string array to pass to the Append Text Table to Report VI. The table is printed with double line spacing. How do I reset this for single spacing?
    Attachments:
    print_array.vi ‏112 KB

    Dave,
    The issue is not with the NI-Reports functionality, but the Array to Spreadsheet String funvtion in the for loop. Here is the context help for this function:
    "Converts an array of any dimension to a table in string form, containing tabs separating column elements, a platform-dependent EOL character separating rows, and, for arrays of three or more dimensions, headers separating pages."
    The thing to note here is that it says it adds an EOL (end of line) character at the end of every row. This is what is happening. Your first column of data has a \r\n in it and adds the second row to each data item. This in turn makes the rest of the columns have a larege blank space at the bottom so that all of the cell heights are equal. I w
    ould re-write that little bit of code so that you just do one large string concatenation of number, spaces, number, spaces, number and this should solve your issue.
    Thank you for using the Developer Zone Discussion Forums.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • How to use line wrapping and line spacing in java?

    how to use line wrapping and line spacing in java?

    Hi,
    This is explained in the java Tutorial. Please see the link:
    http://java.sun.com/docs/books/tutorial/i18n/text/line.html
    and find some sample examples.
    Hope this helps,
    --Sun/DTS                                                                                                                                                                                                                                                                                                                                                                                       

  • Composing email - line spacing

    Can anyone help please - When composing an email the line spacing is too big - they have a whole host of icons to insert charts, indent, bullet points but none to change the line spacing or have I totally missed it!!

    I haven't been able to find it either, yet another bug to be sorted.
    However, BT in their infinite wisdom, have provided the spell check function.................. so you can check in English, German, French and Itallian.
    Think I'm kidding, just click on the down arrow, top right, next to the a,b,c, !!!!!!!!!
    So, as a UK based ISP, with a UK customer base, they can omit masses of important things, yet give the option to spell check these four languages.
    I wonder how our Celtic countrymen, or indeed any of the population who speak another language will take it ?
    BT being racist in providing spell checking in only four languages ?
    It should be either one language, English, or every other language.
    Sorry I said that now, some bod at BT will possibly take it on board, tell all the ' engineers ' to stop fixing the problems we keep mithering about and concentrate on providing a spell check for every language known to man .................... and some unknown to man.    

  • How to fix bad line spacing with custom image bullet when displaying on iPad

    So I have a presentation with custom image bullets for a couple slides. The bullets are fine when displayed on a mac, but when I move it over to the iPad the line spacing of the bullets and the text gets further out of horizontal alignment the more lines I add. I've tried adjusting the size of the bullets larger and smaller to see if that would help but it makes no difference either way.
    I know the easiest thing is to get rid of the custom image bullets, but this issue makes no sense to me and I'd really like to solve it.
    Here's how it looks on the mac:
    Here's how it looks on the iPad (took a photo and I know it's a little warped but I've shown where the issue is occurring):

    -> press '''CTRL''' + '''0''' (zero) to '''Reset''' Zoom
    * For details, see this article -> [[How do I use Zoom?]]
    Check and tell if its working.

Maybe you are looking for

  • How to share printers with iPad?

    Hi guys, I upgraded iTunes to 10.1 so I could install iOS 4.2 on to my iPad. When I first synced it with my iPad, after upgrading to 4.2, I was asked if I wanted to share printers with my iPad, but clicked no by accident. Now I can't get that message

  • Procedure needed 4 changing the sequence order

    For example, there are ten employees. The first employee’s id will be 1. The second employee says his id he wants to be 14. For the third employee, the employee id should come in sequence, i.e it should assign 2 by default, if he have not requested a

  • Web Server 6.1 and ClassNotFoundException: oracle.jdbc.driver.OracleDriver

    I am trying to set up the Oracle jdbc on Sun ONE Web Server Enterprise Edition 6.1 but do not seem to be having any luck. It seems that OCI and thin fails. I have installed the Oracle client in the folder c:\oracle\ora92. I have selected the followin

  • Two MAJOR Safari 6 issues...

    First is the "Search Google Or Enter An Address" bar, before if I wanted to go to Walmart.com all I would have to do is type Walmart and Safari would add the ".com" for me. Now if I just type Walmart it will Google search for Walmart instead of takin

  • Mod Operator malfunctioning

    See the following code two different Result for the same thing First Code with Output which is Wrong System.out.println( "Mod of 015110 % 7 ===> " + ( 015110 % 7 ) ); Mod of 015110 % 7 ===> 1 Now look at this Code with Output which is Correct System.