Hitting CR puts p style=margin-top: 0 in HTMLEditorKit, how to change?

Hello all, I notice that when I hit enter in my JTextPane, java puts in
<p style="margin-top: 0">some text</p> around the line of text.
this looks fine in the JTextPane, but if I save the contents and view
in a web browser (or other html viewers) I see what appears to be a line break between each line. I believe this is because there is no bottom margin. When I add bottm margin style, I see one line after another with no emtpy lines in between them.
so my question is, how
can I change the action associated with hitting CR to insert
<p style='margin-top:0; margin-bottom:0'>some text</p>
if so, can someone please point me to an example.
thank you

think I am on to something, but not sure this is the best way
Style mainStyle = document.getStyle(StyleContext.DEFAULT_STYLE);
Style bottomMarginPlusMainStyle = textPane.addStyle("p", mainStyle);
StyleConstants.setSpaceBelow(bottomMarginPlusMainStyle, 0.0f);
any other suggestions, after this I see a
<style>
p {margin-bottom: 0.0}
</style>
at the top of my source code for JTextPane

Similar Messages

  • Unwanted margin-top and margin-bottom styles

    Editing a template-based page in Contribute CS3, there is no
    List Properties option (Help file says "Note: This option is not
    available for template-based pages or in tables.")
    So how do I specify a class for a <ul> entry?
    If I create the text first with a chosen class, then convert
    to "Bulleted List", I end up with:
    <ul style="margin-top: 0;">
    <li><span class="reversed" style="margin-top: 0;
    margin-bottom: 0;">
    - which is not what I want (I want to set a non-zero bottom
    margin, for example).
    I am using an external CSS file, and there is no UL or LI
    entry in the list of HTML styles that can be chosen in Contribute.
    Should there be?
    Is there some way of setting default styles for these tags in
    the dwt template?
    John Geddes

    From what I know, in Contribute their is some tag users can't
    apply style on.
    Typical are <div> and <ul>, mainly because you
    can't create them or select them. Only the CSS can give style to
    these elements and have to be defined by the website
    admin/designer.
    If their is no style, default will apply (and margin depends
    from browser). And if the way paragraph are marked (see
    Admin>Users>Modify, Space between paragraphs either one line
    using CSS and will ad inline styles to your tag <ul
    style="margin: 0 0;" or two line using <p> which let
    everything be controlled by the CSS.
    A trick is to have a class style defined in the CSS and a
    template element where users can apply the style.
    For exemple putting a div in a table cell (I know this is
    hell) in your editable region in your Template will allow users to
    apply the class style to the selection (the table) and the cascade
    will apply the style to the div or your list.
    CSS:
    table div, table ul {
    margin: 0 0 2em 0;
    or
    td div , td ul {
    margin: 0 0 2em 0;
    But again, you need to be or have a very kind webmaster.
    Usually, list are already design in the CSS by the webmaster
    depending the region you are, exemple:
    #content ul {
    margin: 0 0 2em 0;
    #head ul {
    margin: 0.5em 0 1em 0;
    Hope it helps.

  • Style:Margin added to P tag in Contribute 3

    I'm cutting and pasting text from a basic text editor into
    Contribute 3 and for whatever reason it seems intent on adding
    "style='margin-bottom: 0;'" or " style='margin-top:0;
    margin-bottom: 0;'" to my p tags. This is interfering with my CSS
    styles. Why is this happening and how can I get rid of it?
    There is no instance of this manual style in the template
    that I'm using to constuct the page. Any help would be greatly
    appreciated.
    Does this problem go away in Contibute 4?
    David

    There's an option in Contribute 4, not sure about 3, where
    you can tell Contribute to use inline css or just plain p tags.
    Try going to administer website, highlight a role, click edit
    role settings, select editing on the left menu, then under the
    paragraph spacing heading select the "Two lines" radio button.
    Not sure if its the same in Contribute 3, but I believe the
    option is there somewhere.

  • [svn:fx-trunk] 11575: Put default style declarations into one class per application or module.

    Revision: 11575
    Author:   [email protected]
    Date:     2009-11-09 11:34:57 -0800 (Mon, 09 Nov 2009)
    Log Message:
    Put default style declarations into one class per application or module.
    Generate all the default styles in one class instead of a class for each style. The name of the style class will be based on the application or module name. An application named ?\226?\128?\156foo?\226?\128?\157 will have a style class named ?\226?\128?\156_foo_Style?\226?\128?\157. The idea is to allow applications to be compiled with different themes and get their owns styles. Currently this is not possible because a global style in both themes will have the same class name, _globalStyle. Whatever class the top-level application loads the sub-applications and modules will have to use the same class because of the flash player first-class-in-wins rule. Now each application and module will have their own style class.
    QE notes: None.
    Doc notes: None.
    Bugs: SDK-22454
    Reviewer: Paul, Pete
    Tests run: checkintests, all mustella tests.
    Is noteworthy for integration: No.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22454
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleDef.vm
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.java

    Revision: 11575
    Author:   [email protected]
    Date:     2009-11-09 11:34:57 -0800 (Mon, 09 Nov 2009)
    Log Message:
    Put default style declarations into one class per application or module.
    Generate all the default styles in one class instead of a class for each style. The name of the style class will be based on the application or module name. An application named ?\226?\128?\156foo?\226?\128?\157 will have a style class named ?\226?\128?\156_foo_Style?\226?\128?\157. The idea is to allow applications to be compiled with different themes and get their owns styles. Currently this is not possible because a global style in both themes will have the same class name, _globalStyle. Whatever class the top-level application loads the sub-applications and modules will have to use the same class because of the flash player first-class-in-wins rule. Now each application and module will have their own style class.
    QE notes: None.
    Doc notes: None.
    Bugs: SDK-22454
    Reviewer: Paul, Pete
    Tests run: checkintests, all mustella tests.
    Is noteworthy for integration: No.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22454
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleDef.vm
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.java

  • InD CS6, what happened to margin-top CSS property in EPUB?

    I have been playing around with EPUB export in InDesign CS6. What surprised me the most is the missing CSS property. What's the reason to leave margin-top property out from the paragraph styles? Is this a feature, a bug or am I just doing something wrong? Others noticed this also?
    Other thing which surprised me is the unit they use in margins. Earlier it was em but now it's pixel. Any way to change this?

    @Steve,
    When I turned the computer on this morning it said updates were available: CS6 2.02, I believe-although I can't remember for sure or find that version listed now on any "About" screen. I just clicked "Yes" to update. I'm not sure why they arrived for me but not you. I did have a problem with Acrobat X quitting yesterday (another CS6 bug) and had to deactivate and reactivate the package to get Acrobat to work. Don't know it that would affect updates though. I have never seen any availabe when I checked.
    Anyway, the first thing I tested after the updates I received were installed was the epub export and nothing had changed regarding top spacing. Seems like we either have to add bottom spacing on previous paragraphs, use forced line breaks, edit CSS files, or create in CS5.5. For me, the latter still seems the easiest way to create an e-book after creating the print book.

  • When I make a contact sheet on Iphoto is it possible to put a title on top of the page, that is not a title of one of the photos?

    Is it possible to put a title on top of the page in a contact sheet on Iphoto?

    No.  But you can create a text file for TextEdit, Word, Pages or other text application that you use, put a title at the top and print it on the already printed contact sheet.  Just make the top margin in iPhoto's contact layout  large enough so the title can be printed there by the other app.

  • AS3 TextField margin-top limitation

    Hi, there!
    It seens like Flash TextField have many format limitations, like margin-top or margin-bottom.
    Is there a way to simulate it? I need that the hit area of the textfield start at y=0, but the text start at y=10. As I also need the text cursor, the current approach is: change the textfield Y when it receives focus. When the focus out, the textfield get back to the start positions and I insert a linebreak character at the start with a negative indent, to simulate the top margin... this is a very ugly solution... is there any best?
    Thank you!
    CaioToOn!

    I think rob day's suggestion has merits too. Either way I
    don't see any other way but inserting an extra element that adjusts
    the spacing somehow.
    Yes, it sucks that the majority of styling declarations are
    not supported but, on the other hand, it is not such a big deal to
    insert an element especially with the powerful XML tools in AS3.
    You can create a function that will preprocess all XML "page"
    nodes and insert an extra <p> tag after each <p> tag
    (see attached code)
    I did not check if code works - it is just a concept.
    The same approach can be taken with rob's suggestion but
    inside the <p> element that comes with the XML.

  • Twitter api and $("#Stage").css("margin","top") issue

    I put the twitter api from commonedge.org into my web project.
    But I couldn't get it to work until i removed this from my stage:
    $("#Stage").css("margin","top").
    Once it was removed, the twitter api worked fine... 
    when I put it back in, it stops working again.
    I'm puzzled why this is?
    Anyone have an idea?

    Ok,... so I figured out this was a line from hell... and I dont even know where I got it from
    (as I've been juggling learning edge's actions/codes and messing things up).
    Not only the twitter, but nothing else worked, symbols, actions, mouse and touch functions until I removed this line.
    Once I deleted $("#Stage").css("margin","top") from the stage... it's all happy again
    (until I put something else in that i have no clue what does)
    it would be interesting though, if anyone knows if there EVER would be a reason to have this line?
    And why it would/could kill all other functions?

  • I need a 3-inch top margin on the first page of my letter and a 1-inch top margin on subsequent pages. How can I do this?

    This is so easy in Word but I have spent 2 hours trying to figure it out in Pages. To print on my boss' stationary I need a 3-inch margin on the first page and a 1-inch top margin on the subsequent pages. When I change the top margin on page 2 in Inspector, it changes the top margin on page 1 to 1-inch as well. In Word this is an intuitive, 2-step process.

    Hi Dan,
    Don't confuse "intuitive" with "what I'm used to."
    Pages has "Document" margins, which apply to all pages of the document, and "Layout" margins, which may be set to provide additional margin space in a layout.
    Start by setting the Document margins to 1" all around. This is the default setting for the (word processor) Blank templates. You can check it (and adjust it if necessary) in the Inspector. Open an Inspector window (View > Show Inspector). Choose the Document Inspector (first button).
    Switch to the Layout Inspector (second button). Remember that you already have a 1 inch top margin, so to produce a 3 inch margin before the beginning of this layout, you'll need to set a 2 inch Layout margin "Before" the layout.
    Hmmm... Depending what you're defining as 'steps' for the process in word, and considering that the document margins in Numbers are preset to 1" all around, this appears to be a 1-step process in Numbers:
    Step 1: Set the "Before" Layout margin to 2 inches.
    Done.
    Regards,
    Barry

  • ITunes DJ just puts songs at the top of the list

    Ok, something which is really annoying me is that if you want to play a song in iTunes DJ, it just puts it at the top of the list, and all the songs which were before it are still in their place. I want to select a song to play, and start from there as the top of the list, skipping all the songs before it, like what happened in Party Shuffle. Is there any way to do this? Any Applescripts or hidden settings? Thanks for any help

    http://discussions.apple.com/category.jspa?categoryID=149

  • What do I do with the dll files I was told to put on my desk top when unistalling itunes due to R6034 problems?

    What do I do with dll files I was told to put on my desk top when uninstalling itunes due to a R6034 problems when installing a new update.

    Have you successfully reinstalled iTunes, wc180? If so, and if everything's working right now, it should be safe to delete those dll files on the desktop now.

  • How can I put one "shape" on top of another in pages?

    Hi all:
    I'm trying to do something pretty simple.  I made some shapes using the "shapes" tool in the toolbar.  I want to put one shape on top of (or in front of) another but it gives me the masking tool instead.  I tried putting a shap in the background but that didn't work either.  it tends to snap the shape I move to it right back to where it was when I tried to move it.  How can I do this?
    Thanks!

    I really don't understand what you are doing.
    I inserted two shapes with their default settings and I got what you see.
    I unchecked the box "Object causes wrap" but it's usefull when there are text objects in the page.
    Yvan KOENIG (VALLAURIS, France) samedi 7 avril 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.3
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

  • I click on a link and it goes there in Firefox but it doesnt put the browser on top of what I am doing. How do i fix this?

    I click on a link and it goes there in Firefox but it doesn't put the browser on top of what I am doing. It used to do that, how can I make it go back to doing that?

    I am using Robo Form like I have for years and when I click on a website to open it goes there and puts in the username and password and opens in a new tab but Robo Form stays on top and Firefox is underneath it and it used to automatically go to Firefox and put it on top and now it doesnt do that anymore.

  • How do I get rid of this annoying tag at the end of my wordpress posts: // ![CDATA[ div id="" class="_mp3rocket_overlay_style" style="left: ; top: ; width: ;

    Whenever I post on my blog, this shows up at the bottom:
    <pre><nowiki>// <![CDATA[
    <div id="" class="_mp3rocket_overlay_style" style="left: ; top: ; width: ; height: ">
    // ]]>
    </nowiki></pre>
    How do I get rid of it?

    Does the name mp3rocket ring a bell?? It may be related to a browser add-on. You could check for and possibly disable or remove such an add-on here:
    orange Firefox button ''or'' classic Tools menu > Add-ons
    Try both the Plugins and Extensions categories.
    If it doesn't seem related to an add-on, perhaps it's something added by a Wordpress plugin, or your blog theme. If you provide a link to your blog, a volunteer here could take a look and see whether they get the same text.

  • How can I put two triggers on top of eachother, and have them both work when clicked?

    I'm creating this slideshow, with before and afters of my work. At the bottom right corner, I want a small frame with the before image. The fullscreen slideshow though, has arrow buttons working as triggers to either go back in the slideshow or move onto the next image. I want the other smaller slideshow at the bottom right corner to sync up with the corresponding "Before" images in the fullscreen slideshow. So, my idea was get both of the forward/back arrow buttons from the widgets and put them on top of eachother, assuming it would advance or go back on both of the widgets.  It's not working though, only the top-most trigger works.
    Simplified version without the mumbo-jumbo!:
    I want to put two triggers on top of eachother, but when I do this, only the top-most trigger functions. Any way to get this to work? or creative ways to get around this?
    Thanks in advance!

    You can't have it click on two things at once. You would have to write some javascript to have one button do both actions. This would not be very easy in Muse so I would say this is not somethingthat is supported in Muse.

Maybe you are looking for