当前位置: 首页>>代码示例>>Java>>正文


Java BasicHTML.updateRenderer方法代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicHTML.updateRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java BasicHTML.updateRenderer方法的具体用法?Java BasicHTML.updateRenderer怎么用?Java BasicHTML.updateRenderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.plaf.basic.BasicHTML的用法示例。


在下文中一共展示了BasicHTML.updateRenderer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: propertyChange

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolTip)e.getSource());
    }
    String name = e.getPropertyName();
    if (name.equals("tiptext") || "font".equals(name) ||
            "foreground".equals(name)) {
        // remove the old html view client property if one
        // existed, and install a new one if the text installed
        // into the JLabel is html source.
        JToolTip tip = ((JToolTip) e.getSource());
        String text = tip.getTipText();
        BasicHTML.updateRenderer(tip, text);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SynthToolTipUI.java

示例2: propertyChange

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SeaGlassLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolTip) e.getSource());
    }
    String name = e.getPropertyName();
    if (name.equals("tiptext") || "font".equals(name) || "foreground".equals(name)) {
        // remove the old html view client property if one
        // existed, and install a new one if the text installed
        // into the JLabel is html source.
        JToolTip tip = ((JToolTip) e.getSource());
        String text = tip.getTipText();
        BasicHTML.updateRenderer(tip, text);
    }
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:19,代码来源:SeaGlassToolTipUI.java

示例3: propertyChange

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolTip)e.getSource());
    }
    String name = e.getPropertyName();
    if (name.equals("tiptext") || "font".equals(name) ||
            "foreground".equals(name)) {
        // remove the old html view client property if one
        // existed, and install a new one if the text installed
        // into the JLabel is html source.
        JToolTip tip = ((JToolTip) e.getSource());
        String text = tip.getTipText();
        BasicHTML.updateRenderer(tip, text);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:20,代码来源:SynthToolTipUI.java

示例4: showCurrentCategory

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
protected void showCurrentCategory() {
  if (currentCategoryComponent != null) {
    tipArea.remove(currentCategoryComponent);
  }

  int currentCategory = tipPane.getCurrentCategory();
  if (currentCategory == -1) {
    JLabel label = new JLabel();
    label.setOpaque(true);
    label.setBackground(UIManager.getColor("TextArea.background"));
    currentCategoryComponent = label;
    tipArea.add("Center", currentCategoryComponent);
    return;
  }

  // tip does not fall in current tip range
  if (tipPane.getModel() == null || tipPane.getModel().getCategoryCount() == 0
    || (currentCategory < 0 && currentCategory >= tipPane.getModel().getCategoryCount())) {
    currentCategoryComponent = new JLabel();
  } else {    
    Category tip = tipPane.getModel().getCategoryAt(currentCategory);

    Object tipObject = tip.getCategory();
    if (tipObject instanceof Component) {
      currentCategoryComponent = (Component)tipObject;
    } else if (tipObject instanceof Icon) {
      currentCategoryComponent = new JLabel((Icon)tipObject);
    } else {
      JScrollPane tipScroll = new JScrollPane();
      tipScroll.setBorder(null);
      tipScroll.setOpaque(false);
      tipScroll.getViewport().setOpaque(false);
      tipScroll.setBorder(null);

      String text = tipObject == null?"":tipObject.toString();

      if (BasicHTML.isHTMLString(text)) {
        JEditorPane editor = new JEditorPane("text/html", text);
        editor.setFont(tipPane.getFont());
        BasicHTML.updateRenderer(editor, text);
        SwingXUtilities.setHtmlFont(
                (HTMLDocument) editor.getDocument(), tipPane.getFont());
        editor.setEditable(false);
        editor.setBorder(null);
        editor.setMargin(null);
        editor.setOpaque(false);
        tipScroll.getViewport().setView(editor);
      } else {
        JTextArea area = new JTextArea(text);
        area.setFont(tipPane.getFont());
        area.setEditable(false);
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        area.setBorder(null);
        area.setMargin(null);
        area.setOpaque(false);
        tipScroll.getViewport().setView(area);
      }

      currentCategoryComponent = tipScroll;
    }
  }
  
  tipArea.add("Center", currentCategoryComponent);
  tipArea.revalidate();
  tipArea.repaint();
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:68,代码来源:BasicCategoryUI.java


注:本文中的javax.swing.plaf.basic.BasicHTML.updateRenderer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。