本文整理匯總了Java中javax.swing.JEditorPane.setFocusable方法的典型用法代碼示例。如果您正苦於以下問題:Java JEditorPane.setFocusable方法的具體用法?Java JEditorPane.setFocusable怎麽用?Java JEditorPane.setFocusable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JEditorPane
的用法示例。
在下文中一共展示了JEditorPane.setFocusable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LongMessageDialog
import javax.swing.JEditorPane; //導入方法依賴的package包/類
/**
* Creates a dialog to display a long message.
*
* @param owner
* the owner window in which the dialog is displayed
* @param i18nKey
* the i18n key
* @param message
* the actual message
* @param i18nArgs
* additional i18n arguments
* @since 6.5.0
*/
public LongMessageDialog(Window owner, String i18nKey, String message, Object... i18nArgs) {
super(owner, i18nKey, ModalityType.APPLICATION_MODAL, i18nArgs);
JEditorPane textComponent = new ExtendedHTMLJEditorPane("text/html", message);
// so it does not steel ENTER from the default button
textComponent.setFocusable(false);
StyleSheet css = ((HTMLEditorKit) textComponent.getEditorKit()).getStyleSheet();
css.addRule("body { margin : 0; font-family : sans-serif; font-size : 9px; font-style : normal; }");
css.addRule(".error { font-weight:bold; color:red; font-style:plain; }");
css.addRule("code { font-weight:bold; color:#000088; }");
textComponent.setEditable(false);
JScrollPane scrollPane = new ExtendedJScrollPane(textComponent);
scrollPane.setBorder(createBorder());
layoutDefault(scrollPane, NORMAL, makeCloseButton());
}