本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}