logo       

RE: setting css on ulchtmlpane: msg#00149

java.ulc.devel

Subject: RE: setting css on ulchtmlpane

Hi Robert,

You can use CSS in ULCHTMLPane by including a Link to the CSS from your HTML
text or by using Style tag in the Head.

Please see the snippet at the end of this mail.

ULCHTMLPane is based on Swing's JEditorPane and will support CSS to the
extent that JEditorPane supports it.

Thanks and regards,

Janak

>-----Original Message-----
>From: ulc-developer-admin@xxxxxxxxxxxxxxx
>[mailto:ulc-developer-admin@xxxxxxxxxxxxxxx]On Behalf Of
>robert.munsky@xxxxxxxxxxxxxx
>Sent: Monday, July 24, 2006 10:08 AM
>To: Ulc-Developer@xxxxxxxxxxxxxxx
>Subject: [ULC-developer] setting css on ulchtmlpane
>
>
>Hello,
>
>is there a way to set the css for an ULCHTMLPane? I did not find any
>method to do it. Do I need an ULCExtension for that (doing smth. with
>the basic comp)?
>
>Thanks for any info in advance,
>
>Robert

---------------
HTML File: htmlfile.html

Authors may link this style sheet to their source HTML document with the
LINK element:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd";>
<HTML>
<HEAD>
<style type="text/css">
body {
color: blue;
background-color: yellow;
}
p {
line-height: 2em;
}
</style>

<LINK href="special.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<P class="special">This paragraph should have special red text.
</BODY>
</HTML>

------------------------------

CSS File: special.css

P.special {
color : red;
}

------------------------
ULC App:


import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.BorderFactory;
import com.ulcjava.base.application.ULCBoxPane;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCHtmlPane;
import com.ulcjava.base.application.util.Color;
import com.ulcjava.base.development.DevelopmentRunner;

public class HTMLPaneSnippet extends AbstractApplication {


public void start() {

final ULCFrame frame = new ULCFrame(
"HTMLPaneSnippet");
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);

ULCBoxPane content = new ULCBoxPane(true);

final ULCHtmlPane pane = new ULCHtmlPane();

content.add(ULCBoxPane.BOX_EXPAND_EXPAND, pane);

pane.setPage("file://localhost/C:\\htmlfile.html");

frame.add(content);
frame.setSize(300, 300);
frame.setVisible(true);
}

public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(HTMLPaneSnippet.class);
DevelopmentRunner.main(args);
}
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise