本文整理匯總了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();
}