Article View: cn.bbs.comp.lang.java
Article #248Java Swing��JEditor Panel��ʹ��
From: cffile
Date: Tue, 30 Dec 2008 13:46
Date: Tue, 30 Dec 2008 13:46
59 lines
3399 bytes
3399 bytes
JEditorPane�̳�JTextComponent�࣬�����Ҳ����ʹ��
JTextComponent��������������JEditorPane����
��Ҫ��������չ�ֲ�ͬ���͵��ļ���ʽ���ݡ�JEditorPane
֧�ֵ��ļ����������֣���һ���Ǵ��ı����ͣ������͵�
��ʾ��Ϊ��text/plain�����������͵��ļ����������ʹ��
��txt�ļ��������ü��±���Word���ı��༭������༭��
�ڶ�����RTF���ͣ����ʾ��Ϊ��text/rtf������������
���ļ���ɫ�ǣ��ܶ������������������š����Ρ���ɫ��
����Ч���������HTML���ͣ�Ҳ�����������������������
��ҳ���ͣ����ʾ��Ϊ��text/html���������ļ������ڶ�����Ч��
�ı���֮��������ļ��ڼ���ͼƬ���������ӵ���ع��ܡ�
1. JEditorPane���췽��
JEditorPane()������һ���µ�JEditorPane��
JEditorPane(String url)������ϸ��URL�ַ�Ϊ��������
һ��JEditorPane��
JEditorPane(String type,String text)����ָ�����ͺ�
�ַ�text����һ��JEditorPane��
JEditorPane(URL initialPage)������ϸ��URL�ַ�������ֵ
������һ��JEditorPane��
2. JEditorPane����Ҫ����
setPage(String url)����ʾurlָ����ҳ�档
setPage(URL page)����ʾurlָ����ҳ�档
3. JEditorPane���¼�
JEditorPane��һ������Ҫ���¼�HyperlinkEvent�����ӵ�ǰҳ��
�����ӷ�������ҳ��ʱ�����ڸ��¼��м������
����ʹ�������ӷ�������
������Ҫ��JEditorPanel.setEditable(false);�������ã�����
�༭��ʱ��
JEditorPanel ep=new JEditorPane();
ep.setPage(new URL("http://google.com"));
ep.setEditable(false);
ep.addHyperlinkListener(this);//ʹ������������
//����༭�ĵ�
ep.setEditable(true);
ep.CustomEdit();//�༭
ep.setEditable(false);
--
����������
[m[1;36m�� ��Դ:�������ʵBBS bbs.tju.edu.cn��[FROM: 202.113.13.188][m
Technical Details
Message-ID:
<4ddc0W$ACH@bbs.tju.edu.cn>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.neu.edu.cn!news.byr.edu.cn!TJUShow Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,950e7058bb2e8cf3,start X-Google-Attributes: gidf6cb0,domainid0,public,usenet X-Google-Language: Chinese,GB Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.neu.edu.cn!news.byr.edu.cn!TJU From: cffile.bbs@bbs.tju.edu.cn.no.spam (cffile) Newsgroups: cn.bbs.comp.lang.java Subject: Java Swing��JEditor Panel��ʹ�� Date: 30 Dec 2008 13:46:08 GMT Organization: �����ʵBBSվ Message-ID: <4ddc0W$ACH@bbs.tju.edu.cn> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: Java/M.1230644768.A Lines: 58