📄 editorpanertf.java
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.IOException;
public class editorpaneRTF extends JFrame
{
JEditorPane jeditorpane = new JEditorPane();
public editorpaneRTF()
{
super("JEditorPane application");
Container contentPane = getContentPane();
jeditorpane.setEditable(false);
String url = "file:" + System.getProperty("user.dir") +
System.getProperty("file.separator") +
"document.rtf";
try {
jeditorpane.setPage(url);
}
catch(IOException e) {}
contentPane.add(jeditorpane);
}
public static void main(String args[])
{
final JFrame f = new editorpaneRTF();
f.setBounds(100, 100, 300, 300);
f.setVisible(true);
f.setBackground(Color.white);
f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -