javax.swing.text.html.HTML.Tag#javax.swing.text.MutableAttributeSet源码实例Demo

下面列出了javax.swing.text.html.HTML.Tag#javax.swing.text.MutableAttributeSet 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: wpcleaner   文件: MWPaneSelectionManager.java
/**
 * Select previous occurrence of text. 
 */
public void selectPreviousOccurrence() {
  StyledDocument doc = textPane.getStyledDocument();
  int lastStart = Integer.MIN_VALUE;
  for (int pos = textPane.getSelectionStart(); pos > 0; pos = lastStart) {
    Element run = doc.getCharacterElement(pos - 1);
    lastStart = run.getStartOffset();
    MutableAttributeSet attr = (MutableAttributeSet) run.getAttributes();
    if ((attr != null) &&
        (attr.getAttribute(MWPaneFormatter.ATTRIBUTE_TYPE) != null) &&
        (attr.getAttribute(MWPaneFormatter.ATTRIBUTE_OCCURRENCE) != Boolean.FALSE)) {
      select(run);
      return;
    }
  }
  selectLastOccurrence();
}
 
源代码2 项目: MeteoInfo   文件: JConsole.java
private AttributeSet setStyle(
        String fontFamilyName,
        int size,
        Color color,
        boolean bold,
        boolean italic,
        boolean underline
) {
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color != null) {
        StyleConstants.setForeground(attr, color);
    }
    if (fontFamilyName != null) {
        StyleConstants.setFontFamily(attr, fontFamilyName);
    }
    if (size != -1) {
        StyleConstants.setFontSize(attr, size);
    }
    StyleConstants.setBold(attr, bold);
    StyleConstants.setItalic(attr, italic);
    StyleConstants.setUnderline(attr, underline);

    setStyle(attr);

    return getStyle();
}
 
源代码3 项目: uima-uimaj   文件: CasAnnotationViewer.java
/**
 * Do bold face by spans.
 */
private void doBoldFaceBySpans() {
  if (this.boldFaceSpans == null || this.boldFaceSpans.length == 0) {
    return;
  }
  int docLength = this.cas.getDocumentText().length();
  int spanLength = this.boldFaceSpans.length - (this.boldFaceSpans.length % 2);
  int i = 0;
  while (i < spanLength) {
    int begin = this.boldFaceSpans[i];
    int end = this.boldFaceSpans[i + 1];
    if (begin >= 0 && begin <= docLength && end >= 0 && end <= docLength && begin < end) {
      MutableAttributeSet attrs = new SimpleAttributeSet();
      StyleConstants.setBold(attrs, true);
      StyledDocument doc = (StyledDocument) this.textPane.getDocument();
      doc.setCharacterAttributes(begin, end - begin, attrs, false);
    }
    i += 2;
  }
}
 
源代码4 项目: howsun-javaee-framework   文件: AnalizeWebParse.java
public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) {
	if (t == HTML.Tag.IMG) {
		// get a src
		String src = (String) a.getAttribute(HTML.Attribute.SRC);
		if (src == null) {
			return;
		}

		if (Pattern.matches(regex, src)) {
			imgs.add(src);
		}
	}
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    /* See above note in the case that parameter==1 */
    Boolean value = ( parameter != 0 ? True : False );

    target.addAttribute(swingName, value);

    return true; /* true indicates we were successful */
}
 
源代码6 项目: openjdk-8   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target)
{
    /* TODO: There's some ambiguity about whether this should
       *set* or *toggle* the attribute. */
    target.addAttribute(swingName, True);

    return true;  /* true indicates we were successful */
}
 
源代码7 项目: openjdk-8-source   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码8 项目: MobyDroid   文件: JTermDocument.java
public void write(String text, MutableAttributeSet attrs) {
    try {
        insertString(getLength(), text, attrs);
        limit = getLength();
        caret.setDot(limit);
    } catch (BadLocationException e) {
    }
}
 
源代码9 项目: Bytecoder   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target)
{
    if (swingValue == null)
        target.removeAttribute(swingName);
    else
        target.addAttribute(swingName, swingValue);

    return true;
}
 
源代码10 项目: cacheonix-core   文件: TextPaneAppender.java
public
void setFontSize(int size) {
  Enumeration e = attributes.elements();
  while (e.hasMoreElements()) {
    StyleConstants.setFontSize((MutableAttributeSet)e.nextElement(),size);
  }
  return;
}
 
源代码11 项目: jdk1.8-source-analysis   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码12 项目: openjdk-jdk9   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target)
{
    /* TODO: There's some ambiguity about whether this should
       *set* or *toggle* the attribute. */
    target.addAttribute(swingName, True);

    return true;  /* true indicates we were successful */
}
 
