I develop some projects when I drag the words and click on the special button.
I want to tag around a word (with red color starting and end tag) (please see the exam picture) but when it's initially tagged & amp; The end of the text, it takes up the space (like picture 2). When I pull that place, no real location (white space or "no" - no, never), it's just empty space!
I can not choose that place!
PIC LINK
Here my code is below:
attribute:
static final color TAG_COLOR = new color (255 , 50, 50); Fixed final color PLAIN_TXT_COLOR = new color (0, 0, 0); Public Stable SimpleAttributeSet plainAttr = New SimpleAttributeSet (); Public Static SimpleAttributeSet Tag Attr = New SimpleAttributeSet (); StyleConstants.setAlignment (plain attributes, style consultants. ALIGN_JUSTIFIED); StyleConstants.setForeground (Plain, PLAIN_TXT_COLOR); StyleConstants.setFontSize (Plain, 11); StyleConstants.setBold (Plain, False); StyleConstants.setAlignment (Tag Attract, StyleConstant .ALIGN_JUSTIFIED); StyleConstants.setForeground (Tag Alt, TAG_COLOR); StyleConstants.setFontSize (Tag Entry, 11); StyleConstants.setBold (TagAttre, True);
Tagging function:
public static zero tag_function () {string tagname = "tagmark"; Int start_sel = main edit text. Selection of gadget selection (); Int end_sel = main edit text .get selection (ultimately); String selected = mainEditText.getSelectedText (); Style document doc = main edit text. Gate style document (); If selected (== zero) selected. ISEEplay ()) returned; Try {String bTag = "__B:" + taggedName + "__"; String tag = "__e:" + tag name + "__"; Doc.insertString (start_sel, bTag, tagAttr); Doc.insertString (start_sel + bTag.length () + selected.length (), etag, tag etter); } Hold (exception e) {e.printStackTrace (); }}
I have also worked on the possibility of all the features options (some types of fonts, all types of systems; center, right, left, appropriate)
Can someone give a piece of advice ???
I solved it. My solution ..
I made "textPane.setContentType (" html / text ") in the main source, so stupid. Lt; p & gt; & lt; div & gt; tag .. So the paragraph got worse .. Thanks anyway.
Comments
Post a Comment