當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。