源代码13 项目: ObjectLogger   文件: Html2Text.java
@Override
public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
    if (stringBuilder.length() != 0
            && t.isBlock()
            && !stringBuilder.toString().endsWith(lineBreak)) {
        stringBuilder.append(lineBreak);
    }
}
 
源代码14 项目: netbeans   文件: JavadocRegistry.java
public @Override void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
    if (t == HTML.Tag.BODY) {
        try {
            this.in.close ();
        } catch (IOException ioe) {/*Ignore it*/}
    }
}
 
源代码15 项目: dragonwell8_jdk   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    /* See above note in the case that parameter==1 */
    Boolean value = ( parameter != 0 ? True : False );

    target.addAttribute(swingName, value);

    return true; /* true indicates we were successful */
}
 
源代码16 项目: dragonwell8_jdk   文件: RTFAttributes.java
public boolean setDefault(MutableAttributeSet target)
{
    if (swingDefault != rtfDefault ||
        ( target.getAttribute(swingName) != null ) )
      target.addAttribute(swingName, Boolean.valueOf(rtfDefault));
    return true;
}
 
源代码17 项目: openjdk-jdk8u-backup   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target)
{
    /* TODO: There's some ambiguity about whether this should
       *set* or *toggle* the attribute. */
    target.addAttribute(swingName, True);

    return true;  /* true indicates we were successful */
}
 
源代码18 项目: jdk8u-jdk   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target)
{
    if (swingValue == null)
        target.removeAttribute(swingName);
    else
        target.addAttribute(swingName, swingValue);

    return true;
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码20 项目: jdk8u-jdk   文件: RTFAttributes.java
public boolean setDefault(MutableAttributeSet target)
{
    if (swingDefault != rtfDefault ||
        ( target.getAttribute(swingName) != null ) )
      target.addAttribute(swingName, Boolean.valueOf(rtfDefault));
    return true;
}
 
源代码21 项目: Java8CN   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    /* See above note in the case that parameter==1 */
    Boolean value = ( parameter != 0 ? True : False );

    target.addAttribute(swingName, value);

    return true; /* true indicates we were successful */
}
 
源代码22 项目: radiance   文件: ButtonGroupDemo.java
private static void toggleStyleInSelection(JTextPane textPane, Object style) {
    MutableAttributeSet attrSet = new SimpleAttributeSet();
    // Add or remove the style on the entire selection
    attrSet.addAttribute(style, !hasStyleInSelection(textPane, style));
    textPane.getStyledDocument().setCharacterAttributes(textPane.getSelectionStart(),
            textPane.getSelectionEnd() - textPane.getSelectionStart(),
            attrSet, false);
}
 
源代码23 项目: jdk8u-jdk   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码24 项目: openjdk-jdk8u   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码25 项目: hottub   文件: RTFAttributes.java
public boolean setDefault(MutableAttributeSet target)
{
    Number old = (Number)target.getAttribute(swingName);
    if (old == null)
        old = swingDefault;
    if (old != null && (
            (scale == 1f && old.intValue() == rtfDefault) ||
            (Math.round(old.floatValue() * scale) == rtfDefault)
       ))
        return true;
    set(target, rtfDefault);
    return true;
}
 
源代码26 项目: PolyGlot   文件: PGrammarPane.java
public void addImage(ImageNode image) {
    try {
        MutableAttributeSet inputAttributes = getInputAttributes();
        inputAttributes.removeAttributes(inputAttributes);
        StyleConstants.setIcon(inputAttributes, new ImageIcon(image.getImagePath()));
        inputAttributes.addAttribute(PGTUtil.IMAGE_ID_ATTRIBUTE, image.getId());
        imageReplaceSelection(" ");
        inputAttributes.removeAttributes(inputAttributes);
    } catch (IOException e) {
        IOHandler.writeErrorLog(e);
        InfoBox.error("Image Insertion Error", "Unable to insert image: "
                + e.getLocalizedMessage(), core.getRootWindow());
    }
}
 
源代码27 项目: TencentKona-8   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码28 项目: Java8CN   文件: RTFAttributes.java
public boolean setDefault(MutableAttributeSet target)
{
    if (swingDefault != rtfDefault ||
        ( target.getAttribute(swingName) != null ) )
      target.addAttribute(swingName, Boolean.valueOf(rtfDefault));
    return true;
}
 
源代码29 项目: jdk8u-jdk   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    Number swingValue;

    if (scale == 1f)
        swingValue = Integer.valueOf(parameter);
    else
        swingValue = new Float(parameter / scale);
    target.addAttribute(swingName, swingValue);
    return true;
}
 
源代码30 项目: jdk8u_jdk   文件: RTFAttributes.java
public boolean set(MutableAttributeSet target, int parameter)
{
    /* See above note in the case that parameter==1 */
    Boolean value = ( parameter != 0 ? True : False );

    target.addAttribute(swingName, value);

    return true; /* true indicates we were successful */
}