本文整理汇总了Java中javax.swing.JEditorPane.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java JEditorPane.setMargin方法的具体用法?Java JEditorPane.setMargin怎么用?Java JEditorPane.setMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JEditorPane
的用法示例。
在下文中一共展示了JEditorPane.setMargin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureEditor
import javax.swing.JEditorPane; //导入方法依赖的package包/类
void configureEditor(JEditorPane editor) {
final Dictionary<URL, Image> imageCache = ((SwingPlatform) document.getPlatform()).imageCache;
editor.setEditorKit(new HTMLEditorKit() {
@Override
public javax.swing.text.Document createDefaultDocument() {
HTMLDocument result = (HTMLDocument) super.createDefaultDocument();
try {
result.setBase(document.getUrl().toURL());
} catch (MalformedURLException e) {
e.printStackTrace();
}
result.putProperty("imageCache", imageCache);
return result;
}
});
editor.setMargin(new Insets(0,0,0,0));
editor.setOpaque(false);
editor.setEditable(false);
}
示例2: createComponent
import javax.swing.JEditorPane; //导入方法依赖的package包/类
public JComponent createComponent() {
JPanel panel = new JPanel();
JPanel console = new JPanel();
panel.setLayout(new BorderLayout());
final JEditorPane text = new JTextPane();
text.setMargin(new Insets(8, 8, 8, 8));
text.setCaretColor(new Color(0xa4, 0x00, 0x00));
text.setBackground(new Color(0xf2, 0xf2, 0xf2));
text.setForeground(new Color(0xa4, 0x00, 0x00));
Font font = findFont("Monospaced", Font.PLAIN, 14, new String[]{
"Monaco", "Andale Mono"});
text.setFont(font);
JScrollPane pane = new JScrollPane();
pane.setViewportView(text);
pane.setBorder(BorderFactory.createLineBorder(Color.darkGray));
panel.add(pane, BorderLayout.CENTER);
console.validate();
final TextAreaReadline tar = new TextAreaReadline(text,
getString("Wellcom") + " \n\n");
RubyInstanceConfig config = new RubyInstanceConfig() {
{
//setInput(tar.getInputStream());
//setOutput(new PrintStream(tar.getOutputStream()));
//setError(new PrintStream(tar.getOutputStream()));
setObjectSpaceEnabled(false);
}
};
Ruby runtime = Ruby.newInstance(config);
tar.hookIntoRuntimeWithStreams(runtime);
run(runtime);
return panel;
}