May*_*ngh 2 java swing jtextpane
我在我的应用程序中使用Jtextpane.我需要在jtextpane中添加一些像[PKG-MEDIA]的标签.我希望用户不要编辑这个标签,而他可以在jtextpane中编辑其他文本.
public static void main(String args[]) {
JFrame j = new JFrame("Hello!");
j.setSize(200, 200);
JTextPane k = new JTextPane();
k.setFont(new Font("Akshar Unicode Regular", Font.PLAIN, 17));
k.setText("this is a test code [PKG-MEDIA]. I want to make this tag [PKG-1234] not editable");
j.add(k);
j.setVisible(true);
j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1382 次 |
| 最近记录: |