How to use CSS in JEditorPane?

I want to dispalay a XML file in JEditorPane with CSS. I have do the following:
StyleSheet stylesheet=new StyleSheet();
FileReader in=new FileReader(cssFileName);
stylesheet.loadRules(in,null);
HTMLEditorKit kit=(HTMLEditorKit)ShowPane.getEditorKitForContentType("text/html");
kit.setStyleSheet(stylesheet);
ShowPane.setEditorKit(kit);
ShowPane.setPage(this.getClass().getResource(xmlFileName));
But the stylesheet seems have no effect on the output of the JEditorPane-ShowPane.why?

JEditorPane with StyleSheets, CSS, is partially supported by Java 2, on level 1, but not perfect. To load it, you should invoke it's loadRules method, passing it a Reader corresponding to the StyleSheet file, using the method : public void loadRules(Reader in, URL ref) throws IOException

Similar Messages

  • How to use CSS option in Answers

    Hi,
    I have around 5 Dashboards, which includes close to 20 Reports.
    I would like to learn how I can format column name (like Font, Size) and data appearance in each report.
    Currently am doing it manually, one column by one column. I would like to know how to use CSS option.
    Regards,
    Jitendra

    The easiest way is to do this is to create a new "skin" for your dashboards or either modify the default. The location of the default folder is /res/s_oracle10/b_mozilla/views.css. The view.css file is where you can go and customize the classes. For example, if you want to customize the Pivot Table Row Header, search for .PTRH and then you can alter the existing formatting or add additional specifications.

  • How to use css in oracle forms

    Hello,       I am using oracle forms 11g with weblogic server 10.3.5 at windows 7.I have to use CSS in oracle forms.i have tried to search it but no profit.please some one else tell me that how can use css in oracle forms. Thnak You regards aaditya

    Hi
    As Francois pointed out Oracle forms has nothing to do with html based technology. The way you can get the equivalent effect of creating consistancy in the way your objects are displayed is by creating a set of items you want and alter their apperance and behaviour and place them into object libraries (one library should do the trick).  From there you subclass all of you forms items off these libraries.
    Regards
    Quintin

  • How to use CSS to create horizontal nav bar in Dreamweaver CS6

    How to use CSS to create horizontal nav bar in Dreamweaver CS6

    One of the ways to do it is this: Tryit Editor v1.9
    You can also use floats to get something to the same effect.

  • How to use CSS Class

    Dear Friends,
    I am using Apex 4.1. i have made a below CSS class. i just want to know where i have to paste the below code and from where i have to call it and how?
    I have written this in PAGE Properties-->HTML Header
    <style type="text/css">
    myclass
    width:200px;
    color:orange;
    background-color:#CCCCFF;
    </style>
    calling above on field --- > on HTML Table Cell Attributes. class="myclass"
    but it is not working. Please help me where i am doing wrong. Thanks in advance.
    Regards
    Kamran

    Hi Jozef,
    Thank you so very much for you kind help and consideration on the said issue.
    The issue is resolved.
    i just copied and pasted ur code. now its working. now i have ur email. if u dont mind could i send u mail directly at ur email address if any issue.
    Thanks once again.
    Regards,
    Kamran

  • How to use css in servlet

    out.println("<link rel='stylesheet' type='text/css'");
    out.println(" href='style_shop.css' />");
    i typed above statement in a servlet
    but still doesn't show the style how i can fix it?
    Message was edited by:
    takamai

    is style_shop.css in the correct path on the server?
    If you are using a war file it should be in the root folder of the war.
    or try to give
    out.print("<link rel='stylesheet' type='text/css href='");
    out.print(request.getContextPath() + "/style_shop.css' />'")

  • How to use css code?

    Hi, my name alper,
    I want to design a web page for my girlfriend. The CSS code to do with them, but I have no knowledge about how much information will be used. please I can do with the edge you please assign a mail program code using Turkish...

    You can do this with Edge Code/Brackets but the web design bit is a bit beyond these forums. I'd suggest checking out something like this course - HTML/CSS: Making webpages | Computer programming | Khan Academy - on Khan Academy to get started.
    =Ryan
    [email protected]

  • How to use CSS and images in a plsql-dbms_output reports?

    Hi.
    Windows 2000 SP4
    SQL Developer 1.2.1.32.13
    Java 1.5.0_07
    Oracle 9.2.0.6
    I'm trying to create a plsql-dbms_output report with HTML that uses a stylesheet (CSS) and an image. These seem to be ignored by the report viewer.
    The following example works fine in Internet Explorer 6 but the stylesheet is ignored by the viewer and the viewer does not show the images (shows broken images instead). I've tried with various image types (PNG, GIF and JPEG).
    <!--
    begin
    dbms_output.put_line('<head><link rel="stylesheet" type="text/css" href="file://c:/temp/core.css"/></head><body>');
    dbms_output.put_line('<H1>This is Level-1 Heading</H1>');
    dbms_output.put_line('<H2>This is a Level-2 Heading</H2>');
    dbms_output.put_line('<p>This is regular paragraph text.</p>');
    dbms_output.put_line('<img src="file://c:/temp/fig01.png"><br>');
    dbms_output.put_line('<img src="file://c:/temp/fig01.gif"><br>');
    dbms_output.put_line('<img src="file://c:/temp/fig01.jpg"><br>');
    dbms_output.put_line('</body>');
    end;
    -->
    Is the HTML viewer limited to not support stylesheets and images?
    Thanks in advance.
    Cheers
    Finn Ellebaek Nielsen

    It also seems that links don't work. The mouse cursor changes to a hand when hovering over links and the links are shown in blue and underlined but nothing happens when clicking on them.
    Example:
    <!--
    <html>
    <head><link rel="stylesheet" type="text/css" href="file://c:/temp/core.css"/></head><body>
    <p>First heading</p>
    <p>Second heading</p>
    <H1 id="x1">This is Level-1 Heading</H1>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    a<br>
    <H2 id="x2">This is a Level-2 Heading</H2>
    <p>This is regular paragraph text.</p>
    <img src="file://c:/temp/fig01.png"><br>
    <img src="file://c:/temp/fig01.gif"><br>
    <img src="file://c:/temp/fig01.jpg"><br>
    <p>First heading</p>
    <p>Second heading</p>
    <p>Other document</p>
    </body>
    </html>
    -->

  • How to use CSS to customise ADF component

    I'm not going into skin. However, I want to edit property of ADF component through CSS. How do we do this? Any url link that give complete documentation? (How to represent ADF Component in CSS)
    E.G. I want to set af:column noWrap=true to all table.
    Regards
    Eric H

    Hi,
    just a guess, but give it a try: customize the default Oracle skin as described in the blog post "Customizing BLAF for ADF Faces - easier than Skins for influencing colors and fonts by Lucas Jellema". You don't need to add custom skins, just edit the oracle-desktop.xss file.
    Then you can add a "white-space: nowrap;" property for the appropriate style, which very likely will be AFTableCellDataText. It will be something like this:
    <style name="AFTableCellDataText">
      <property name="white-space">nowrap</property>
    </style>HTH,
    Patrik

  • ANN: How to use CSS to styles a gallery of thumbnails with captions

    Article:
    http://www.tjkdesign.com/articles/how_to_style_thumbnail_and_caption.asp
    Demo:
    http://www.tjkdesign.com/articles/thumbnail_and_caption/gallery_of_thumbnails.asp
    I welcome any comment.
    Thierry
    Articles and Tutorials:
    http://www.TJKDesign.com/go/?0
    The perfect FAQ page:
    http://www.TJKDesign.com/go/?9
    CSS-P Templates:
    http://www.TJKDesign.com/go/?1
    CSS Tab Menu:
    http://www.TJKDesign.com/go/?3

    > That looks very useful and it works great. One thing
    though... when
    > you decrease the font size I get overlapping images.
    (smallest font
    > size). If I decrease the text size one step some of the
    images are
    > overlapping.
    Hi Kim,
    Thanks. I've increased the width of the elements so they
    don't shrink that
    much.
    Worst case scenario, the images should appear as a
    "filmstrip" (at very
    small text-size value) which I think is Okay.
    We can't really on min-width here because we would lose the
    text alignment;
    because unfortunately, we can't add the margin value to the
    image width (as
    we do with width and margin elsewhere).
    *But* if the images' width was set in "EM" rather than "PX"
    then there is
    plenty we could do.
    Thierry
    Articles and Tutorials:
    http://www.TJKDesign.com/go/?0
    The perfect FAQ page:
    http://www.TJKDesign.com/go/?9
    CSS-P Templates:
    http://www.TJKDesign.com/go/?1
    CSS Tab Menu:
    http://www.TJKDesign.com/go/?3

  • How to use css masks in firefox?

    masks not working in firefox

    This guy seems to have it working using SVG, but Firefox is by far and away the most complicated solution of them all. http://www.html5rocks.com/en/tutorials/masking/adobe/?redirect_from_locale=de
    I'm all for standards, evangelically even, but some things (like image masks) they should just accept that everyone needs this and implement.
    Instead of developers, I wish I could direct firefox USERS to the "standards evangelism forum" when websites don't work for them, or we are forced to serve up a 1MB PNG because Mozilla is too stubborn to support image masks.
    Love,
    The Internet.

  • How to use css in a portal component ?

    Ooooops, wrong forum.... sorry.
    Message was edited by: Elad Saar

    Hi
    As Francois pointed out Oracle forms has nothing to do with html based technology. The way you can get the equivalent effect of creating consistancy in the way your objects are displayed is by creating a set of items you want and alter their apperance and behaviour and place them into object libraries (one library should do the trick).  From there you subclass all of you forms items off these libraries.
    Regards
    Quintin

  • Using CSS with Contribute

    I just stumbled upon a small hitch in my get-along.
    While trying to assign an alignment class in Contribute (that
    I had originally created in Dreamweaver) I discovered that I
    couldn't figure out how to accomplish this. I have already created
    a class and it's in the external style sheet, but I can't figure
    out how to associate the picture with the class so that text will
    flow around the image.
    help!
    thanks,
    Ron

    Thanks for the input.  I'm well aware of how to use CSS.  The focus of this discussion was really how to get images out of <p> tags, not how to write a bunch of extra CSS to undo what Contribute really shouldn't be doing to images.
    I am committed to use CSS on my site, but I am also committed to making that CSS easy to use, which mean working at tag and block levels as much as I can, rather than becoming "class happy".  I know I have to use classes to do the left and right alignment, but let me share a specific scenario where CSS shouldn't be used.
    I have an <h2> element that is the full width of my container.  Below that, I have a <p> element for my paragraph.  For my design, I want the paragraph to have 1em of padding.  Now, I want an image banner that is the full width of the container, so it can nest under the <h2> and be the same width.  If I insert the image in Contribute above the <p>, it puts that in a <p> tag.  Now, the image is too wide because it's trying to add padding around something that is already the full width of the page.  I can't add a rule to remove the padding from all images, because that would remove padding from images that need it also.
    I could write a custom CSS class to resolve this issue, but that takes time, adds to my CSS file size and gums up my dropdown menu with an unnecessary class that's only used to solve this one scenario.  Instead, it makes more sense to just break the image out of the paragraph tag and treat it as a block.
    This is an example of what I was trying to get Contribute to do.  I just needed the image tag as such, an image, not an image inside my paragraph padding rules.
    In this case "remove paragraph breaks" is the most logical choice, rather than writing a bunch of CSS to undo Contribute's quirks.

  • Viewing layers - using css

    Hi
    I have just started to use css. When I publish the html page
    which uses the css everything looks great but when I try and view
    the page in deign view I can only see 1 layer - the footer. The
    "prevent overlap box" in the layer panel is not checked and all
    layers are "Visable" and all have the "Eye icon" next to them. I
    have a horrible feeling that I'm being thick!!. I'm using
    dreamweaver MX V6. Can someone PLEASE tell me what I need to do,
    learning css is hard enough and I'm afraid my brain is going to
    explode if I can't sort this out.
    Thanks to anyone taking the time to read this
    Welsh Babe
    If it's any help you can see the page by going to
    http://www.kingsandqueenswales.com/layout.html

    >It can get very confusing for people just staring out.
    Oh boy, ain't dat de troof!
    Jo
    "Osgood" <[email protected]> wrote in
    message
    news:[email protected]...
    > Welsh Babe wrote:
    >
    >> Hi
    >> I have just started to use css. When I publish the
    html page which uses
    >> the css everything looks great but when I try and
    view the page in deign
    >> view I can only see 1 layer - the footer. The
    "prevent overlap box" in
    >> the layer panel is not checked and all layers are
    "Visable" and all have
    >> the "Eye icon" next to them. I have a horrible
    feeling that I'm being
    >> thick!!. I'm using dreamweaver MX V6. Can someone
    PLEASE tell me what I
    >> need to do, learning css is hard enough and I'm
    afraid my brain is going
    >> to explode if I can't sort this out. Thanks to
    anyone taking the time to
    >> read this
    >> Welsh Babe
    >> If it's any help you can see the page by going to
    >>
    http://www.kingsandqueenswales.com/layout.html
    >>
    >
    > I can see all of your layers in v7 of DW design view.
    >
    > However I'm afraid I have bad news. You are not going
    about using css to
    > position your elements in the correct way.
    >
    > Laying out a page using layers, which are absolutely
    positioned, is only
    > going to get you deeper and deeper into trouble.
    >
    > If you are wanting to leap from a table design to an all
    css design then
    > the learning curve is going to be steep and has little,
    or nothing to do
    > with using layers.
    >
    > A good all css design uses <div> containers not
    layers. Although they
    > appear to be the same they are not. It can get very
    confusing for people
    > just staring out.
    >
    > A layer is an absolutely positioned container to which
    you give a top and
    > a left position. IT WILL NOT MOVE FROM THIS POSITION.
    This is usually not
    > desirable. Test out your current construction by using
    the zoom text tool
    > available in most modern browsers. See how quickly the
    page breaks down as
    > the layers being to overlap one another.
    >
    > A <div> container is mearly a box into which you
    load content. You can
    > then give it a position on the page by using margin or
    you can float
    > <divs> to put them side by side.
    >
    > If you know how to use tables then I would strongly
    recomend you stay with
    > them until you know how to position correctly using css.
    You can still use
    > css to style tables, there is nothing wrong with using
    simple tables.
    >
    > If you want to study how to use css correctly for
    positioning take some
    > time out and read through a couple of tutorials:
    >
    >
    >
    http://www.projectseven.com/tutorials/css/qdmacfly/index.htm
    >
    >
    > Tutorial 8 and 9 here
    >
    >
    http://css.maxdesign.com.au/floatutorial/
    >
    >
    >
    >
    >
    >

  • How do I scale a lot of images using CSS in HTML5 and CSS3

    I have a CSS image gallery that displays a larger photo with descriptive text below it, when a thumbnail image is hovered on.
    Each photo has code like that following:
    <a class="thumbnail" >
    <img src="thumbs1/paradethumbs/DSC_0073.jpg" alt="thumbnail picture" />
    <span><img src="pics1/paradepics/DSC_0073.jpg" alt=" " /><br /> 19 - a black faced sheep.</span>
    </a>
    The first source is a thumbnail,  image stored at a size of 72 by 48.
    The second source is an image stored at 600 x 400.
    When the thunbnail is hovered on, the larger photo is displayed at its full size using css.
    There are 20 or so thumbnails in this gallery, and different numbers in other galleries that use the same code.
    The example above is number 19 from 20.
    This works fine on tablets and larger displays.
    When I wish to show it on an Iphone or similar, with a display that is 480 or less wide, I need to scale the larger photo down to 300 wide.
    As the Iphone will have a lower quality of image than a larger display, it will not matter too much if the 600x400 photo is scaled down, and having tried it by giving it an ID with CSS like
    #imagescale{ width:300px; } it looks acceptable. However, as IDs are supposed to be unique, then thats a no go area for the remaining photos.
    My problem is how do I select the second image source shown in bold above, and scale it and the span text by 50%.
    The text is not too important as it can be changed to fit - the image is the main problem.
    I need someting like "if the display is less than 600 and the image is in the pics directory, display it at 300 wide".
    The browser will hopefully  take care of the height.
    Any suggestiosn would be appreciated.
    Howard Walker

    Thanks Nancy. The general idea and the link to the article helped a lot.
    However, the css using using a percentage had unpredictable results when selecting repeated images.
    The first one scales to 50% and then the next scales to 50% of the last one (25%)  and so on ad infinitum, unless you click on another object that is not an image.
    Using a pixel size like 280px rather than a percentage did the trick, but it also involved changing lots of other items before I could get everything to fit.
    Now I have a better knowledge of media queries and how to set them up.
    Best of all, all my image galleries work fine just using css and html. Never thought that would happen.
    Take five stars!
    And the same to David Powers for his great article.
    Howard Walker

Maybe you are looking for