Monday, 15 June 2015

java - JEditorPane component text alignment and background -



java - JEditorPane component text alignment and background -

hey all, have 2 jeditorpane in gui, image 2 hyperlinks. although in netbeanside align them together, page editorpane appears shifting right everytime , pretty annoying. i'm trying remove pointless white background failing.

here's setup them:

private void initeditorpane(jeditorpane editorpane) { editorpane.setborder(null); editorpane.setcontenttype("text/html"); editorpane.seteditable(false); editorpane.setopaque(false); editorpane.addhyperlinklistener(new hyperlinklistener() { @override public void hyperlinkupdate(hyperlinkevent e) { if (e.geteventtype() == hyperlinkevent.eventtype.activated) { launchhyperlink(e); } } }); }

i not sure if it's above causing problems, or this:

pagetxtcomp.settext("<html>&nbsp;<a href='" + ac.getpage() + "'>" + ac.getpage() + "</a>&nbsp;</html>"); emailtxtcomp.settext("<html>&nbsp;<a href='mailto://" + ac.getemail() + "'>" + ac.getemail() + "</a>&nbsp;</html> ");

how can improve alignment?

how can remove white background? in properties, i've tried choosing matching background colour panel, not trick.

you can document pane. cast styleddocument , utilize setparagraphattributes() setting desired alignment or alter alignment adding < p > < / p > tags specifying alignment there.

for background seek set opaque false pane.

java swing user-interface jcomponent jeditorpane

No comments:

Post a Comment